Revert union test

This commit is contained in:
JohnnyMorganz 2023-07-05 12:26:19 +01:00
parent 2fe4bf91cf
commit c3d5b0c579

View file

@ -216,9 +216,7 @@ TEST_CASE_FIXTURE(Fixture, "used_dot_instead_of_colon")
local a = T.method() local a = T.method()
)"); )");
auto it = std::find_if(result.errors.begin(), result.errors.end(), auto it = std::find_if(result.errors.begin(), result.errors.end(), [](const TypeError& e) {
[](const TypeError& e)
{
return nullptr != get<FunctionRequiresSelf>(e); return nullptr != get<FunctionRequiresSelf>(e);
}); });
REQUIRE(it != result.errors.end()); REQUIRE(it != result.errors.end());
@ -263,9 +261,7 @@ TEST_CASE_FIXTURE(Fixture, "used_colon_instead_of_dot")
local a = T:method() local a = T:method()
)"); )");
auto it = std::find_if(result.errors.begin(), result.errors.end(), auto it = std::find_if(result.errors.begin(), result.errors.end(), [](const TypeError& e) {
[](const TypeError& e)
{
return nullptr != get<FunctionDoesNotTakeSelf>(e); return nullptr != get<FunctionDoesNotTakeSelf>(e);
}); });
REQUIRE(it != result.errors.end()); REQUIRE(it != result.errors.end());
@ -3646,51 +3642,34 @@ end
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
} }
TEST_CASE_FIXTURE(BuiltinsFixture, "write_common_property_to_table_unions") TEST_CASE_FIXTURE(BuiltinsFixture, "index_property_table_intersection_1")
{ {
CheckResult result = check(R"( CheckResult result = check(R"(
type Foo = { type Foo = {
Enabled: boolean, Bar: string,
Size: number, } & { Baz: number }
}
type Bar = { local x: Foo = { Bar = "1", Baz = 2 }
Enabled: boolean, local y = x.Bar
Width: number,
Height: number,
}
local x: Foo | Bar = { Enabled = true, Size = 5 }
x.Enabled = false
)"); )");
LUAU_REQUIRE_NO_ERRORS(result); LUAU_REQUIRE_NO_ERRORS(result);
} }
TEST_CASE_FIXTURE(BuiltinsFixture, "write_common_property_to_table_unions_2") TEST_CASE_FIXTURE(BuiltinsFixture, "index_property_table_intersection_2")
{ {
CheckResult result = check(R"( CheckResult result = check(R"(
type Foo = { type Foo = {
Enabled: boolean, Bar: string,
Size: number, } & { Baz: number }
}
type Bar = { local x: Foo = { Bar = "1", Baz = 2 }
Enabled: boolean, local y = x["Bar"]
Width: number,
Height: number,
}
local x: Foo | Bar = { Enabled = true, Size = 5 }
x.Size = 6
)"); )");
LUAU_REQUIRE_ERROR_COUNT(1, result); LUAU_REQUIRE_NO_ERRORS(result);
CHECK_EQ("error", toString(result.errors[0])); // TODO
} }
TEST_SUITE_END(); TEST_SUITE_END();