20
20
//
21
21
// T.[p] => T
22
22
//
23
- // Where [p] is a "property atom ": [layout: L], [superclass: Foo],
23
+ // Where [p] is a "property symbol ": [layout: L], [superclass: Foo],
24
24
// [concrete: Bar].
25
25
//
26
26
// Given an arbitrary type T and a property [p], we can check if T satisfies the
@@ -200,7 +200,7 @@ Type EquivalenceClass::getConcreteType(
200
200
// / If the nth entry in the array is S, this will produce S.X.Y.Z.
201
201
// /
202
202
// / There is a special behavior if the substitution is a term consisting of a
203
- // / single protocol atom [P]. If the innermost associated type in
203
+ // / single protocol symbol [P]. If the innermost associated type in
204
204
// / \p typeWitness is [Q:Foo], the result will be [P:Foo], not [P].[Q:Foo] or
205
205
// / [Q:Foo].
206
206
static MutableTerm getRelativeTermForType (CanType typeWitness,
@@ -212,43 +212,43 @@ static MutableTerm getRelativeTermForType(CanType typeWitness,
212
212
unsigned index = getGenericParamIndex (typeWitness->getRootGenericParam ());
213
213
result = MutableTerm (substitutions[index]);
214
214
215
- // If the substitution is a term consisting of a single protocol atom
215
+ // If the substitution is a term consisting of a single protocol symbol
216
216
// [P], save P for later.
217
217
const ProtocolDecl *proto = nullptr ;
218
218
if (result.size () == 1 &&
219
- result[0 ].getKind () == Atom ::Kind::Protocol) {
219
+ result[0 ].getKind () == Symbol ::Kind::Protocol) {
220
220
proto = result[0 ].getProtocol ();
221
221
}
222
222
223
223
// Collect zero or more member type names in reverse order.
224
- SmallVector<Atom , 3 > atoms ;
224
+ SmallVector<Symbol , 3 > symbols ;
225
225
while (auto memberType = dyn_cast<DependentMemberType>(typeWitness)) {
226
226
typeWitness = memberType.getBase ();
227
227
228
228
auto *assocType = memberType->getAssocType ();
229
229
assert (assocType != nullptr &&
230
230
" Conformance checking should not produce unresolved member types" );
231
231
232
- // If the substitution is a term consisting of a single protocol atom [P],
232
+ // If the substitution is a term consisting of a single protocol symbol [P],
233
233
// produce [P:Foo] instead of [P].[Q:Foo] or [Q:Foo].
234
234
const auto *thisProto = assocType->getProtocol ();
235
235
if (proto && isa<GenericTypeParamType>(typeWitness)) {
236
236
thisProto = proto;
237
237
238
238
assert (result.size () == 1 );
239
- assert (result[0 ].getKind () == Atom ::Kind::Protocol);
239
+ assert (result[0 ].getKind () == Symbol ::Kind::Protocol);
240
240
assert (result[0 ].getProtocol () == proto);
241
241
result = MutableTerm ();
242
242
}
243
243
244
- atoms .push_back (Atom ::forAssociatedType (thisProto,
245
- assocType->getName (), ctx));
244
+ symbols .push_back (Symbol ::forAssociatedType (thisProto,
245
+ assocType->getName (), ctx));
246
246
}
247
247
248
248
// Add the member type names.
249
- std::reverse (atoms .begin (), atoms .end ());
250
- for (auto atom : atoms )
251
- result.add (atom );
249
+ std::reverse (symbols .begin (), symbols .end ());
250
+ for (auto symbol : symbols )
251
+ result.add (symbol );
252
252
253
253
return result;
254
254
}
@@ -311,7 +311,7 @@ remapConcreteSubstitutionSchema(CanType concreteType,
311
311
// / T.[concrete: Foo<τ_0_0, τ_0_1, String> with {X.Y, Z}]
312
312
// / T.[concrete: Foo<Int, τ_0_0, τ_0_1> with {A.B, W}]
313
313
// /
314
- // / The two concrete type atoms will be added to the equivalence class of 'T',
314
+ // / The two concrete type symbols will be added to the equivalence class of 'T',
315
315
// / and we will eventually end up in this method, where we will generate three
316
316
// / induced rules:
317
317
// /
@@ -324,7 +324,7 @@ remapConcreteSubstitutionSchema(CanType concreteType,
324
324
// /
325
325
// / Returns true if a conflict was detected.
326
326
static bool unifyConcreteTypes (
327
- Atom lhs, Atom rhs, RewriteContext &ctx,
327
+ Symbol lhs, Symbol rhs, RewriteContext &ctx,
328
328
SmallVectorImpl<std::pair<MutableTerm, MutableTerm>> &inducedRules,
329
329
bool debug) {
330
330
auto lhsType = lhs.getConcreteType ();
@@ -385,7 +385,7 @@ static bool unifyConcreteTypes(
385
385
ctx, result);
386
386
387
387
MutableTerm constraintTerm (subjectTerm);
388
- constraintTerm.add (Atom ::forConcreteType (concreteType, result, ctx));
388
+ constraintTerm.add (Symbol ::forConcreteType (concreteType, result, ctx));
389
389
390
390
if (debug) {
391
391
llvm::dbgs () << " %% Induced rule " << subjectTerm
@@ -408,7 +408,7 @@ static bool unifyConcreteTypes(
408
408
ctx, result);
409
409
410
410
MutableTerm constraintTerm (subjectTerm);
411
- constraintTerm.add (Atom ::forConcreteType (concreteType, result, ctx));
411
+ constraintTerm.add (Symbol ::forConcreteType (concreteType, result, ctx));
412
412
413
413
if (debug) {
414
414
llvm::dbgs () << " %% Induced rule " << subjectTerm
@@ -439,24 +439,24 @@ static bool unifyConcreteTypes(
439
439
}
440
440
441
441
void EquivalenceClass::addProperty (
442
- Atom property, RewriteContext &ctx,
442
+ Symbol property, RewriteContext &ctx,
443
443
SmallVectorImpl<std::pair<MutableTerm, MutableTerm>> &inducedRules,
444
444
bool debug) {
445
445
446
446
switch (property.getKind ()) {
447
- case Atom ::Kind::Protocol:
447
+ case Symbol ::Kind::Protocol:
448
448
ConformsTo.push_back (property.getProtocol ());
449
449
return ;
450
450
451
- case Atom ::Kind::Layout:
451
+ case Symbol ::Kind::Layout:
452
452
if (!Layout)
453
453
Layout = property.getLayoutConstraint ();
454
454
else
455
455
Layout = Layout.merge (property.getLayoutConstraint ());
456
456
457
457
return ;
458
458
459
- case Atom ::Kind::Superclass: {
459
+ case Symbol ::Kind::Superclass: {
460
460
auto superclass = property.getSuperclass ();
461
461
462
462
// A superclass requirement implies a layout requirement.
@@ -466,15 +466,15 @@ void EquivalenceClass::addProperty(
466
466
? LayoutConstraintKind::Class
467
467
: LayoutConstraintKind::NativeClass,
468
468
ctx.getASTContext ());
469
- addProperty (Atom ::forLayout (layout, ctx), ctx, inducedRules, debug);
469
+ addProperty (Symbol ::forLayout (layout, ctx), ctx, inducedRules, debug);
470
470
471
471
// FIXME: This needs to find the most derived subclass and also call
472
472
// unifyConcreteTypes()
473
473
Superclass = property;
474
474
return ;
475
475
}
476
476
477
- case Atom ::Kind::ConcreteType: {
477
+ case Symbol ::Kind::ConcreteType: {
478
478
if (ConcreteType) {
479
479
(void ) unifyConcreteTypes (*ConcreteType, property,
480
480
ctx, inducedRules, debug);
@@ -485,13 +485,13 @@ void EquivalenceClass::addProperty(
485
485
return ;
486
486
}
487
487
488
- case Atom ::Kind::Name:
489
- case Atom ::Kind::GenericParam:
490
- case Atom ::Kind::AssociatedType:
488
+ case Symbol ::Kind::Name:
489
+ case Symbol ::Kind::GenericParam:
490
+ case Symbol ::Kind::AssociatedType:
491
491
break ;
492
492
}
493
493
494
- llvm_unreachable (" Bad atom kind" );
494
+ llvm_unreachable (" Bad symbol kind" );
495
495
}
496
496
497
497
void EquivalenceClass::copyPropertiesFrom (const EquivalenceClass *next,
@@ -620,7 +620,7 @@ void EquivalenceClassMap::clear() {
620
620
// / Record a protocol conformance, layout or superclass constraint on the given
621
621
// / key. Must be called in monotonically non-decreasing key order.
622
622
void EquivalenceClassMap::addProperty (
623
- const MutableTerm &key, Atom property,
623
+ const MutableTerm &key, Symbol property,
624
624
SmallVectorImpl<std::pair<MutableTerm, MutableTerm>> &inducedRules) {
625
625
assert (property.isProperty ());
626
626
auto *equivClass = getOrCreateEquivalenceClass (key);
@@ -803,8 +803,8 @@ void EquivalenceClassMap::concretizeNestedTypesFromConcreteParent(
803
803
}
804
804
805
805
MutableTerm subjectType = key;
806
- subjectType.add (Atom ::forAssociatedType (proto, assocType->getName (),
807
- Context));
806
+ subjectType.add (Symbol ::forAssociatedType (proto, assocType->getName (),
807
+ Context));
808
808
809
809
MutableTerm constraintType;
810
810
@@ -896,7 +896,7 @@ MutableTerm EquivalenceClassMap::computeConstraintTermForTypeWitness(
896
896
897
897
// Add a rule T.[P:A].[concrete: Foo.A] => T.[P:A].
898
898
constraintType.add (
899
- Atom ::forConcreteType (
899
+ Symbol ::forConcreteType (
900
900
typeWitnessSchema, result, Context));
901
901
902
902
return constraintType;
@@ -913,7 +913,7 @@ void EquivalenceClassMap::dump(llvm::raw_ostream &out) const {
913
913
}
914
914
915
915
// / Build the equivalence class map from all rules of the form T.[p] => T, where
916
- // / [p] is a property atom .
916
+ // / [p] is a property symbol .
917
917
// /
918
918
// / Returns a pair consisting of a status and number of iterations executed.
919
919
// /
@@ -930,7 +930,7 @@ RewriteSystem::buildEquivalenceClassMap(EquivalenceClassMap &map,
930
930
unsigned maxDepth) {
931
931
map.clear ();
932
932
933
- std::vector<std::pair<MutableTerm, Atom >> properties;
933
+ std::vector<std::pair<MutableTerm, Symbol >> properties;
934
934
935
935
for (const auto &rule : Rules) {
936
936
if (rule.isDeleted ())
@@ -959,8 +959,8 @@ RewriteSystem::buildEquivalenceClassMap(EquivalenceClassMap &map,
959
959
// before longer rules, so that it can perform lookups on suffixes and call
960
960
// EquivalenceClass::copyPropertiesFrom().
961
961
std::sort (properties.begin (), properties.end (),
962
- [&](const std::pair<MutableTerm, Atom > &lhs,
963
- const std::pair<MutableTerm, Atom > &rhs) -> bool {
962
+ [&](const std::pair<MutableTerm, Symbol > &lhs,
963
+ const std::pair<MutableTerm, Symbol > &rhs) -> bool {
964
964
return lhs.first .compare (rhs.first , Protos) < 0 ;
965
965
});
966
966
0 commit comments