diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-01-05 18:50:36 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-01-05 18:50:36 -0500 |
| commit | e621ad014e919521268d3e2c94afadbdadadb59f (patch) | |
| tree | a038e0051b6d8c9b220cb2faa2918eb3f42fa909 /test/run_tests.cpp | |
| parent | 97e105489085fcf4530b3944499531d76848bbd1 (diff) | |
| download | zig-e621ad014e919521268d3e2c94afadbdadadb59f.tar.gz zig-e621ad014e919521268d3e2c94afadbdadadb59f.zip | |
pass cannot assign to constant test
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 5d05245888..4d1f5ed60d 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -548,7 +548,7 @@ const B = struct { const C = struct { x: i32, - fn d(c: C) { + fn d(c: &const C) { %%io.stdout.printf("OK\n"); } }; @@ -577,13 +577,13 @@ const io = @import("std").io; const Foo = struct { field1: Bar, - fn method(a: &Foo) -> bool { true } + fn method(a: &const Foo) -> bool { true } }; const Bar = struct { field2: i32, - fn method(b: &Bar) -> bool { true } + fn method(b: &const Bar) -> bool { true } }; pub fn main(args: [][]u8) -> %void { @@ -787,14 +787,14 @@ fn f(a : unreachable) {} fn f() { 3 = 3; } - )SOURCE", 1, ".tmp_source.zig:3:5: error: invalid assignment target"); + )SOURCE", 1, ".tmp_source.zig:3:7: error: cannot assign to constant"); add_compile_fail_case("assign to constant variable", R"SOURCE( fn f() { const a = 3; a = 4; } - )SOURCE", 1, ".tmp_source.zig:4:5: error: cannot assign to constant"); + )SOURCE", 1, ".tmp_source.zig:4:7: error: cannot assign to constant"); add_compile_fail_case("use of undeclared identifier", R"SOURCE( fn f() { |
