AstGen: preserve inferred ptr result loc for breaks

This commit is contained in:
Veikka Tuominen
2022-05-26 15:30:42 +03:00
parent e08cdad53b
commit 8bf3e1f8d0
3 changed files with 35 additions and 1 deletions

View File

@@ -933,3 +933,15 @@ test "try in labeled block doesn't cast to wrong type" {
};
_ = s;
}
test "comptime int in switch in catch is casted to correct inferred type" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
var a: error{ A, B }!u64 = 0;
var b = a catch |err| switch (err) {
error.A => 0,
else => unreachable,
};
_ = b;
}