mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-01 17:30:53 +01:00
Move overload_resolution_singleton_parameters
to TypeInfer.singletons.test.cpp
This commit is contained in:
parent
14e0fd8810
commit
66b00f6980
2 changed files with 18 additions and 18 deletions
|
@ -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");
|
||||
|
|
|
@ -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"(
|
||||
|
|
Loading…
Add table
Reference in a new issue