2020//
2121// T.[p] => T
2222//
23- // Where [p] is a "property atom ": [layout: L], [superclass: Foo],
23+ // Where [p] is a "property symbol ": [layout: L], [superclass: Foo],
2424// [concrete: Bar].
2525//
2626// Given an arbitrary type T and a property [p], we can check if T satisfies the
@@ -200,7 +200,7 @@ Type EquivalenceClass::getConcreteType(
200200// / If the nth entry in the array is S, this will produce S.X.Y.Z.
201201// /
202202// / 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
204204// / \p typeWitness is [Q:Foo], the result will be [P:Foo], not [P].[Q:Foo] or
205205// / [Q:Foo].
206206static MutableTerm getRelativeTermForType (CanType typeWitness,
@@ -212,43 +212,43 @@ static MutableTerm getRelativeTermForType(CanType typeWitness,
212212 unsigned index = getGenericParamIndex (typeWitness->getRootGenericParam ());
213213 result = MutableTerm (substitutions[index]);
214214
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
216216 // [P], save P for later.
217217 const ProtocolDecl *proto = nullptr ;
218218 if (result.size () == 1 &&
219- result[0 ].getKind () == Atom ::Kind::Protocol) {
219+ result[0 ].getKind () == Symbol ::Kind::Protocol) {
220220 proto = result[0 ].getProtocol ();
221221 }
222222
223223 // Collect zero or more member type names in reverse order.
224- SmallVector<Atom , 3 > atoms ;
224+ SmallVector<Symbol , 3 > symbols ;
225225 while (auto memberType = dyn_cast<DependentMemberType>(typeWitness)) {
226226 typeWitness = memberType.getBase ();
227227
228228 auto *assocType = memberType->getAssocType ();
229229 assert (assocType != nullptr &&
230230 " Conformance checking should not produce unresolved member types" );
231231
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],
233233 // produce [P:Foo] instead of [P].[Q:Foo] or [Q:Foo].
234234 const auto *thisProto = assocType->getProtocol ();
235235 if (proto && isa<GenericTypeParamType>(typeWitness)) {
236236 thisProto = proto;
237237
238238 assert (result.size () == 1 );
239- assert (result[0 ].getKind () == Atom ::Kind::Protocol);
239+ assert (result[0 ].getKind () == Symbol ::Kind::Protocol);
240240 assert (result[0 ].getProtocol () == proto);
241241 result = MutableTerm ();
242242 }
243243
244- atoms .push_back (Atom ::forAssociatedType (thisProto,
245- assocType->getName (), ctx));
244+ symbols .push_back (Symbol ::forAssociatedType (thisProto,
245+ assocType->getName (), ctx));
246246 }
247247
248248 // 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 );
252252
253253 return result;
254254}
@@ -311,7 +311,7 @@ remapConcreteSubstitutionSchema(CanType concreteType,
311311// / T.[concrete: Foo<τ_0_0, τ_0_1, String> with {X.Y, Z}]
312312// / T.[concrete: Foo<Int, τ_0_0, τ_0_1> with {A.B, W}]
313313// /
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',
315315// / and we will eventually end up in this method, where we will generate three
316316// / induced rules:
317317// /
@@ -324,7 +324,7 @@ remapConcreteSubstitutionSchema(CanType concreteType,
324324// /
325325// / Returns true if a conflict was detected.
326326static bool unifyConcreteTypes (
327- Atom lhs, Atom rhs, RewriteContext &ctx,
327+ Symbol lhs, Symbol rhs, RewriteContext &ctx,
328328 SmallVectorImpl<std::pair<MutableTerm, MutableTerm>> &inducedRules,
329329 bool debug) {
330330 auto lhsType = lhs.getConcreteType ();
@@ -385,7 +385,7 @@ static bool unifyConcreteTypes(
385385 ctx, result);
386386
387387 MutableTerm constraintTerm (subjectTerm);
388- constraintTerm.add (Atom ::forConcreteType (concreteType, result, ctx));
388+ constraintTerm.add (Symbol ::forConcreteType (concreteType, result, ctx));
389389
390390 if (debug) {
391391 llvm::dbgs () << " %% Induced rule " << subjectTerm
@@ -408,7 +408,7 @@ static bool unifyConcreteTypes(
408408 ctx, result);
409409
410410 MutableTerm constraintTerm (subjectTerm);
411- constraintTerm.add (Atom ::forConcreteType (concreteType, result, ctx));
411+ constraintTerm.add (Symbol ::forConcreteType (concreteType, result, ctx));
412412
413413 if (debug) {
414414 llvm::dbgs () << " %% Induced rule " << subjectTerm
@@ -439,24 +439,24 @@ static bool unifyConcreteTypes(
439439}
440440
441441void EquivalenceClass::addProperty (
442- Atom property, RewriteContext &ctx,
442+ Symbol property, RewriteContext &ctx,
443443 SmallVectorImpl<std::pair<MutableTerm, MutableTerm>> &inducedRules,
444444 bool debug) {
445445
446446 switch (property.getKind ()) {
447- case Atom ::Kind::Protocol:
447+ case Symbol ::Kind::Protocol:
448448 ConformsTo.push_back (property.getProtocol ());
449449 return ;
450450
451- case Atom ::Kind::Layout:
451+ case Symbol ::Kind::Layout:
452452 if (!Layout)
453453 Layout = property.getLayoutConstraint ();
454454 else
455455 Layout = Layout.merge (property.getLayoutConstraint ());
456456
457457 return ;
458458
459- case Atom ::Kind::Superclass: {
459+ case Symbol ::Kind::Superclass: {
460460 auto superclass = property.getSuperclass ();
461461
462462 // A superclass requirement implies a layout requirement.
@@ -466,15 +466,15 @@ void EquivalenceClass::addProperty(
466466 ? LayoutConstraintKind::Class
467467 : LayoutConstraintKind::NativeClass,
468468 ctx.getASTContext ());
469- addProperty (Atom ::forLayout (layout, ctx), ctx, inducedRules, debug);
469+ addProperty (Symbol ::forLayout (layout, ctx), ctx, inducedRules, debug);
470470
471471 // FIXME: This needs to find the most derived subclass and also call
472472 // unifyConcreteTypes()
473473 Superclass = property;
474474 return ;
475475 }
476476
477- case Atom ::Kind::ConcreteType: {
477+ case Symbol ::Kind::ConcreteType: {
478478 if (ConcreteType) {
479479 (void ) unifyConcreteTypes (*ConcreteType, property,
480480 ctx, inducedRules, debug);
@@ -485,13 +485,13 @@ void EquivalenceClass::addProperty(
485485 return ;
486486 }
487487
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:
491491 break ;
492492 }
493493
494- llvm_unreachable (" Bad atom kind" );
494+ llvm_unreachable (" Bad symbol kind" );
495495}
496496
497497void EquivalenceClass::copyPropertiesFrom (const EquivalenceClass *next,
@@ -620,7 +620,7 @@ void EquivalenceClassMap::clear() {
620620// / Record a protocol conformance, layout or superclass constraint on the given
621621// / key. Must be called in monotonically non-decreasing key order.
622622void EquivalenceClassMap::addProperty (
623- const MutableTerm &key, Atom property,
623+ const MutableTerm &key, Symbol property,
624624 SmallVectorImpl<std::pair<MutableTerm, MutableTerm>> &inducedRules) {
625625 assert (property.isProperty ());
626626 auto *equivClass = getOrCreateEquivalenceClass (key);
@@ -803,8 +803,8 @@ void EquivalenceClassMap::concretizeNestedTypesFromConcreteParent(
803803 }
804804
805805 MutableTerm subjectType = key;
806- subjectType.add (Atom ::forAssociatedType (proto, assocType->getName (),
807- Context));
806+ subjectType.add (Symbol ::forAssociatedType (proto, assocType->getName (),
807+ Context));
808808
809809 MutableTerm constraintType;
810810
@@ -896,7 +896,7 @@ MutableTerm EquivalenceClassMap::computeConstraintTermForTypeWitness(
896896
897897 // Add a rule T.[P:A].[concrete: Foo.A] => T.[P:A].
898898 constraintType.add (
899- Atom ::forConcreteType (
899+ Symbol ::forConcreteType (
900900 typeWitnessSchema, result, Context));
901901
902902 return constraintType;
@@ -913,7 +913,7 @@ void EquivalenceClassMap::dump(llvm::raw_ostream &out) const {
913913}
914914
915915// / 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 .
917917// /
918918// / Returns a pair consisting of a status and number of iterations executed.
919919// /
@@ -930,7 +930,7 @@ RewriteSystem::buildEquivalenceClassMap(EquivalenceClassMap &map,
930930 unsigned maxDepth) {
931931 map.clear ();
932932
933- std::vector<std::pair<MutableTerm, Atom >> properties;
933+ std::vector<std::pair<MutableTerm, Symbol >> properties;
934934
935935 for (const auto &rule : Rules) {
936936 if (rule.isDeleted ())
@@ -959,8 +959,8 @@ RewriteSystem::buildEquivalenceClassMap(EquivalenceClassMap &map,
959959 // before longer rules, so that it can perform lookups on suffixes and call
960960 // EquivalenceClass::copyPropertiesFrom().
961961 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 {
964964 return lhs.first .compare (rhs.first , Protos) < 0 ;
965965 });
966966
0 commit comments