|
| 1 | +export fn testVoid() void { |
| 2 | + const f: void = @import("zon/neg_inf.zon"); |
| 3 | + _ = f; |
| 4 | +} |
| 5 | + |
| 6 | +export fn testInStruct() void { |
| 7 | + const f: struct { f: [*]const u8 } = @import("zon/neg_inf.zon"); |
| 8 | + _ = f; |
| 9 | +} |
| 10 | + |
| 11 | +export fn testError() void { |
| 12 | + const f: struct { error{foo} } = @import("zon/neg_inf.zon"); |
| 13 | + _ = f; |
| 14 | +} |
| 15 | + |
| 16 | +export fn testInUnion() void { |
| 17 | + const f: union(enum) { a: void, b: [*c]const u8 } = @import("zon/neg_inf.zon"); |
| 18 | + _ = f; |
| 19 | +} |
| 20 | + |
| 21 | +export fn testInVector() void { |
| 22 | + const f: @Vector(0, [*c]const u8) = @import("zon/neg_inf.zon"); |
| 23 | + _ = f; |
| 24 | +} |
| 25 | + |
| 26 | +export fn testInOpt() void { |
| 27 | + const f: *const ?[*c]const u8 = @import("zon/neg_inf.zon"); |
| 28 | + _ = f; |
| 29 | +} |
| 30 | + |
| 31 | +export fn testComptimeField() void { |
| 32 | + const f: struct { comptime foo: ??u8 = null } = @import("zon/neg_inf.zon"); |
| 33 | + _ = f; |
| 34 | +} |
| 35 | + |
| 36 | +export fn testEnumLiteral() void { |
| 37 | + const f: @TypeOf(.foo) = @import("zon/neg_inf.zon"); |
| 38 | + _ = f; |
| 39 | +} |
| 40 | + |
| 41 | +export fn testNestedOpt1() void { |
| 42 | + const f: ??u8 = @import("zon/neg_inf.zon"); |
| 43 | + _ = f; |
| 44 | +} |
| 45 | + |
| 46 | +export fn testNestedOpt2() void { |
| 47 | + const f: ?*const ?u8 = @import("zon/neg_inf.zon"); |
| 48 | + _ = f; |
| 49 | +} |
| 50 | + |
| 51 | +export fn testNestedOpt3() void { |
| 52 | + const f: *const ?*const ?*const u8 = @import("zon/neg_inf.zon"); |
| 53 | + _ = f; |
| 54 | +} |
| 55 | + |
| 56 | +export fn testOpt() void { |
| 57 | + const f: ?u8 = @import("zon/neg_inf.zon"); |
| 58 | + _ = f; |
| 59 | +} |
| 60 | + |
| 61 | +const E = enum(u8) { _ }; |
| 62 | +export fn testNonExhaustiveEnum() void { |
| 63 | + const f: E = @import("zon/neg_inf.zon"); |
| 64 | + _ = f; |
| 65 | +} |
| 66 | + |
| 67 | +const U = union { foo: void }; |
| 68 | +export fn testUntaggedUnion() void { |
| 69 | + const f: U = @import("zon/neg_inf.zon"); |
| 70 | + _ = f; |
| 71 | +} |
| 72 | + |
| 73 | +const EU = union(enum) { foo: void }; |
| 74 | +export fn testTaggedUnionVoid() void { |
| 75 | + const f: EU = @import("zon/neg_inf.zon"); |
| 76 | + _ = f; |
| 77 | +} |
| 78 | + |
| 79 | +export fn testVisited() void { |
| 80 | + const V = struct { |
| 81 | + ?f32, // Adds `?f32` to the visited list |
| 82 | + ??f32, // `?f32` is already visited, we need to detect the nested opt anyway |
| 83 | + f32, |
| 84 | + }; |
| 85 | + const f: V = @import("zon/neg_inf.zon"); |
| 86 | + _ = f; |
| 87 | +} |
| 88 | + |
| 89 | +export fn testMutablePointer() void { |
| 90 | + const f: *i32 = @import("zon/neg_inf.zon"); |
| 91 | + _ = f; |
| 92 | +} |
| 93 | + |
| 94 | +// error |
| 95 | +// imports=zon/neg_inf.zon |
| 96 | +// |
| 97 | +// tmp.zig:2:29: error: type 'void' is not available in ZON |
| 98 | +// tmp.zig:7:50: error: type '[*]const u8' is not available in ZON |
| 99 | +// tmp.zig:7:50: note: ZON does not allow many-pointers |
| 100 | +// tmp.zig:12:46: error: type 'error{foo}' is not available in ZON |
| 101 | +// tmp.zig:17:65: error: type '[*c]const u8' is not available in ZON |
| 102 | +// tmp.zig:17:65: note: ZON does not allow C pointers |
| 103 | +// tmp.zig:22:49: error: type '[*c]const u8' is not available in ZON |
| 104 | +// tmp.zig:22:49: note: ZON does not allow C pointers |
| 105 | +// tmp.zig:27:45: error: type '[*c]const u8' is not available in ZON |
| 106 | +// tmp.zig:27:45: note: ZON does not allow C pointers |
| 107 | +// tmp.zig:32:61: error: type '??u8' is not available in ZON |
| 108 | +// tmp.zig:32:61: note: ZON does not allow nested optionals |
| 109 | +// tmp.zig:42:29: error: type '??u8' is not available in ZON |
| 110 | +// tmp.zig:42:29: note: ZON does not allow nested optionals |
| 111 | +// tmp.zig:47:36: error: type '?*const ?u8' is not available in ZON |
| 112 | +// tmp.zig:47:36: note: ZON does not allow nested optionals |
| 113 | +// tmp.zig:52:50: error: type '?*const ?*const u8' is not available in ZON |
| 114 | +// tmp.zig:52:50: note: ZON does not allow nested optionals |
| 115 | +// tmp.zig:85:26: error: type '??f32' is not available in ZON |
| 116 | +// tmp.zig:85:26: note: ZON does not allow nested optionals |
| 117 | +// tmp.zig:90:29: error: type '*i32' is not available in ZON |
| 118 | +// tmp.zig:90:29: note: ZON does not allow mutable pointers |
| 119 | +// neg_inf.zon:1:1: error: expected type '@Type(.enum_literal)' |
| 120 | +// tmp.zig:37:38: note: imported here |
| 121 | +// neg_inf.zon:1:1: error: expected type '?u8' |
| 122 | +// tmp.zig:57:28: note: imported here |
| 123 | +// neg_inf.zon:1:1: error: expected type 'tmp.E' |
| 124 | +// tmp.zig:63:26: note: imported here |
| 125 | +// neg_inf.zon:1:1: error: expected type 'tmp.U' |
| 126 | +// tmp.zig:69:26: note: imported here |
| 127 | +// neg_inf.zon:1:1: error: expected type 'tmp.EU' |
| 128 | +// tmp.zig:75:27: note: imported here |
0 commit comments