[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.
This commit is contained in:
Hamish Knight
2024-08-30 18:55:48 +01:00
parent 1139b0e799
commit 89a3390aa1
12 changed files with 248 additions and 253 deletions

View File

@@ -6,6 +6,6 @@ let x = if .random() {
then 0
// expected-error@-1 {{cannot find 'then' in scope}}
// expected-error@-2 {{consecutive statements on a line must be separated by ';'}}
} else {
} else { // expected-error {{non-expression branch of 'if' expression may only end with a 'throw'}}
1
}