mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-12 21:10:37 +00:00
a6b5051edc
* https://github.com/Roblox/luau/pull/719 * Improved `Failed to unify type packs` error message to be reported as `Type pack 'X' could not be converted into 'Y'` * https://github.com/Roblox/luau/pull/722 * 1% reduction in executed instruction count by removing a check in fast call dispatch * Additional fixes to reported error location of OOM errors in VM * Improve `math.sqrt`, `math.floor` and `math.ceil` performance on additional compilers and platforms (1-2% geomean improvement including 8-9% on math-cordic) * All thrown exceptions by Luau analysis are derived from `Luau::InternalCompilerError` * When a call site has fewer arguments than required, error now reports the location of the function name instead of the argument to the function * https://github.com/Roblox/luau/pull/724 * Fixed https://github.com/Roblox/luau/issues/725 Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com> Co-authored-by: Andy Friesen <afriesen@roblox.com>
52 lines
1 KiB
C++
52 lines
1 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 "doctest.h"
|
|
#include "Luau/Common.h"
|
|
#include "ScopedFlags.h"
|
|
|
|
using namespace Luau;
|
|
|
|
namespace
|
|
{
|
|
struct NegationFixture : Fixture
|
|
{
|
|
TypeArena arena;
|
|
ScopedFastFlag sff[2] {
|
|
{"LuauNegatedStringSingletons", true},
|
|
{"LuauSubtypeNormalizer", true},
|
|
};
|
|
|
|
NegationFixture()
|
|
{
|
|
registerNotType(*this, arena);
|
|
}
|
|
};
|
|
}
|
|
|
|
TEST_SUITE_BEGIN("Negations");
|
|
|
|
TEST_CASE_FIXTURE(NegationFixture, "negated_string_is_a_subtype_of_string")
|
|
{
|
|
CheckResult result = check(R"(
|
|
function foo(arg: string) end
|
|
local a: string & Not<"Hello">
|
|
foo(a)
|
|
)");
|
|
|
|
LUAU_REQUIRE_NO_ERRORS(result);
|
|
}
|
|
|
|
TEST_CASE_FIXTURE(NegationFixture, "string_is_not_a_subtype_of_negated_string")
|
|
{
|
|
CheckResult result = check(R"(
|
|
function foo(arg: string & Not<"hello">) end
|
|
local a: string
|
|
foo(a)
|
|
)");
|
|
|
|
LUAU_REQUIRE_ERROR_COUNT(1, result);
|
|
}
|
|
|
|
TEST_SUITE_END();
|