mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Previously we would only diagnose and recover for invalid tokens following a `#if` body for the decl and postfix expression case. Sink this logic into `parseIfConfigRaw`, ensuring that we do this for all `#if` cases. This requires propagating the context we're parsing in to customize the diagnostic.
17 lines
348 B
Swift
17 lines
348 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// Make sure we can recover by ignoring the '}' in the #if.
|
|
struct S {
|
|
func foo() {
|
|
#if true
|
|
} // expected-error {{unexpected '}' in conditional compilation block}}
|
|
#endif
|
|
}
|
|
func bar() {
|
|
#if false
|
|
} // expected-error {{unexpected '}' in conditional compilation block}}
|
|
#endif
|
|
}
|
|
func baz() {}
|
|
}
|