mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 22:35:43 +08:00
9c2146288d
# What's changed? * Support for new 'require by string' RFC with relative paths and aliases in now enabled in Luau REPL application ### New Type Solver * Fixed assertion failure on generic table keys (`[expr] = value`) * Fixed an issue with type substitution traversing into the substituted parts during type instantiation * Fixed crash in union simplification when that union contained uninhabited unions and other types inside * Union types in binary type families like `add<a | b, c>` are expanded into `add<a, c> | add<b, c>` to handle * Added handling for type family solving creating new type families * Fixed a bug with normalization operation caching types with unsolved parts * Tables with uninhabited properties are now simplified to `never` * Fixed failures found by fuzzer ### Native Code Generation * Added support for shared code generation between multiple Luau VM instances * Fixed issue in load-store propagation and new tagged LOAD_TVALUE instructions * Fixed issues with partial register dead store elimination causing failures in GC assists --- ### Internal Contributors Co-authored-by: Aaron Weiss <aaronweiss@roblox.com> Co-authored-by: Alexander McCord <amccord@roblox.com> Co-authored-by: Andy Friesen <afriesen@roblox.com> Co-authored-by: James McNellis <jmcnellis@roblox.com> Co-authored-by: Vighnesh Vijay <vvijay@roblox.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
38 lines
949 B
C++
38 lines
949 B
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#include "Luau/Error.h"
|
|
|
|
#include "Fixture.h"
|
|
#include "doctest.h"
|
|
|
|
using namespace Luau;
|
|
|
|
TEST_SUITE_BEGIN("ErrorTests");
|
|
|
|
TEST_CASE("TypeError_code_should_return_nonzero_code")
|
|
{
|
|
auto e = TypeError{{{0, 0}, {0, 1}}, UnknownSymbol{"Foo"}};
|
|
CHECK_GE(e.code(), 1000);
|
|
}
|
|
|
|
TEST_CASE_FIXTURE(BuiltinsFixture, "metatable_names_show_instead_of_tables")
|
|
{
|
|
frontend.options.retainFullTypeGraphs = false;
|
|
|
|
CheckResult result = check(R"(
|
|
--!strict
|
|
local Account = {}
|
|
Account.__index = Account
|
|
function Account.deposit(self: Account, x: number)
|
|
self.balance += x
|
|
end
|
|
type Account = typeof(setmetatable({} :: { balance: number }, Account))
|
|
local x: Account = 5
|
|
)");
|
|
|
|
LUAU_REQUIRE_ERROR_COUNT(1, result);
|
|
|
|
CHECK_EQ("Type 'number' could not be converted into 'Account'", toString(result.errors[0]));
|
|
}
|
|
|
|
TEST_SUITE_END();
|