mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
...https://github.com/swiftlang/swift/pull/81280. The deleted test was `test/FixCode/fixits-if-else.swift`. Resurrect it in a better place and switch it to the diagnostic verifier, as it was intended to along with other moved tests in that PR.
45 lines
916 B
Swift
45 lines
916 B
Swift
// RUN: %target-swift-frontend -parse -verify %s
|
|
|
|
// No more diags expected during Sema.
|
|
// RUN: %target-typecheck-verify-swift
|
|
|
|
do {
|
|
func something() -> Bool {}
|
|
func foo() {}
|
|
|
|
do {
|
|
if something() {
|
|
// expected-error@+1:11 {{expected '{' or 'if' after 'else'}}{{none}}
|
|
} else
|
|
}
|
|
|
|
do {
|
|
if something() {
|
|
// expected-error@+1:11 {{expected '{' or 'if' after 'else'}}{{none}}
|
|
} else
|
|
foo()
|
|
}
|
|
|
|
do {
|
|
if something() {
|
|
// expected-error@+1:7 {{expected '{' or 'if' after 'else'; did you mean to write 'if'?}}{{11-11= if}}
|
|
} else something() { // Fix-it because all on one line.
|
|
}
|
|
}
|
|
|
|
do {
|
|
if something() {
|
|
// expected-error@+1:12 {{expected '{' or 'if' after 'else'}}{{none}}
|
|
} else something()
|
|
{
|
|
}
|
|
}
|
|
|
|
do {
|
|
if something() {
|
|
// expected-error@+1:12 {{expected '{' or 'if' after 'else'}}{{none}}
|
|
} else something()
|
|
foo1()
|
|
}
|
|
}
|