aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2019-12-30 16:48:14 +0100
committerAndrew Kelley <andrew@ziglang.org>2019-12-30 17:45:09 -0500
commit28a8ded95a96b1e2af5d2a73f47db2c967233476 (patch)
treeac9bc2f2248988c8ebc99d990ea315c0dcc397d9 /test
parentc1ee846c221a43b3bb3f9e427a2077b444435ec7 (diff)
downloadzig-28a8ded95a96b1e2af5d2a73f47db2c967233476.tar.gz
zig-28a8ded95a96b1e2af5d2a73f47db2c967233476.zip
Resolve more types as needed
Closes #3994
Diffstat (limited to 'test')
-rw-r--r--test/stage1/behavior/error.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/stage1/behavior/error.zig b/test/stage1/behavior/error.zig
index 7c1e093748..d4f64b7cff 100644
--- a/test/stage1/behavior/error.zig
+++ b/test/stage1/behavior/error.zig
@@ -1,6 +1,7 @@
const std = @import("std");
const expect = std.testing.expect;
const expectError = std.testing.expectError;
+const expectEqual = std.testing.expectEqual;
const mem = std.mem;
const builtin = @import("builtin");
@@ -427,3 +428,17 @@ test "return result loc as peer result loc in inferred error set function" {
S.doTheTest();
comptime S.doTheTest();
}
+
+test "error payload type is correctly resolved" {
+ const MyIntWrapper = struct {
+ const Self = @This();
+
+ x: i32,
+
+ pub fn create() anyerror!Self {
+ return Self{ .x = 42 };
+ }
+ };
+
+ expectEqual(MyIntWrapper{ .x = 42 }, try MyIntWrapper.create());
+}