mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ASTGen always builds with the host Swift compiler, without requiring bootstrapping, and is enabled in more places. Move the regex literal parsing logic there so it is enabled in more host environments, and makes use of CMake's Swift support. Enable all of the regex literal tests when ASTGen is built, to ensure everything is working. Remove the "AST" and "Parse" Swift modules from SwiftCompilerSources, because they are no longer needed.
24 lines
461 B
Swift
24 lines
461 B
Swift
// RUN: %target-typecheck-verify-swift -enable-bare-slash-regex -disable-availability-checking
|
|
// REQUIRES: swift_swift_parser
|
|
|
|
// Test the behavior of prefix '/' with regex literals enabled.
|
|
|
|
prefix operator /
|
|
prefix func / <T> (_ x: T) -> T { x }
|
|
|
|
enum E {
|
|
case e
|
|
func foo<T>(_ x: T) {}
|
|
}
|
|
|
|
_ = /E.e
|
|
(/E.e).foo(/0)
|
|
|
|
func foo<T, U>(_ x: T, _ y: U) {}
|
|
foo(/E.e, /E.e)
|
|
foo((/E.e), /E.e)
|
|
foo((/)(E.e), /E.e)
|
|
|
|
func bar<T>(_ x: T) -> Int { 0 }
|
|
_ = bar(/E.e) / 2
|