mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Resolves: https://bugs.swift.org/browse/SR-4426 * Make IfConfigDecl be able to hold ASTNodes * Parse #if as IfConfigDecl * Stop enclosing toplevel #if into TopLevelCodeDecl. * Eliminate IfConfigStmt
12 lines
341 B
Swift
12 lines
341 B
Swift
// RUN: %target-typecheck-verify-swift -parse-as-library -D FOO
|
|
|
|
// '-parse-as-library' doesn't allow exprssions nor statements in #if blocks.
|
|
|
|
func foo() {}
|
|
|
|
#if FOO
|
|
foo() // expected-error {{expressions are not allowed at the top level}}
|
|
#else
|
|
if true { foo() } // expected-error {{statements are not allowed at the top level}}
|
|
#endif
|