diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-04-25 21:51:04 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-04-25 21:51:04 -0700 |
| commit | d0378057d1276d0bbbf0f0cac05e252bcc131692 (patch) | |
| tree | 945fed7b6d4914c629cd201c41bd52ca57765401 /test/run_tests.cpp | |
| parent | d1b65c6f46ab0891db3c80db2eedbb434168aabe (diff) | |
| download | zig-d0378057d1276d0bbbf0f0cac05e252bcc131692.tar.gz zig-d0378057d1276d0bbbf0f0cac05e252bcc131692.zip | |
support switching on error union type
closes #23
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 09b86dc7a5..b0d3006c8d 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1233,6 +1233,18 @@ fn bad_eql_2(a: EnumWithData, b: EnumWithData) -> bool { )SOURCE", 2, ".tmp_source.zig:3:7: error: operator not allowed for type '[]u8'", ".tmp_source.zig:10:7: error: operator not allowed for type 'EnumWithData'"); + + add_compile_fail_case("non-const switch number literal", R"SOURCE( +fn foo() { + const x = switch (bar()) { + 1, 2 => 1, + 3, 4 => 2, + else => 3, + }; +} +#static_eval_enable(false) +fn bar() -> i32 { 2 } + )SOURCE", 1, ".tmp_source.zig:3:15: error: unable to infer expression type"); } ////////////////////////////////////////////////////////////////////////////// |
