mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-10 22:00:54 +01:00
Add index_wait_for_pending_no_crash
This commit is contained in:
parent
e831ad2ffc
commit
1c6c5ade75
1 changed files with 26 additions and 0 deletions
|
@ -927,6 +927,32 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works")
|
||||||
CHECK_EQ("string", toString(tpm->givenTp));
|
CHECK_EQ("string", toString(tpm->givenTp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE_FIXTURE(BuiltinsFixture, "index_wait_for_pending_no_crash")
|
||||||
|
{
|
||||||
|
if (!FFlag::LuauSolverV2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CheckResult result = check(R"(
|
||||||
|
local PlayerData = {
|
||||||
|
Coins = 0,
|
||||||
|
Level = 1,
|
||||||
|
Exp = 0,
|
||||||
|
MaxExp = 100
|
||||||
|
}
|
||||||
|
|
||||||
|
type Keys = index<typeof(PlayerData), keyof<typeof(PlayerData)>>
|
||||||
|
|
||||||
|
-- This function makes it think that there's going to be a pending expansion
|
||||||
|
local function UpdateData(key: Keys, value)
|
||||||
|
PlayerData[key] = value
|
||||||
|
end
|
||||||
|
|
||||||
|
UpdateData("Coins", 2)
|
||||||
|
)");
|
||||||
|
|
||||||
|
// Should not crash!
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_array")
|
TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_array")
|
||||||
{
|
{
|
||||||
if (!FFlag::LuauSolverV2)
|
if (!FFlag::LuauSolverV2)
|
||||||
|
|
Loading…
Add table
Reference in a new issue