diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-01-18 17:04:37 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-01-18 17:04:37 -0700 |
| commit | ea21d2beb6cbdac8f5b6811a0f01aa6d2ee2ddf3 (patch) | |
| tree | 3b277a3570b63f1eeb8fed2218d16bd578f12835 /test/run_tests.cpp | |
| parent | 32821e7098ba29c30e458f555f62954ce54dcb1a (diff) | |
| download | zig-ea21d2beb6cbdac8f5b6811a0f01aa6d2ee2ddf3.tar.gz zig-ea21d2beb6cbdac8f5b6811a0f01aa6d2ee2ddf3.zip | |
add error for shadowing a type
closes #61
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 0e032c64d3..9c7db17792 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1501,6 +1501,16 @@ const foo = []u16{.x = 1024,}; add_compile_fail_case("type variables must be constant", R"SOURCE( var foo = u8; )SOURCE", 1, ".tmp_source.zig:2:1: error: variable of type 'type' must be constant"); + + add_compile_fail_case("variables shadowing types", R"SOURCE( +struct Foo {} +struct Bar {} + +fn f(Foo: i32) => { + var Bar : i32; +} + )SOURCE", 2, ".tmp_source.zig:5:6: error: variable shadows type 'Foo'", + ".tmp_source.zig:6:5: error: variable shadows type 'Bar'"); } static void print_compiler_invocation(TestCase *test_case) { |
