forked from swiftlang/swift
- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforward-slash-regex-disabled.swift
34 lines (25 loc) · 834 Bytes
/
forward-slash-regex-disabled.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// RUN: %target-typecheck-verify-swift -disable-availability-checking
// REQUIRES: swift_swift_parser
prefix operator /
prefix operator ^/
prefix operator /^/
precedencegroupP{
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(^^/,/)