|
| 1 | +// zig fmt: off |
| 2 | +comptime { _ = @min(0, u32); } // type |
| 3 | +comptime { _ = @max(0, {}); } // void |
| 4 | +comptime { _ = @min(0, false); } // boolean |
| 5 | +comptime { _ = @min(0, &@as(u8, 0)); } // pointer |
| 6 | +comptime { _ = @max(0, [0]u8{}); } // array |
| 7 | +comptime { _ = @min(0, Struct{}); } // struct |
| 8 | +comptime { _ = @max(0, null); } // null |
| 9 | +comptime { _ = @min(0, @as(?u8, 0)); } // nullable |
| 10 | +comptime { _ = @max(0, @as(error{}!u8, 0)); } // error union |
| 11 | +comptime { _ = @min(0, error.Foo); } // error set |
| 12 | +comptime { _ = @max(0, Enum.foo); } // enum |
| 13 | +comptime { _ = @min(0, Union{ .foo = {} }); } // union |
| 14 | +comptime { _ = @max(0, struct { fn func() u8 { return 42; }}.func); } |
| 15 | +comptime { _ = @max(0, .foo); } // enum literal |
| 16 | + |
| 17 | +const Struct = struct {}; |
| 18 | +const Enum = enum { foo }; |
| 19 | +const Union = union { foo: void }; |
| 20 | + |
| 21 | +// error |
| 22 | +// backend=stage2 |
| 23 | +// target=native |
| 24 | +// |
| 25 | +// :2:24: error: expected number, found 'type' |
| 26 | +// :3:24: error: expected number, found 'void' |
| 27 | +// :4:24: error: expected number, found 'bool' |
| 28 | +// :5:24: error: expected number, found '*const u8' |
| 29 | +// :6:29: error: expected number, found '[0]u8' |
| 30 | +// :7:30: error: expected number, found 'tmp.Struct' |
| 31 | +// :17:16: note: struct declared here |
| 32 | +// :8:24: error: expected number, found '@TypeOf(null)' |
| 33 | +// :9:24: error: expected number, found '?u8' |
| 34 | +// :10:24: error: expected number, found 'error{}!u8' |
| 35 | +// :11:24: error: expected number, found 'error{Foo}' |
| 36 | +// :12:28: error: expected number, found 'tmp.Enum' |
| 37 | +// :18:14: note: enum declared here |
| 38 | +// :13:29: error: expected number, found 'tmp.Union' |
| 39 | +// :19:15: note: union declared here |
| 40 | +// :14:61: error: expected number, found 'fn () u8' |
| 41 | +// :15:25: error: expected number, found '@Type(.enum_literal)' |
0 commit comments