mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-05 11:20:54 +01:00
* Type mismatch errors now mention if unification failed in covariant or invariant context, to explain why sometimes derived class can't be converted to base class or why `T` can't be converted into `T?` and so on * Class type indexing is no longer an error in non-strict mode (still an error in strict mode) * Fixed cyclic type packs not being displayed in the type * Added an error when unrelated types are compared with `==`/`~=` * Fixed false positive errors involving sub-type tests an `never` type * Fixed miscompilation of multiple assignment statements (Fixes https://github.com/Roblox/luau/issues/754) * Type inference stability improvements
41 lines
915 B
C++
41 lines
915 B
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("VisitTypeVar");
|
|
|
|
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_SUITE_END();
|