Files
swift-mirror/test/StringProcessing/Parse/forward-slash-regex-disabled.swift
Rintaro Ishizaki 47f18d492e [ASTGen] Move regex literal parsing from SwiftCompilerSources to ASTGen
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.
2023-11-16 10:59:23 -08:00

35 lines
834 B
Swift

// RUN: %target-typecheck-verify-swift -disable-availability-checking
// REQUIRES: swift_swift_parser
prefix operator /
prefix operator ^/
prefix operator /^/
precedencegroup P {
associativity: left
}
// The divisions in the body of the below operators make sure we don't try and
// consider them to be ending delimiters of a regex.
infix operator /^/ : P
func /^/ (lhs: Int, rhs: Int) -> Int { 1 / 2 }
infix operator /^ : P
func /^ (lhs: Int, rhs: Int) -> Int { 1 / 2 }
infix operator ^^/ : P
func ^^/ (lhs: Int, rhs: Int) -> Int { 1 / 2 }
_ = #/x/#
_ = /x/
// expected-error@-1 {{'/' is not a prefix unary operator}}
// expected-error@-2 {{cannot find 'x' in scope}}
// expected-error@-3 {{'/' is not a postfix unary operator}}
func baz(_ x: (Int, Int) -> Int, _ y: (Int, Int) -> Int) {}
baz(/, /)
baz(/^, /)
baz(^^/, /)