@@ -198,15 +198,11 @@ LayoutConstraint Symbol::getLayoutConstraint() const {
198198 return Ptr->Layout ;
199199}
200200
201- // / Get the superclass type associated with a superclass symbol.
202- CanType Symbol::getSuperclass () const {
203- assert (getKind () == Kind::Superclass);
204- return Ptr->ConcreteType ;
205- }
206-
207- // / Get the concrete type associated with a concrete type symbol.
201+ // / Get the concrete type associated with a superclass, concrete type or
202+ // / concrete conformance symbol.
208203CanType Symbol::getConcreteType () const {
209- assert (getKind () == Kind::ConcreteType ||
204+ assert (getKind () == Kind::Superclass ||
205+ getKind () == Kind::ConcreteType ||
210206 getKind () == Kind::ConcreteConformance);
211207 return Ptr->ConcreteType ;
212208}
@@ -635,10 +631,7 @@ int Symbol::compare(Symbol other, RewriteContext &ctx) const {
635631
636632 case Kind::Superclass:
637633 case Kind::ConcreteType: {
638- if (kind == Kind::Superclass
639- ? (getSuperclass () == other.getSuperclass ())
640- : (getConcreteType () == other.getConcreteType ())) {
641-
634+ if (getConcreteType () == other.getConcreteType ()) {
642635 // If the concrete types are identical, compare substitution terms.
643636 assert (getSubstitutions ().size () == other.getSubstitutions ().size ());
644637 for (unsigned i : indices (getSubstitutions ())) {
@@ -676,7 +669,7 @@ Symbol Symbol::withConcreteSubstitutions(
676669 RewriteContext &ctx) const {
677670 switch (getKind ()) {
678671 case Kind::Superclass:
679- return Symbol::forSuperclass (getSuperclass (), substitutions, ctx);
672+ return Symbol::forSuperclass (getConcreteType (), substitutions, ctx);
680673
681674 case Kind::ConcreteType:
682675 return Symbol::forConcreteType (getConcreteType (), substitutions, ctx);
@@ -787,7 +780,7 @@ void Symbol::dump(llvm::raw_ostream &out) const {
787780 return ;
788781
789782 case Kind::Superclass:
790- out << " [superclass: " << getSuperclass ();
783+ out << " [superclass: " << getConcreteType ();
791784 dumpSubstitutions ();
792785 out << " ]" ;
793786 return ;
0 commit comments