@@ -32,6 +32,7 @@ class LocalArchetypeTransform : public SILCloner<LocalArchetypeTransform> {
32
32
33
33
GenericSignatureWithCapturedEnvironments sig;
34
34
GenericEnvironment *env;
35
+ SubstitutionMap subs;
35
36
36
37
public:
37
38
LocalArchetypeTransform (SILFunction *F,
@@ -43,7 +44,7 @@ class LocalArchetypeTransform : public SILCloner<LocalArchetypeTransform> {
43
44
// The primary archetypes of the old generic environment map to
44
45
// primary archetypes of the new generic environment at the same
45
46
// index and depth.
46
- Functor. SubsMap = env->getForwardingSubstitutionMap ();
47
+ subs = env->getForwardingSubstitutionMap ();
47
48
48
49
// Local archetypes map to generic parameters at higher depths.
49
50
MapLocalArchetypesOutOfContext mapOutOfContext (sig.baseGenericSig ,
@@ -74,6 +75,22 @@ class LocalArchetypeTransform : public SILCloner<LocalArchetypeTransform> {
74
75
}
75
76
}
76
77
78
+ SILType remapType (SILType Ty) {
79
+ return Ty.subst (Builder.getModule ().Types , subs);
80
+ }
81
+
82
+ CanType remapASTType (CanType ty) {
83
+ return ty.subst (subs)->getCanonicalType ();
84
+ }
85
+
86
+ ProtocolConformanceRef remapConformance (Type Ty, ProtocolConformanceRef C) {
87
+ return C.subst (Ty, subs);
88
+ }
89
+
90
+ SubstitutionMap remapSubstitutionMap (SubstitutionMap subMap) {
91
+ return subMap.subst (subs);
92
+ }
93
+
77
94
void doIt () {
78
95
auto &F = getBuilder ().getFunction ();
79
96
@@ -146,4 +163,4 @@ void SILGenModule::recontextualizeCapturedLocalArchetypes(
146
163
147
164
LocalArchetypeTransform (F, sig).doIt ();
148
165
M.reclaimUnresolvedLocalArchetypeDefinitions ();
149
- }
166
+ }
0 commit comments