Skip to content

Commit 8f912c1

Browse files
committed
---
yaml --- r: 349446 b: refs/heads/master-next c: 5c23950 h: refs/heads/master
1 parent fca05ce commit 8f912c1

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
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: c0098f9a9b6d8dae0a907520b990a135c5bb231b
3+
refs/heads/master-next: 5c2395098bba38943d43a4a9015c85a927e2a7cc
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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ void OutliningMetadataCollector::collectTypeMetadataForLayout(SILType type) {
3636
}
3737

3838
// Substitute opaque types if allowed.
39+
auto origType = type;
3940
type = IGF.IGM.substOpaqueTypesWithUnderlyingTypes(type);
4041

4142
auto formalType = type.getASTType();
@@ -44,7 +45,9 @@ void OutliningMetadataCollector::collectTypeMetadataForLayout(SILType type) {
4445
// We don't need the metadata for fixed size types or types that are not ABI
4546
// accessible. Outlining will call the value witness of the enclosing type of
4647
// non ABI accessible field/element types.
47-
if (isa<FixedTypeInfo>(ti) || !ti.isABIAccessible()) {
48+
if ((!origType.getASTType()->hasOpaqueArchetype() &&
49+
isa<FixedTypeInfo>(ti)) ||
50+
!ti.isABIAccessible()) {
4851
return;
4952
}
5053

branches/master-next/test/IRGen/opaque_result_type_substitution.swift

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,43 @@ public func usePair<T, V>(_ t: T, _ v: V) {
2424
print(p)
2525
}
2626

27+
protocol P { }
28+
29+
struct C<S : Hashable> {
30+
struct Inner {}
31+
32+
init(_ s: S) { }
33+
34+
func getInner() -> Inner {
35+
return Inner()
36+
}
37+
}
38+
39+
struct O<T> {
40+
var t: T
41+
42+
init(_ t: T) {
43+
self.t = t
44+
}
45+
}
46+
47+
struct M<T, V> : P {
48+
init(_ f: T, _ s: V) {
49+
}
50+
51+
func foobar() -> some P {
52+
return self
53+
}
54+
}
55+
56+
public func test2<S : Hashable, T, V>(_ s: S, _ t: T, _ v: V) {
57+
var x = M(C(s).getInner(), t)
58+
let q = x.foobar()
59+
let u = x.foobar()
60+
let y = O(q)
61+
print(y)
62+
}
63+
2764
// CHECK-LABEL: define{{.*}} swiftcc void @"$s31opaque_result_type_substitution7usePairyyx_q_tr0_lF"({{.*}}, %swift.type* %T, %swift.type* %V)
2865
// CHECK: [[PAIR_TV:%.*]] = call swiftcc %swift.metadata_response @"$s31opaque_result_type_substitution4PairVMa"({{.*}}, %swift.type* %T, %swift.type* %V)
2966
// CHECK: [[MD:%.*]] = extractvalue %swift.metadata_response [[PAIR_TV]], 0

0 commit comments

Comments
 (0)