Skip to content

Commit 3db9da2

Browse files
committed
[Serialization] Get SubstitutionList directly from a NameAliasType.
(cherry picked from commit b26e983)
1 parent fe5d221 commit 3db9da2

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
@@ -1617,12 +1617,6 @@ class NameAliasType final
16171617
return getNumSubstitutions();
16181618
}
16191619

1620-
/// Retrieve the set of substitutions to be applied to the declaration to
1621-
/// produce the underlying type.
1622-
SubstitutionList getSubstitutionList() const {
1623-
return {getTrailingObjects<Substitution>(), getNumSubstitutions()};
1624-
}
1625-
16261620
/// Retrieve the generic signature used for substitutions.
16271621
GenericSignature *getGenericSignature() const {
16281622
return getNumSubstitutions() > 0
@@ -1648,6 +1642,12 @@ class NameAliasType final
16481642
: Type();
16491643
}
16501644

1645+
/// Retrieve the set of substitutions to be applied to the declaration to
1646+
/// produce the underlying type.
1647+
SubstitutionList getSubstitutionList() const {
1648+
return {getTrailingObjects<Substitution>(), getNumSubstitutions()};
1649+
}
1650+
16511651
/// Retrieve the substitution map applied to the declaration's underlying
16521652
/// to produce the described type.
16531653
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)