Files
swift-mirror/test/Parse/ConditionalCompilation/toplevel_parseaslibrary.swift
Rintaro Ishizaki 6fa84150c5 [AST] Eliminate IfConfigStmt
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
2017-05-16 12:19:54 +09:00

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