Move overload_resolution_singleton_parameters to TypeInfer.singletons.test.cpp

This commit is contained in:
Math 2025-02-27 10:24:50 -03:00
parent 14e0fd8810
commit 66b00f6980
2 changed files with 18 additions and 18 deletions

View file

@ -58,24 +58,6 @@ TEST_CASE_FIXTURE(Fixture, "overload_resolution")
CHECK(toString(t) == "(((number) -> string) & ((string) -> number)) -> (string, number)");
}
TEST_CASE_FIXTURE(Fixture, "overload_resolution_singleton_parameters")
{
CheckResult result = check(R"(
type A = ("A") -> string
type B = ("B") -> number
local function foo(f: A & B)
return f("A"), f("B")
end
)");
LUAU_REQUIRE_NO_ERRORS(result);
TypeId t = requireType("foo");
const FunctionType* fooType = get<FunctionType>(requireType("foo"));
REQUIRE(fooType != nullptr);
CHECK(toString(t) == "(((\"A\") -> string) & ((\"B\") -> number)) -> (string, number)");
}
TEST_CASE_FIXTURE(Fixture, "tc_function")
{
CheckResult result = check("function five() return 5 end");

View file

@ -151,6 +151,24 @@ TEST_CASE_FIXTURE(Fixture, "overloaded_function_call_with_singletons")
LUAU_REQUIRE_NO_ERRORS(result);
}
TEST_CASE_FIXTURE(Fixture, "overloaded_function_resolution_singleton_parameters")
{
CheckResult result = check(R"(
type A = ("A") -> string
type B = ("B") -> number
local function foo(f: A & B)
return f("A"), f("B")
end
)");
LUAU_REQUIRE_NO_ERRORS(result);
TypeId t = requireType("foo");
const FunctionType* fooType = get<FunctionType>(requireType("foo"));
REQUIRE(fooType != nullptr);
CHECK(toString(t) == "(((\"A\") -> string) & ((\"B\") -> number)) -> (string, number)");
}
TEST_CASE_FIXTURE(Fixture, "overloaded_function_call_with_singletons_mismatch")
{
CheckResult result = check(R"(