Skip to content

Commit b26e983

Browse files
committed
[Serialization] Get SubstitutionList directly from a NameAliasType.
1 parent 3753207 commit b26e983

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

include/swift/AST/Types.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,12 +1620,6 @@ class NameAliasType final
16201620
return getNumSubstitutions();
16211621
}
16221622

1623-
/// Retrieve the set of substitutions to be applied to the declaration to
1624-
/// produce the underlying type.
1625-
SubstitutionList getSubstitutionList() const {
1626-
return {getTrailingObjects<Substitution>(), getNumSubstitutions()};
1627-
}
1628-
16291623
/// Retrieve the generic signature used for substitutions.
16301624
GenericSignature *getGenericSignature() const {
16311625
return getNumSubstitutions() > 0
@@ -1651,6 +1645,12 @@ class NameAliasType final
16511645
: Type();
16521646
}
16531647

1648+
/// Retrieve the set of substitutions to be applied to the declaration to
1649+
/// produce the underlying type.
1650+
SubstitutionList getSubstitutionList() const {
1651+
return {getTrailingObjects<Substitution>(), getNumSubstitutions()};
1652+
}
1653+
16541654
/// Retrieve the substitution map applied to the declaration's underlying
16551655
/// to produce the described type.
16561656
SubstitutionMap getSubstitutionMap() const;

lib/Serialization/Serialization.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3631,10 +3631,7 @@ void Serializer::writeType(Type ty) {
36313631
addTypeRef(alias->getParent()),
36323632
addTypeRef(alias->getSinglyDesugaredType()));
36333633
// Write the set of substitutions.
3634-
SmallVector<Substitution, 4> flatSubs;
3635-
if (auto genericSig = typeAlias->getGenericSignature())
3636-
genericSig->getSubstitutions(alias->getSubstitutionMap(), flatSubs);
3637-
writeSubstitutions(flatSubs, DeclTypeAbbrCodes);
3634+
writeSubstitutions(alias->getSubstitutionList(), DeclTypeAbbrCodes);
36383635
break;
36393636
}
36403637

0 commit comments

Comments
 (0)