Skip to content

Commit e3d8e35

Browse files
authored
Merge pull request #81080 from slavapestov/fix-rdar149353285-6.2
[6.2] SIL: Use SubstitutionMap::mapIntoTypeExpansionContext() in SILTypeSubstituter
2 parents 918ae4a + 88814e4 commit e3d8e35

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

lib/SIL/IR/SILTypeSubstitution.cpp

+1-14
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,7 @@ class SILTypeSubstituter :
6868
if (!typeExpansionContext.shouldLookThroughOpaqueTypeArchetypes())
6969
return subs;
7070

71-
return subs.subst([&](SubstitutableType *s) -> Type {
72-
return substOpaqueTypesWithUnderlyingTypes(s->getCanonicalType(),
73-
typeExpansionContext);
74-
}, [&](CanType dependentType,
75-
Type conformingReplacementType,
76-
ProtocolDecl *conformedProtocol) -> ProtocolConformanceRef {
77-
return substOpaqueTypesWithUnderlyingTypes(
78-
ProtocolConformanceRef::forAbstract(conformingReplacementType,
79-
conformedProtocol),
80-
conformingReplacementType->getCanonicalType(),
81-
typeExpansionContext);
82-
},
83-
SubstFlags::SubstituteOpaqueArchetypes |
84-
SubstFlags::PreservePackExpansionLevel);
71+
return subs.mapIntoTypeExpansionContext(typeExpansionContext);
8572
}
8673

8774
// Substitute a function type.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %target-swift-emit-silgen %s
2+
3+
public protocol P {}
4+
5+
extension P {
6+
}
7+
8+
public struct S: P {
9+
public func callAsFunction<V>(_: () -> V) { }
10+
}
11+
12+
public func f() -> some P {
13+
S()
14+
}
15+
16+
public struct G<T: P>: P {
17+
public init(_: () -> T) {}
18+
}
19+
20+
S() {
21+
return G { return f() }
22+
}
23+

0 commit comments

Comments
 (0)