Skip to content

Commit b4ba68a

Browse files
committed
[AST] containsPackExpansion should not be used when type variables are involved
The constraint solver has its own version of this method which know how to deal with pack expansion type variables.
1 parent 0738780 commit b4ba68a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/AST/ParameterPack.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,11 @@ unsigned TupleType::getNumScalarElements() const {
117117
}
118118

119119
bool TupleType::containsPackExpansionType() const {
120+
assert(!hasTypeVariable());
120121
for (auto elt : getElements()) {
121-
if (elt.getType()->is<PackExpansionType>())
122+
auto eltTy = elt.getType();
123+
assert(!eltTy->hasTypeVariable());
124+
if (eltTy->is<PackExpansionType>())
122125
return true;
123126
}
124127

@@ -144,7 +147,9 @@ bool TupleType::isSingleUnlabeledPackExpansion() const {
144147

145148
bool AnyFunctionType::containsPackExpansionType(ArrayRef<Param> params) {
146149
for (auto param : params) {
147-
if (param.getPlainType()->is<PackExpansionType>())
150+
auto paramTy = param.getPlainType();
151+
assert(!paramTy->hasTypeVariable());
152+
if (paramTy->is<PackExpansionType>())
148153
return true;
149154
}
150155

0 commit comments

Comments
 (0)