add test for comptime err to int with only 1 member of set

This commit is contained in:
Andrew Kelley 2018-02-08 22:44:15 -05:00
parent ee982ae162
commit 4b16874f04
2 changed files with 10 additions and 10 deletions

10
TODO
View File

@ -1,10 +0,0 @@
comptime calling fn with inferred error set should give empty error set but still you can use try
comptime err to int of empty err set and of size 1 err set
undefined in infer error
syntax - (error{}!void) as the return type

View File

@ -140,3 +140,13 @@ test "syntax: nullable operator in front of error union operator" {
assert(?error!i32 == ?(error!i32));
}
}
test "comptime err to int of error set with only 1 possible value" {
testErrToIntWithOnePossibleValue(error.A, u32(error.A));
comptime testErrToIntWithOnePossibleValue(error.A, u32(error.A));
}
fn testErrToIntWithOnePossibleValue(x: error{A}, comptime value: u32) void {
if (u32(x) != value) {
@compileError("bad");
}
}