Files
swift-mirror/test/stmt/then_stmt_disabled.swift
Hamish Knight 89a3390aa1 [Sema] Move SingleValueStmtUsageChecker into pre-checking
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.
2024-08-30 18:55:48 +01:00

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
}