Files
swift-mirror/test/Parse/features.swift
Doug Gregor fd16deecba Introduce checking for language features via "#if $FeatureName"
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
2021-02-05 15:22:02 -08:00

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