Files
carbon-lang/toolchain/check/testdata/while/fail_break_continue.carbon
T
Jon Ross-Perkins b8ceb8dd8b Print a blank line after a diagnostic. (#3806)
The purpose of the newline is to make it clearer where a given
diagnostic begins and ends, particularly as the first message of a
diagnostic may not be the error.

This is a trivial code change, but ripples edits through test files.
2024-03-22 18:10:49 +00:00

50 lines
1.5 KiB
Plaintext

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn While() {
// CHECK:STDERR: fail_break_continue.carbon:[[@LINE+4]]:3: ERROR: `continue` can only be used in a loop.
// CHECK:STDERR: continue;
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
continue;
// CHECK:STDERR: fail_break_continue.carbon:[[@LINE+4]]:3: ERROR: `break` can only be used in a loop.
// CHECK:STDERR: break;
// CHECK:STDERR: ^~~~~
// CHECK:STDERR:
break;
while (false) {
continue;
break;
}
// CHECK:STDERR: fail_break_continue.carbon:[[@LINE+4]]:3: ERROR: `continue` can only be used in a loop.
// CHECK:STDERR: continue;
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
continue;
// CHECK:STDERR: fail_break_continue.carbon:[[@LINE+3]]:3: ERROR: `break` can only be used in a loop.
// CHECK:STDERR: break;
// CHECK:STDERR: ^~~~~
break;
}
// CHECK:STDOUT: --- fail_break_continue.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: bool = bool_literal false [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .While = %While
// CHECK:STDOUT: }
// CHECK:STDOUT: %While: <function> = fn_decl @While [template] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @While() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: }
// CHECK:STDOUT: