Fix crash with peer type resolution & error unions

Fixes #3353
This commit is contained in:
LemonBoy
2019-10-20 22:56:58 +02:00
committed by Andrew Kelley
parent 771dafbaba
commit ddb87237de
2 changed files with 22 additions and 0 deletions

View File

@@ -2,6 +2,16 @@ const tests = @import("tests.zig");
const builtin = @import("builtin");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
"comparison with error union and error value",
\\export fn entry() void {
\\ var number_or_error: anyerror!i32 = error.SomethingAwful;
\\ _ = number_or_error == error.SomethingAwful;
\\}
,
"tmp.zig:3:25: error: operator not allowed for type 'anyerror!i32'",
);
cases.add(
"switch with overlapping case ranges",
\\export fn entry() void {