mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
16fbfe912c
- Cleaned up `FFlag::FixFindBindingAtFunctionName`, `FFlag::LuauNormalizeBlockedTypes`, `FFlag::LuauPCallDebuggerFix` - Added support for break and continue into control flow analysis - The old type unification engine will now report a more fine-grained error at times, indicating that type normalization in particular failed # New Type Solver - Refactor of Unifier2, the new unification implementation for Luau - Completed MVP of new unification implementation - Dramatically simplified overload selection logic - Type family reduction can now apply sooner to free types that have been solved - Subtyping now supports table indexers - Generalization now replaces bad generics with unknown # Native Code Generation - Reduce stack spills caused by FINDUPVAL and STORE_TAG - Improve Generate SHL/SHR/SAR/rotates with immediate operands in X64 - Removed redundant case re-check in table lookup fallback --------- Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com> Co-authored-by: Andy Friesen <afriesen@roblox.com> Co-authored-by: Lily Brown <lbrown@roblox.com>
59 lines
1.3 KiB
C++
59 lines
1.3 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);
|
|
|
|
TEST_SUITE_BEGIN("VisitType");
|
|
|
|
TEST_CASE_FIXTURE(Fixture, "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(Fixture, "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_CASE_FIXTURE(Fixture, "some_free_types_do_not_have_bounds")
|
|
{
|
|
Type t{FreeType{TypeLevel{}}};
|
|
|
|
(void)toString(&t);
|
|
}
|
|
|
|
TEST_CASE_FIXTURE(Fixture, "some_free_types_have_bounds")
|
|
{
|
|
ScopedFastFlag sff{"DebugLuauDeferredConstraintResolution", true};
|
|
|
|
Scope scope{builtinTypes->anyTypePack};
|
|
Type t{FreeType{&scope, builtinTypes->neverType, builtinTypes->numberType}};
|
|
|
|
CHECK("('a <: number)" == toString(&t));
|
|
}
|
|
|
|
TEST_SUITE_END();
|