File tree Expand file tree Collapse file tree 4 files changed +25
-17
lines changed Expand file tree Collapse file tree 4 files changed +25
-17
lines changed Original file line number Diff line number Diff line change @@ -238,14 +238,6 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
238
238
}
239
239
240
240
CanType getOpASTType (CanType ty) {
241
- // Substitute local archetypes, if we have any.
242
- if (ty->hasLocalArchetype () && !LocalArchetypeSubs.empty ()) {
243
- ty = ty.subst (
244
- QueryTypeSubstitutionMapOrIdentity{LocalArchetypeSubs},
245
- MakeAbstractConformanceForGenericType ()
246
- )->getCanonicalType ();
247
- }
248
-
249
241
return asImpl ().remapASTType (ty);
250
242
}
251
243
@@ -450,8 +442,16 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
450
442
return Ty;
451
443
}
452
444
453
- CanType remapASTType (CanType Ty) {
454
- return Ty;
445
+ CanType remapASTType (CanType ty) {
446
+ // Substitute local archetypes, if we have any.
447
+ if (ty->hasLocalArchetype () && !LocalArchetypeSubs.empty ()) {
448
+ ty = ty.subst (
449
+ QueryTypeSubstitutionMapOrIdentity{LocalArchetypeSubs},
450
+ MakeAbstractConformanceForGenericType ()
451
+ )->getCanonicalType ();
452
+ }
453
+
454
+ return ty;
455
455
}
456
456
457
457
ProtocolConformanceRef remapConformance (Type Ty, ProtocolConformanceRef C) {
Original file line number Diff line number Diff line change @@ -182,16 +182,17 @@ class TypeSubstCloner : public SILClonerWithScopes<ImplClass> {
182
182
}
183
183
184
184
CanType remapASTType (CanType ty) {
185
- auto substTy = ty.subst (SubsMap)->getCanonicalType ();
185
+ auto substTy = ty.subst (Functor, Functor)->getCanonicalType ();
186
+
187
+ auto context = getBuilder ().getTypeExpansionContext ();
188
+
186
189
if (!substTy->hasOpaqueArchetype () ||
187
- !getBuilder ().getTypeExpansionContext ()
188
- .shouldLookThroughOpaqueTypeArchetypes ())
190
+ !context.shouldLookThroughOpaqueTypeArchetypes ())
189
191
return substTy;
192
+
190
193
// Remap types containing opaque result types in the current context.
191
- return substOpaqueTypesWithUnderlyingTypes (
192
- substTy,
193
- TypeExpansionContext (getBuilder ().getFunction ()),
194
- /* allowLoweredTypes=*/ false );
194
+ return substOpaqueTypesWithUnderlyingTypes (substTy, context,
195
+ /* allowLoweredTypes=*/ false );
195
196
}
196
197
197
198
ProtocolConformanceRef remapConformance (Type ty,
Original file line number Diff line number Diff line change @@ -138,6 +138,9 @@ class InstructionVisitor : public SILCloner<InstructionVisitor> {
138
138
}
139
139
140
140
CanType remapASTType (CanType Ty) {
141
+ if (Ty->hasLocalArchetype ())
142
+ Ty = Ty.subst (Functor, Functor)->getCanonicalType ();
143
+
141
144
CMS.makeTypeUsableFromInline (Ty);
142
145
return Ty;
143
146
}
Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ class MapOpaqueArchetypes : public SILCloner<MapOpaqueArchetypes> {
52
52
}
53
53
54
54
CanType remapASTType (CanType ty) {
55
+ // Substitute local archetypes, if we have any.
56
+ if (ty->hasLocalArchetype ())
57
+ ty = ty.subst (Functor, Functor)->getCanonicalType ();
58
+
55
59
if (!ty->hasOpaqueArchetype () ||
56
60
!getBuilder ()
57
61
.getTypeExpansionContext ()
You can’t perform that action at this time.
0 commit comments