| ... | ... | @@ -140,3 +140,13 @@ test "syntax: nullable operator in front of error union operator" { |
| 140 | 140 | assert(?error!i32 == ?(error!i32)); |
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | |
| 144 | test "comptime err to int of error set with only 1 possible value" { |
| 145 | testErrToIntWithOnePossibleValue(error.A, u32(error.A)); |
| 146 | comptime testErrToIntWithOnePossibleValue(error.A, u32(error.A)); |
| 147 | } |
| 148 | fn testErrToIntWithOnePossibleValue(x: error{A}, comptime value: u32) void { |
| 149 | if (u32(x) != value) { |
| 150 | @compileError("bad"); |
| 151 | } |
| 152 | } |