Skip to content

Commit 17172c6

Browse files
committed
SIL: Correctly unwrap one-element tuples in TypeConverter::computeLoweredRValueType()
Fixes rdar://problem/123978349.
1 parent 8f713a9 commit 17172c6

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

lib/SIL/IR/TypeLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3294,7 +3294,7 @@ TypeConverter::computeLoweredRValueType(TypeExpansionContext forExpansion,
32943294
AbstractionPattern origType)
32953295
: TC(TC), forExpansion(forExpansion), origType(origType) {
32963296
if (auto origEltType = origType.getVanishingTupleElementPatternType())
3297-
origType = *origEltType;
3297+
this->origType = *origEltType;
32983298
}
32993299

33003300
// AST function types are turned into SIL function types:
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// RUN: %target-swift-emit-silgen %s -disable-availability-checking
2+
3+
// Make sure we can lower all of these types without crashing.
4+
5+
public struct G1<each T> {
6+
public let t: (repeat each T)
7+
}
8+
9+
public struct S1 {
10+
public let g: G1< >
11+
public let gg: G1<Int>
12+
public let ggg: G1<Int, Float>
13+
}
14+
15+
public struct G2<each T> {
16+
public let t: (repeat (each T).Type)
17+
}
18+
19+
public struct S2 {
20+
public let g: G2< >
21+
public let gg: G2<Int>
22+
public let ggg: G2<Int, Float>
23+
}
24+
25+
public struct G3<each T> {
26+
public let t: (repeat (each T) -> ())
27+
}
28+
29+
public struct S3 {
30+
public let g: G3< >
31+
public let gg: G3<Int>
32+
public let ggg: G3<Int, Float>
33+
}
34+
35+
public struct G4<each T> {
36+
public let t: (repeat ((each T).Type) -> ())
37+
}
38+
39+
public struct S4 {
40+
public let g: G4< >
41+
public let gg: G4<Int>
42+
public let ggg: G4<Int, Float>
43+
}

0 commit comments

Comments
 (0)