mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Fix FFlags
This commit is contained in:
parent
93c77333c0
commit
34e0390029
2 changed files with 26 additions and 14 deletions
|
@ -11,7 +11,6 @@
|
|||
#include <stdexcept>
|
||||
|
||||
LUAU_FASTFLAG(LuauLowerBoundsCalculation)
|
||||
LUAU_FASTFLAG(LuauToStringTableBracesNewlines)
|
||||
|
||||
/*
|
||||
* Prefix generic typenames with gen-
|
||||
|
@ -20,6 +19,7 @@ LUAU_FASTFLAG(LuauToStringTableBracesNewlines)
|
|||
*/
|
||||
LUAU_FASTFLAGVARIABLE(DebugLuauVerboseTypeNames, false)
|
||||
LUAU_FASTFLAGVARIABLE(LuauDocFuncParameters, false)
|
||||
LUAU_FASTFLAGVARIABLE(LuauToStringTableBracesNewlines, false)
|
||||
|
||||
namespace Luau
|
||||
{
|
||||
|
@ -322,7 +322,8 @@ struct TypeVarStringifier
|
|||
}
|
||||
|
||||
Luau::visit(
|
||||
[this, tv](auto&& t) {
|
||||
[this, tv](auto&& t)
|
||||
{
|
||||
return (*this)(tv, t);
|
||||
},
|
||||
tv->ty);
|
||||
|
@ -916,7 +917,8 @@ struct TypePackStringifier
|
|||
}
|
||||
|
||||
Luau::visit(
|
||||
[this, tp](auto&& t) {
|
||||
[this, tp](auto&& t)
|
||||
{
|
||||
return (*this)(tp, t);
|
||||
},
|
||||
tp->ty);
|
||||
|
@ -1046,9 +1048,11 @@ static void assignCycleNames(const std::set<TypeId>& cycles, const std::set<Type
|
|||
if (auto ttv = get<TableTypeVar>(follow(cycleTy)); !exhaustive && ttv && (ttv->syntheticName || ttv->name))
|
||||
{
|
||||
// If we have a cycle type in type parameters, assign a cycle name for this named table
|
||||
if (std::find_if(ttv->instantiatedTypeParams.begin(), ttv->instantiatedTypeParams.end(), [&](auto&& el) {
|
||||
return cycles.count(follow(el));
|
||||
}) != ttv->instantiatedTypeParams.end())
|
||||
if (std::find_if(ttv->instantiatedTypeParams.begin(), ttv->instantiatedTypeParams.end(),
|
||||
[&](auto&& el)
|
||||
{
|
||||
return cycles.count(follow(el));
|
||||
}) != ttv->instantiatedTypeParams.end())
|
||||
cycleNames[cycleTy] = ttv->name ? *ttv->name : *ttv->syntheticName;
|
||||
|
||||
continue;
|
||||
|
@ -1144,9 +1148,11 @@ ToStringResult toStringDetailed(TypeId ty, const ToStringOptions& opts)
|
|||
state.exhaustive = true;
|
||||
|
||||
std::vector<std::pair<TypeId, std::string>> sortedCycleNames{state.cycleNames.begin(), state.cycleNames.end()};
|
||||
std::sort(sortedCycleNames.begin(), sortedCycleNames.end(), [](const auto& a, const auto& b) {
|
||||
return a.second < b.second;
|
||||
});
|
||||
std::sort(sortedCycleNames.begin(), sortedCycleNames.end(),
|
||||
[](const auto& a, const auto& b)
|
||||
{
|
||||
return a.second < b.second;
|
||||
});
|
||||
|
||||
bool semi = false;
|
||||
for (const auto& [cycleTy, name] : sortedCycleNames)
|
||||
|
@ -1157,7 +1163,8 @@ ToStringResult toStringDetailed(TypeId ty, const ToStringOptions& opts)
|
|||
state.emit(name);
|
||||
state.emit(" = ");
|
||||
Luau::visit(
|
||||
[&tvs, cycleTy = cycleTy](auto&& t) {
|
||||
[&tvs, cycleTy = cycleTy](auto&& t)
|
||||
{
|
||||
return tvs(cycleTy, t);
|
||||
},
|
||||
cycleTy->ty);
|
||||
|
@ -1214,9 +1221,11 @@ ToStringResult toStringDetailed(TypePackId tp, const ToStringOptions& opts)
|
|||
state.exhaustive = true;
|
||||
|
||||
std::vector<std::pair<TypeId, std::string>> sortedCycleNames{state.cycleNames.begin(), state.cycleNames.end()};
|
||||
std::sort(sortedCycleNames.begin(), sortedCycleNames.end(), [](const auto& a, const auto& b) {
|
||||
return a.second < b.second;
|
||||
});
|
||||
std::sort(sortedCycleNames.begin(), sortedCycleNames.end(),
|
||||
[](const auto& a, const auto& b)
|
||||
{
|
||||
return a.second < b.second;
|
||||
});
|
||||
|
||||
bool semi = false;
|
||||
for (const auto& [cycleTy, name] : sortedCycleNames)
|
||||
|
@ -1227,7 +1236,8 @@ ToStringResult toStringDetailed(TypePackId tp, const ToStringOptions& opts)
|
|||
state.emit(name);
|
||||
state.emit(" = ");
|
||||
Luau::visit(
|
||||
[&tvs, cycleTy = cycleTy](auto t) {
|
||||
[&tvs, cycleTy = cycleTy](auto t)
|
||||
{
|
||||
return tvs(cycleTy, t);
|
||||
},
|
||||
cycleTy->ty);
|
||||
|
|
|
@ -62,6 +62,7 @@ TEST_CASE_FIXTURE(Fixture, "named_table")
|
|||
|
||||
TEST_CASE_FIXTURE(Fixture, "empty_table")
|
||||
{
|
||||
ScopedFastFlag LuauToStringTableBracesNewlines("LuauToStringTableBracesNewlines", true);
|
||||
CheckResult result = check(R"(
|
||||
local a: {}
|
||||
)");
|
||||
|
@ -76,6 +77,7 @@ TEST_CASE_FIXTURE(Fixture, "empty_table")
|
|||
|
||||
TEST_CASE_FIXTURE(Fixture, "table_respects_use_line_break")
|
||||
{
|
||||
ScopedFastFlag LuauToStringTableBracesNewlines("LuauToStringTableBracesNewlines", true);
|
||||
CheckResult result = check(R"(
|
||||
local a: { prop: string, anotherProp: number, thirdProp: boolean }
|
||||
)");
|
||||
|
|
Loading…
Add table
Reference in a new issue