@@ -132,51 +132,6 @@ static void recordConflict(Term key,
132
132
newRule.markConflicting ();
133
133
}
134
134
135
- // / This method takes a concrete type that was derived from a concrete type
136
- // / produced by RewriteSystemBuilder::getConcreteSubstitutionSchema(),
137
- // / either by extracting a structural sub-component or performing a (Swift AST)
138
- // / substitution using subst(). It returns a new concrete substitution schema
139
- // / and a new list of substitution terms.
140
- // /
141
- // / For example, suppose we start with the concrete type
142
- // /
143
- // / Dictionary<τ_0_0, Array<τ_0_1>> with substitutions {X.Y, Z}
144
- // /
145
- // / We can extract out the structural sub-component Array<τ_0_1>. If we wish
146
- // / to build a new concrete substitution schema, we call this method with
147
- // / Array<τ_0_1> and the original substitutions {X.Y, Z}. This will produce
148
- // / the new schema Array<τ_0_0> with substitutions {Z}.
149
- // /
150
- // / As another example, consider we start with the schema Bar<τ_0_0> with
151
- // / original substitutions {X.Y}, and perform a Swift AST subst() to get
152
- // / Foo<τ_0_0.A.B>. We can then call this method with Foo<τ_0_0.A.B> and
153
- // / the original substitutions {X.Y} to produce the new schema Foo<τ_0_0>
154
- // / with substitutions {X.Y.A.B}.
155
- static CanType
156
- remapConcreteSubstitutionSchema (CanType concreteType,
157
- ArrayRef<Term> substitutions,
158
- RewriteContext &ctx,
159
- SmallVectorImpl<Term> &result) {
160
- assert (!concreteType->isTypeParameter () && " Must have a concrete type here" );
161
-
162
- if (!concreteType->hasTypeParameter ())
163
- return concreteType;
164
-
165
- return CanType (concreteType.transformRec ([&](Type t) -> Optional<Type> {
166
- if (!t->isTypeParameter ())
167
- return None;
168
-
169
- auto term = ctx.getRelativeTermForType (CanType (t), substitutions);
170
-
171
- unsigned newIndex = result.size ();
172
- result.push_back (Term::get (term, ctx));
173
-
174
- return CanGenericTypeParamType::get (/* type sequence=*/ false ,
175
- /* depth=*/ 0 , newIndex,
176
- ctx.getASTContext ());
177
- }));
178
- }
179
-
180
135
namespace {
181
136
// / Utility class used by unifyConcreteTypes() and unifySuperclasses()
182
137
// / to walk two concrete types in parallel. Any time there is a mismatch,
@@ -228,9 +183,8 @@ namespace {
228
183
lhsSubstitutions);
229
184
230
185
SmallVector<Term, 3 > result;
231
- auto concreteType = remapConcreteSubstitutionSchema (CanType (secondType),
232
- rhsSubstitutions,
233
- ctx, result);
186
+ auto concreteType = ctx.remapConcreteSubstitutionSchema (
187
+ CanType (secondType), rhsSubstitutions, result);
234
188
235
189
MutableTerm constraintTerm (subjectTerm);
236
190
constraintTerm.add (Symbol::forConcreteType (concreteType, result, ctx));
@@ -250,9 +204,8 @@ namespace {
250
204
rhsSubstitutions);
251
205
252
206
SmallVector<Term, 3 > result;
253
- auto concreteType = remapConcreteSubstitutionSchema (CanType (firstType),
254
- lhsSubstitutions,
255
- ctx, result);
207
+ auto concreteType = ctx.remapConcreteSubstitutionSchema (
208
+ CanType (firstType), lhsSubstitutions, result);
256
209
257
210
MutableTerm constraintTerm (subjectTerm);
258
211
constraintTerm.add (Symbol::forConcreteType (concreteType, result, ctx));
@@ -889,8 +842,8 @@ MutableTerm PropertyMap::computeConstraintTermForTypeWitness(
889
842
// Compute the concrete type symbol [concrete: C.X].
890
843
SmallVector<Term, 3 > result;
891
844
auto typeWitnessSchema =
892
- remapConcreteSubstitutionSchema (typeWitness, substitutions,
893
- Context, result);
845
+ Context. remapConcreteSubstitutionSchema (typeWitness, substitutions,
846
+ result);
894
847
auto typeWitnessSymbol =
895
848
Symbol::forConcreteType (typeWitnessSchema, result, Context);
896
849
0 commit comments