mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Add FFlag
This commit is contained in:
parent
0ab3db5c29
commit
1cde3871e0
3 changed files with 13 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
LUAU_FASTINT(LuauTableTypeMaximumStringifierLength)
|
||||
LUAU_FASTINT(LuauTypeMaximumStringifierLength)
|
||||
LUAU_FASTFLAG(LuauToStringSimpleCompositeTypesSingleLine)
|
||||
|
||||
namespace Luau
|
||||
{
|
||||
|
@ -39,6 +40,12 @@ struct ToStringNameMap
|
|||
|
||||
struct ToStringOptions
|
||||
{
|
||||
ToStringOptions(bool exhaustive = false)
|
||||
: exhaustive(exhaustive)
|
||||
, compositeTypesSingleLineLimit(FFlag::LuauToStringSimpleCompositeTypesSingleLine.value ? 5 : 0)
|
||||
{
|
||||
}
|
||||
|
||||
bool exhaustive = false; // If true, we produce complete output rather than comprehensible output
|
||||
bool useLineBreaks = false; // If true, we insert new lines to separate long results such as table entries/metatable.
|
||||
bool functionTypeArguments = false; // If true, output function type argument names when they are available
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution)
|
||||
LUAU_FASTFLAGVARIABLE(LuauToStringPrettifyLocation, false)
|
||||
LUAU_FASTFLAGVARIABLE(LuauToStringSimpleCompositeTypesSingleLine, false)
|
||||
|
||||
/*
|
||||
* Enables increasing levels of verbosity for Luau type names when stringifying.
|
||||
|
|
|
@ -216,6 +216,7 @@ TEST_CASE_FIXTURE(Fixture, "functions_are_always_parenthesized_in_unions_or_inte
|
|||
|
||||
TEST_CASE_FIXTURE(Fixture, "simple_intersections_printed_on_one_line")
|
||||
{
|
||||
ScopedFastFlag sff{"LuauToStringSimpleCompositeTypesSingleLine", true};
|
||||
CheckResult result = check(R"(
|
||||
local a: string & number
|
||||
)");
|
||||
|
@ -228,6 +229,7 @@ TEST_CASE_FIXTURE(Fixture, "simple_intersections_printed_on_one_line")
|
|||
|
||||
TEST_CASE_FIXTURE(Fixture, "complex_intersections_printed_on_multiple_lines")
|
||||
{
|
||||
ScopedFastFlag sff{"LuauToStringSimpleCompositeTypesSingleLine", true};
|
||||
CheckResult result = check(R"(
|
||||
local a: string & number & boolean
|
||||
)");
|
||||
|
@ -246,6 +248,7 @@ TEST_CASE_FIXTURE(Fixture, "complex_intersections_printed_on_multiple_lines")
|
|||
|
||||
TEST_CASE_FIXTURE(Fixture, "overloaded_functions_always_printed_on_multiple_lines")
|
||||
{
|
||||
ScopedFastFlag sff{"LuauToStringSimpleCompositeTypesSingleLine", true};
|
||||
CheckResult result = check(R"(
|
||||
local a: ((string) -> string) & ((number) -> number)
|
||||
)");
|
||||
|
@ -262,6 +265,7 @@ TEST_CASE_FIXTURE(Fixture, "overloaded_functions_always_printed_on_multiple_line
|
|||
|
||||
TEST_CASE_FIXTURE(Fixture, "simple_unions_printed_on_one_line")
|
||||
{
|
||||
ScopedFastFlag sff{"LuauToStringSimpleCompositeTypesSingleLine", true};
|
||||
CheckResult result = check(R"(
|
||||
local a: number | boolean
|
||||
)");
|
||||
|
@ -274,6 +278,7 @@ TEST_CASE_FIXTURE(Fixture, "simple_unions_printed_on_one_line")
|
|||
|
||||
TEST_CASE_FIXTURE(Fixture, "complex_unions_printed_on_multiple_lines")
|
||||
{
|
||||
ScopedFastFlag sff{"LuauToStringSimpleCompositeTypesSingleLine", true};
|
||||
CheckResult result = check(R"(
|
||||
local a: string | number | boolean
|
||||
)");
|
||||
|
|
Loading…
Add table
Reference in a new issue