@@ -40,56 +40,7 @@ class MapOpaqueArchetypes : public SILCloner<MapOpaqueArchetypes> {
4040 clonedEntryBlock = fun.createBasicBlock ();
4141 }
4242
43- SILType remapType (SILType Ty) {
44- // Substitute local archetypes, if we have any.
45- if (Ty.hasLocalArchetype ()) {
46- Ty = Ty.subst (getBuilder ().getModule (), Functor, Functor,
47- CanGenericSignature ());
48- }
49-
50- if (!Ty.hasOpaqueArchetype () ||
51- !getBuilder ()
52- .getTypeExpansionContext ()
53- .shouldLookThroughOpaqueTypeArchetypes ())
54- return Ty;
55-
56- return getBuilder ().getTypeLowering (Ty).getLoweredType ().getCategoryType (
57- Ty.getCategory ());
58- }
59-
60- CanType remapASTType (CanType ty) {
61- // Substitute local archetypes, if we have any.
62- if (ty->hasLocalArchetype ())
63- ty = ty.subst (Functor, Functor)->getCanonicalType ();
64-
65- if (!ty->hasOpaqueArchetype () ||
66- !getBuilder ()
67- .getTypeExpansionContext ()
68- .shouldLookThroughOpaqueTypeArchetypes ())
69- return ty;
70-
71- return substOpaqueTypesWithUnderlyingTypes (
72- ty,
73- TypeExpansionContext (getBuilder ().getFunction ()),
74- /* allowLoweredTypes=*/ false );
75- }
76-
77- ProtocolConformanceRef remapConformance (Type ty,
78- ProtocolConformanceRef conf) {
79- // If we have local archetypes to substitute, do so now.
80- if (ty->hasLocalArchetype ()) {
81- conf = conf.subst (ty, Functor, Functor);
82- ty = ty.subst (Functor, Functor);
83- }
84-
85- auto context = getBuilder ().getTypeExpansionContext ();
86- if (ty->hasOpaqueArchetype () &&
87- context.shouldLookThroughOpaqueTypeArchetypes ()) {
88- conf =
89- substOpaqueTypesWithUnderlyingTypes (conf, ty, context);
90- }
91- return conf;
92- }
43+ bool shouldSubstOpaqueArchetypes () const { return true ; }
9344
9445 void replace ();
9546};
0 commit comments