Skip to content

Commit 84bb580

Browse files
authored
Merge pull request #19630 from rudkx/add-new-test
Add a test involving multiple literal conformances.
2 parents 0707ca6 + 4984a4b commit 84bb580

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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

0 commit comments

Comments
 (0)