Skip to content

Commit 919741f

Browse files
committed
---
yaml --- r: 349424 b: refs/heads/master-next c: 4722e1e h: refs/heads/master
1 parent 5c42fe5 commit 919741f

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: e1838a334b5a6a54874c9db7fd54cac036f864fd
3+
refs/heads/master-next: 4722e1e918588f074ecb52c05c90884f3a7b915a
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/lib/IRGen/Outlining.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ void OutliningMetadataCollector::collectTypeMetadataForLayout(SILType type) {
3535
return;
3636
}
3737

38+
// Substitute opaque types if allowed.
39+
type = IGF.IGM.substOpaqueTypesWithUnderlyingTypes(type);
40+
3841
auto formalType = type.getASTType();
3942
auto &ti = IGF.IGM.getTypeInfoForLowered(formalType);
4043

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// RUN: %target-swift-frontend -disable-availability-checking -emit-ir %s | %FileCheck %s
2+
3+
protocol E {}
4+
5+
struct Pair<T, V> : E {
6+
var fst : T
7+
var snd : V
8+
9+
init(_ f: T, _ s: V) {
10+
self.fst = f
11+
self.snd = s
12+
}
13+
14+
func foobar() -> some E {
15+
return self
16+
}
17+
}
18+
19+
public func usePair<T, V>(_ t: T, _ v: V) {
20+
var x = Pair(t, v)
21+
let q = x.foobar()
22+
let u = x.foobar()
23+
let p = Pair(q, u)
24+
print(p)
25+
}
26+
27+
// CHECK-LABEL: define{{.*}} swiftcc void @"$s31opaque_result_type_substitution7usePairyyx_q_tr0_lF"({{.*}}, %swift.type* %T, %swift.type* %V)
28+
// CHECK: [[PAIR_TV:%.*]] = call swiftcc %swift.metadata_response @"$s31opaque_result_type_substitution4PairVMa"({{.*}}, %swift.type* %T, %swift.type* %V)
29+
// CHECK: [[MD:%.*]] = extractvalue %swift.metadata_response [[PAIR_TV]], 0
30+
// CHECK: [[PAIR_OPAQUE:%.*]] = call swiftcc %swift.metadata_response @"$s31opaque_result_type_substitution4PairVMa"({{.*}}, %swift.type* [[MD]], %swift.type* [[MD]])
31+
// CHECK: [[MD2:%.*]] = extractvalue %swift.metadata_response [[PAIR_OPAQUE]], 0
32+
// CHECK: call {{.*}}* @"$s31opaque_result_type_substitution4PairVyAC6foobarQryFQOyxq__Qo_AEGr0_lWOh"({{.*}}, %swift.type* {{.*}}, %swift.type* [[MD2]])

0 commit comments

Comments
 (0)