mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Add test case for math op on unrelated types
This commit is contained in:
parent
639b16543e
commit
0203330c24
1 changed files with 20 additions and 0 deletions
|
@ -466,6 +466,26 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "overloaded_op_accept_structured_subtype")
|
|||
LUAU_REQUIRE_ERROR_COUNT(0, result);
|
||||
}
|
||||
|
||||
TEST_CASE_FIXTURE(BuiltinsFixture, "overloaded_op_decline_unrelated_type")
|
||||
{
|
||||
ScopedFastFlag sff{"LuauIntersectedBinopOverloadFix", true};
|
||||
CheckResult result = check(R"(
|
||||
--!strict
|
||||
type BaseType = typeof(setmetatable(
|
||||
{},
|
||||
({} :: any) :: {__mul: (BaseType, BaseType) -> BaseType})
|
||||
)
|
||||
type Unrelated = {extraField: string}
|
||||
|
||||
local function add(x: BaseType, y: Unrelated)
|
||||
return x * y
|
||||
end
|
||||
)");
|
||||
|
||||
LUAU_REQUIRE_ERROR_COUNT(1, result);
|
||||
CHECK(toString(result.errors[0]) == "Type 'Unrelated' could not be converted into 'BaseType'");
|
||||
}
|
||||
|
||||
TEST_CASE_FIXTURE(Fixture, "CallOrOfFunctions")
|
||||
{
|
||||
CheckResult result = check(R"(
|
||||
|
|
Loading…
Add table
Reference in a new issue