mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
61766a692c
* Adds a currently unused x86-64 assembler as a prerequisite for possible future JIT compilation * Fix a bug in table iteration (closes Possible table iteration bug #504) * Improved warning method when function is used as a type * Fix a bug with unsandboxed iteration with pairs() * Type of coroutine.status() is now a union of value types * Bytecode output for tests/debugging now has labels * Improvements to loop unrolling cost estimation * Report errors when the key obviously doesn't exist in the table
47 lines
1.0 KiB
C++
47 lines
1.0 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
|
|
#include "Fixture.h"
|
|
|
|
#include "Luau/RecursionCounter.h"
|
|
|
|
#include "doctest.h"
|
|
|
|
using namespace Luau;
|
|
|
|
LUAU_FASTINT(LuauVisitRecursionLimit)
|
|
|
|
struct VisitTypeVarFixture : Fixture
|
|
{
|
|
ScopedFastFlag flag2 = {"LuauRecursionLimitException", true};
|
|
};
|
|
|
|
TEST_SUITE_BEGIN("VisitTypeVar");
|
|
|
|
TEST_CASE_FIXTURE(VisitTypeVarFixture, "throw_when_limit_is_exceeded")
|
|
{
|
|
ScopedFastInt sfi{"LuauVisitRecursionLimit", 3};
|
|
|
|
CheckResult result = check(R"(
|
|
local t : {a: {b: {c: {d: {e: boolean}}}}}
|
|
)");
|
|
|
|
TypeId tType = requireType("t");
|
|
|
|
CHECK_THROWS_AS(toString(tType), RecursionLimitException);
|
|
}
|
|
|
|
TEST_CASE_FIXTURE(VisitTypeVarFixture, "dont_throw_when_limit_is_high_enough")
|
|
{
|
|
ScopedFastInt sfi{"LuauVisitRecursionLimit", 8};
|
|
|
|
CheckResult result = check(R"(
|
|
local t : {a: {b: {c: {d: {e: boolean}}}}}
|
|
)");
|
|
|
|
TypeId tType = requireType("t");
|
|
|
|
(void)toString(tType);
|
|
}
|
|
|
|
TEST_SUITE_END();
|