mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
These diagnostics are better suited for pre-checking since we ought to be emitting them even if there's some other error with the expression.
12 lines
378 B
Swift
12 lines
378 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// Then statements are disabled by default
|
|
let x = if .random() {
|
|
print("hello")
|
|
then 0
|
|
// expected-error@-1 {{cannot find 'then' in scope}}
|
|
// expected-error@-2 {{consecutive statements on a line must be separated by ';'}}
|
|
} else { // expected-error {{non-expression branch of 'if' expression may only end with a 'throw'}}
|
|
1
|
|
}
|