diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-01-06 18:02:42 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-01-06 18:02:42 -0700 |
| commit | c75d40680ff8a143b9298968a3ca3053dea2e460 (patch) | |
| tree | 1d54def2a7dd431805db19debe07eb983bedd5db /test/run_tests.cpp | |
| parent | 5f0bfcac24036e1fff0b2beda643a60dad465213 (diff) | |
| download | zig-c75d40680ff8a143b9298968a3ca3053dea2e460.tar.gz zig-c75d40680ff8a143b9298968a3ca3053dea2e460.zip | |
while detects simple constant condition
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 661100f6b4..c41832e47d 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -683,7 +683,12 @@ pub fn main(argc : isize, argv : &&u8, env : &&u8) -> i32 { print_str("loop\n"); i += 1; } - return 0; + return f(); +} +fn f() -> i32 { + while (true) { + return 0; + } } )SOURCE", "loop\nloop\nloop\nloop\n"); @@ -1168,13 +1173,13 @@ fn f() { fn f() { break; } - )SOURCE", 1, ".tmp_source.zig:3:5: error: 'break' expression not in loop"); + )SOURCE", 1, ".tmp_source.zig:3:5: error: 'break' expression outside loop"); add_compile_fail_case("invalid continue expression", R"SOURCE( fn f() { continue; } - )SOURCE", 1, ".tmp_source.zig:3:5: error: 'continue' expression not in loop"); + )SOURCE", 1, ".tmp_source.zig:3:5: error: 'continue' expression outside loop"); add_compile_fail_case("invalid maybe type", R"SOURCE( fn f() { |
