aboutsummaryrefslogtreecommitdiff
path: root/test/cases/error.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-06-18 18:48:29 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-06-18 18:48:29 -0400
commit626b73e8beeaae1cab23f883f877d89d64bbfa39 (patch)
tree4ed0ee57e00134f34656e759282b5c0e771726b2 /test/cases/error.zig
parenta430853a48a5e4dbcd0094c632957e28898159f3 (diff)
downloadzig-626b73e8beeaae1cab23f883f877d89d64bbfa39.tar.gz
zig-626b73e8beeaae1cab23f883f877d89d64bbfa39.zip
remove error to/from int casting syntax; add `@errorToInt`/`@intToError`
See #1061
Diffstat (limited to 'test/cases/error.zig')
-rw-r--r--test/cases/error.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/cases/error.zig b/test/cases/error.zig
index 95890d8384..45971fd40d 100644
--- a/test/cases/error.zig
+++ b/test/cases/error.zig
@@ -31,8 +31,8 @@ test "@errorName" {
}
test "error values" {
- const a = i32(error.err1);
- const b = i32(error.err2);
+ const a = @errorToInt(error.err1);
+ const b = @errorToInt(error.err2);
assert(a != b);
}
@@ -147,14 +147,14 @@ test "syntax: optional operator in front of error union operator" {
}
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));
+ testErrToIntWithOnePossibleValue(error.A, @errorToInt(error.A));
+ comptime testErrToIntWithOnePossibleValue(error.A, @errorToInt(error.A));
}
fn testErrToIntWithOnePossibleValue(
x: error{A},
comptime value: u32,
) void {
- if (u32(x) != value) {
+ if (@errorToInt(x) != value) {
@compileError("bad");
}
}