Merge pull request #66080 from xedin/rdar-109586440

[ConstraintSystem] Some more variadic generic fixes
This commit is contained in:
Pavel Yaskevich
2023-05-24 14:49:09 -07:00
committed by GitHub
8 changed files with 74 additions and 8 deletions

View File

@@ -6284,11 +6284,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 &param) {
return param.getPlainType()->hasParameterPack();
})) {
assert(fn->getNumParams() == fnType->getNumParams() &&
"Parameter mismatch?");
}
}
#endif
} else {
fnInterfaceType = resolveInterfaceType(rawFnType);
}