aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/error.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-08-24 18:56:16 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-08-24 22:35:37 -0700
commit9c95f38a7c1defc7f63a4815bfc2d76a5f9f83f6 (patch)
tree3182a24f22da9da86b56d8894b4bd603e89e10e3 /test/behavior/error.zig
parentf1f28af1880a79bb2d7210d3a704c78698f0b45b (diff)
downloadzig-9c95f38a7c1defc7f63a4815bfc2d76a5f9f83f6.tar.gz
zig-9c95f38a7c1defc7f63a4815bfc2d76a5f9f83f6.zip
stage1: remove incorrect compile error for var redeclaration
Locals are not allowed to shadow declarations, but declarations are allowed to shadow each other, as long as there are no ambiguous references. closes #678
Diffstat (limited to 'test/behavior/error.zig')
-rw-r--r--test/behavior/error.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/behavior/error.zig b/test/behavior/error.zig
index b1ef55af9e..74bf105799 100644
--- a/test/behavior/error.zig
+++ b/test/behavior/error.zig
@@ -412,19 +412,19 @@ test "function pointer with return type that is error union with payload which i
test "return result loc as peer result loc in inferred error set function" {
const S = struct {
fn doTheTest() !void {
- if (foo(2)) |x| {
+ if (quux(2)) |x| {
try expect(x.Two);
} else |e| switch (e) {
error.Whatever => @panic("fail"),
}
- try expectError(error.Whatever, foo(99));
+ try expectError(error.Whatever, quux(99));
}
const FormValue = union(enum) {
One: void,
Two: bool,
};
- fn foo(id: u64) !FormValue {
+ fn quux(id: u64) !FormValue {
return switch (id) {
2 => FormValue{ .Two = true },
1 => FormValue{ .One = {} },
@@ -452,11 +452,11 @@ test "error payload type is correctly resolved" {
test "error union comptime caching" {
const S = struct {
- fn foo(comptime arg: anytype) void {
+ fn quux(comptime arg: anytype) void {
arg catch {};
}
};
- S.foo(@as(anyerror!void, {}));
- S.foo(@as(anyerror!void, {}));
+ S.quux(@as(anyerror!void, {}));
+ S.quux(@as(anyerror!void, {}));
}