Files
swift-mirror/test/StringProcessing/Parse/forward-slash-regex-disabled.swift
Hamish Knight af7134b884 Fully enable ExperimentalStringProcessing
Previously we would only enable by default when
`parseArgs` was called. However this wouldn't
enable it for clients such as LLDB, who provide
their own invocation. Switch the default to `true`
in the `LangOptions`, and remove some redundant
uses of `-enable-experimental-string-processing`.
The frontend flag remains, as it may be useful to
disable.

rdar://107419385
rdar://101765556
2023-03-31 18:10:39 +01:00

35 lines
833 B
Swift

// RUN: %target-typecheck-verify-swift -disable-availability-checking
// REQUIRES: swift_in_compiler
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(^^/, /)