Skip to content

Commit 0aead28

Browse files
committed
Add a Compiler Crasher
The problem is that we currenly cannot represent the generic signature of values of type `any P<some P>`. This is because we wind up producing <Self where Self : P, Self.T == (some P)> What we'd like to do in the future is erase the errant (some P) with a fresh generic parameter and keep a substitution map on the side that records the opaque type constraint. Something like <Self, Opaque1 where Self : P, Opaque1 : P, Self.T == Opaque1> where Opaque1 == (some P)
1 parent 4efcb82 commit 0aead28

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: not --crash %target-swift-frontend -disable-availability-checking -emit-ir -enable-parameterized-protocol-types %s
2+
3+
// REQUIRES: asserts
4+
5+
protocol P<X: P, Y: P> {
6+
var x: X { get }
7+
var y: Y { get }
8+
}
9+
10+
extension Int: P {
11+
typealias X = Int
12+
typealias Y = Int
13+
var x: X { 0 }
14+
var y: X { 0 }
15+
}
16+
17+
struct Foo<T: P>: P {
18+
typealias X = T
19+
typealias Y = T
20+
21+
var x: X
22+
var y: X { self.x }
23+
}
24+
25+
func test() -> any P<some P<any P, any P>, some P<any P, any P>> { return Foo<Int>(x: 42) }

0 commit comments

Comments
 (0)