mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
24fdac4c05
## What's Changed - Improve POSIX compliance in `CLI/FileUtils.cpp` by @SamuraiCrow #1064 - `AstStat*::hasEnd` is deprecated; use `AstStatBlock::hasEnd` instead - Added a lint for common misuses of the `#` operator - Luau now issues deprecated diagnostics for some uses of `getfenv` and `setfenv` - Fixed a case where we included a trailing space in some error stringifications ### Compiler - Do not do further analysis in O2 on self functions - Improve detection of invalid repeat..until expressions vs continue ### New Type Solver - We now cache subtype test results to improve performance - Improved operator inference mechanics (aka type families) - Further work towards type states - Work towards [new non-strict mode](https://github.com/Roblox/luau/blob/master/rfcs/new-nonstrict.md) continues ### Native Codegen - Instruction last use locations should follow the order in which blocks are lowered - Add a bonus assertion to IrLoweringA64::tempAddr --- 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: Aaron Weiss <aaronweiss@roblox.com> Co-authored-by: Alexander McCord <amccord@roblox.com> Co-authored-by: Vighnesh Vijay <vvijay@roblox.com>
47 lines
1023 B
C++
47 lines
1023 B
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#include "Luau/NonStrictTypeChecker.h"
|
|
|
|
#include "Fixture.h"
|
|
|
|
#include "Luau/Common.h"
|
|
#include "Luau/Ast.h"
|
|
#include "Luau/ModuleResolver.h"
|
|
#include "ScopedFlags.h"
|
|
#include "doctest.h"
|
|
#include <iostream>
|
|
|
|
using namespace Luau;
|
|
|
|
struct NonStrictTypeCheckerFixture : Fixture
|
|
{
|
|
|
|
CheckResult checkNonStrict(const std::string& code)
|
|
{
|
|
ScopedFastFlag flags[] = {
|
|
{"LuauCheckedFunctionSyntax", true},
|
|
};
|
|
|
|
return check(Mode::Nonstrict, code);
|
|
}
|
|
|
|
std::string definitions = R"BUILTIN_SRC(
|
|
declare function @checked abs(n: number): number
|
|
abs("hi")
|
|
)BUILTIN_SRC";
|
|
};
|
|
|
|
|
|
TEST_SUITE_BEGIN("NonStrictTypeCheckerTest");
|
|
|
|
TEST_CASE_FIXTURE(NonStrictTypeCheckerFixture, "simple_non_strict")
|
|
{
|
|
auto res = checkNonStrict(R"BUILTIN_SRC(
|
|
declare function @checked abs(n: number): number
|
|
abs("hi")
|
|
)BUILTIN_SRC");
|
|
|
|
// LUAU_REQUIRE_ERRORS(res);
|
|
}
|
|
|
|
TEST_SUITE_END();
|