mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-01 17:30:53 +01:00
Fix singleton parameters in overloaded functions
This commit is contained in:
parent
66b00f6980
commit
5d4d7b4625
1 changed files with 12 additions and 2 deletions
|
@ -2031,13 +2031,23 @@ InferencePack ConstraintGenerator::checkPack(const ScopePtr& scope, AstExprCall*
|
|||
}
|
||||
else if (i < exprArgs.size() - 1 || !(arg->is<AstExprCall>() || arg->is<AstExprVarargs>()))
|
||||
{
|
||||
auto [ty, refinement] = check(scope, arg, /*expectedType*/ std::nullopt, /*forceSingleton*/ false, /*generalize*/ false);
|
||||
std::optional<TypeId> expectedType;
|
||||
if (i < expectedTypesForCall.size())
|
||||
{
|
||||
expectedType = expectedTypesForCall[i];
|
||||
}
|
||||
auto [ty, refinement] = check(scope, arg, expectedType, /*forceSingleton*/ false, /*generalize*/ false);
|
||||
args.push_back(ty);
|
||||
argumentRefinements.push_back(refinement);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto [tp, refis] = checkPack(scope, arg, {});
|
||||
std::vector<std::optional<Luau::TypeId>> expectedTypes = {};
|
||||
if (i < expectedTypesForCall.size())
|
||||
{
|
||||
expectedTypes.insert(expectedTypes.end(), expectedTypesForCall.begin() + i, expectedTypesForCall.end());
|
||||
}
|
||||
auto [tp, refis] = checkPack(scope, arg, expectedTypes);
|
||||
argTail = tp;
|
||||
argumentRefinements.insert(argumentRefinements.end(), refis.begin(), refis.end());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue