mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Limit assert in getFunctionArgApplyInfo to types without type parameter packs
If function type of some declaration has a at least on type parameter pack it could mean that number of parameters in "applied" type could be different from that of "interface" type.
This commit is contained in:
@@ -6278,11 +6278,18 @@ Solution::getFunctionArgApplyInfo(ConstraintLocator *locator) const {
|
||||
*choice, [this](Type type) -> Type { return simplifyType(type); }))
|
||||
fnInterfaceType = fnInterfaceType->castTo<AnyFunctionType>()->getResult();
|
||||
|
||||
#ifndef NDEBUG
|
||||
// If variadic generics are not involved, interface type should
|
||||
// always match applied type.
|
||||
if (auto *fn = fnInterfaceType->getAs<AnyFunctionType>()) {
|
||||
assert(fn->getNumParams() == fnType->getNumParams() &&
|
||||
"Parameter mismatch?");
|
||||
(void)fn;
|
||||
if (llvm::none_of(fn->getParams(), [&](const auto ¶m) {
|
||||
return param.getPlainType()->hasParameterPack();
|
||||
})) {
|
||||
assert(fn->getNumParams() == fnType->getNumParams() &&
|
||||
"Parameter mismatch?");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
fnInterfaceType = resolveInterfaceType(rawFnType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user