File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift
2
+
3
+ infix operator +++ : AdditionPrecedence
4
+ infix operator *** : MultiplicationPrecedence
5
+
6
+ protocol P {
7
+ static func +++ ( lhs: Self , rhs: Self ) -> Self
8
+ }
9
+
10
+ extension P {
11
+ static func +++ ( lhs: Self , rhs: Self ) -> Self {
12
+ return lhs
13
+ }
14
+ }
15
+
16
+ protocol Q {
17
+ static func *** ( lhs: Self , rhs: Self ) -> Self
18
+ }
19
+
20
+ struct Y : Q {
21
+ static func *** ( lhs: Y , rhs: Y ) -> Y {
22
+ return rhs
23
+ }
24
+ }
25
+
26
+ struct X : P , ExpressibleByIntegerLiteral , ExpressibleByStringLiteral
27
+ {
28
+ typealias IntegerLiteralType = Int
29
+ public init ( integerLiteral value: IntegerLiteralType ) { }
30
+
31
+ typealias StringLiteralType = String
32
+ public init ( stringLiteral value: StringLiteralType ) { }
33
+ }
34
+
35
+ // This overload is required in order to be able to typecheck the
36
+ // expression at the bottom.
37
+ extension X : Q {
38
+ static func *** ( lhs: X , rhs: X ) -> X {
39
+ return rhs
40
+ }
41
+ }
42
+
43
+ extension Int : P { }
44
+ extension String : P { }
45
+
46
+ let _ = 1 +++ " hi " +++ 3 *** 4 +++ 5
You can’t perform that action at this time.
0 commit comments