mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Introduce some basic support for defining specific language features
that can be checked by name, e.g.,
#if $AsyncAwait
// use the feature
#endif
For backward compatibility with older compilers, to actually prevent
the parser from parsing, one will have to do a Swift compiler version
check, even though the version number doesn't matter. For example:
#if compiler(>=5.3) && $AsyncAwait
// use the feature
#endif
10 lines
303 B
Swift
10 lines
303 B
Swift
// RUN: not %target-swift-frontend -typecheck %s 2>&1 | %FileCheck --check-prefix=CHECK-WITHOUT %s
|
|
// RUN: %target-typecheck-verify-swift -enable-experimental-static-assert
|
|
|
|
#if compiler(>=5.3) && $StaticAssert
|
|
#assert(true)
|
|
#else
|
|
// CHECK-WITHOUT: cannot find 'complete' in scope
|
|
complete junk
|
|
#endif
|