Skip to content

Commit d9cf85d

Browse files
committed
AST: Relax an invariant in PackExpansionType::get()
The expression type checker replaces type variables with UnresolvedType and PlaceholderType sometimes, so allow them to appear here.
1 parent 9b23eae commit d9cf85d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/AST/ASTContext.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3173,8 +3173,14 @@ PackExpansionType::PackExpansionType(Type patternType, Type countType,
31733173
const ASTContext *canCtx)
31743174
: TypeBase(TypeKind::PackExpansion, canCtx, properties),
31753175
patternType(patternType), countType(countType) {
3176-
assert(countType->is<TypeVariableType>() ||
3176+
3177+
// TODO: it would be nice if the solver didn't stick PlaceholderTypes and
3178+
// UnresolvedTypes in here.
3179+
assert(countType->is<PackType>() ||
3180+
countType->is<TypeVariableType>() ||
31773181
countType->is<PackArchetypeType>() ||
3182+
countType->is<PlaceholderType>() ||
3183+
countType->is<UnresolvedType>() ||
31783184
countType->castTo<GenericTypeParamType>()->isParameterPack());
31793185
}
31803186

0 commit comments

Comments
 (0)