@@ -13,10 +13,28 @@ struct S2 {}
13
13
14
14
// CHECK-LABEL: sil hidden @_TF21same_type_abstraction28callClosureWithConcreteTypes
15
15
// CHECK: function_ref @_TTR
16
- func callClosureWithConcreteTypes<
17
- T: Associated , U: Associated
18
- where
19
- T. Assoc == S1 , U. Assoc == S2
20
- > ( x x: Abstracted < T , U > , arg: S1 ) -> S2 {
16
+ func callClosureWithConcreteTypes< T: Associated , U: Associated > ( x: Abstracted < T , U > , arg: S1 ) -> S2 where T. Assoc == S1 , U. Assoc == S2 {
21
17
return x. closure ( arg)
22
18
}
19
+
20
+ // Problem when a same-type constraint makes an associated type into a tuple
21
+
22
+ protocol MyProtocol {
23
+ associatedtype ReadData
24
+ associatedtype Data
25
+
26
+ func readData( ) -> ReadData
27
+ }
28
+
29
+ extension MyProtocol where Data == ( ReadData , ReadData ) {
30
+ // CHECK-LABEL: sil hidden @_TFe21same_type_abstractionRxS_10MyProtocolwx4DatazTwx8ReadDatawxS2__rS0_11currentDatafT_wxS1_ : $@convention(method) <Self where Self : MyProtocol, Self.Data == (Self.ReadData, Self.ReadData)> (@in_guaranteed Self) -> (@out Self.ReadData, @out Self.ReadData)
31
+ func currentData( ) -> Data {
32
+ // CHECK: bb0(%0 : $*Self.ReadData, %1 : $*Self.ReadData, %2 : $*Self):
33
+ // CHECK: [[READ_FN:%.*]] = witness_method $Self, #MyProtocol.readData!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : MyProtocol> (@in_guaranteed τ_0_0) -> @out τ_0_0.ReadData
34
+ // CHECK: apply [[READ_FN]]<Self>(%0, %2) : $@convention(witness_method) <τ_0_0 where τ_0_0 : MyProtocol> (@in_guaranteed τ_0_0) -> @out τ_0_0.ReadData
35
+ // CHECK: [[READ_FN:%.*]] = witness_method $Self, #MyProtocol.readData!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : MyProtocol> (@in_guaranteed τ_0_0) -> @out τ_0_0.ReadData
36
+ // CHECK: apply [[READ_FN]]<Self>(%1, %2) : $@convention(witness_method) <τ_0_0 where τ_0_0 : MyProtocol> (@in_guaranteed τ_0_0) -> @out τ_0_0.ReadData
37
+ // CHECK: return
38
+ return ( readData ( ) , readData ( ) )
39
+ }
40
+ }
0 commit comments