mirror of
https://github.com/luau-lang/luau.git
synced 2025-03-03 18:51:42 +00:00
Fix the order of the arguments being inputted into result.append in print() from the Type Function Runtime (#1676)
--- Co-authored-by: vegorov-rbx <75688451+vegorov-rbx@users.noreply.github.com>
This commit is contained in:
parent
14ccae9b44
commit
29a5198055
2 changed files with 28 additions and 1 deletions
|
@ -15,6 +15,7 @@
|
|||
|
||||
LUAU_DYNAMIC_FASTINT(LuauTypeFunctionSerdeIterationLimit)
|
||||
LUAU_FASTFLAGVARIABLE(LuauUserTypeFunTypeofReturnsType)
|
||||
LUAU_FASTFLAGVARIABLE(LuauTypeFunPrintFix)
|
||||
|
||||
namespace Luau
|
||||
{
|
||||
|
@ -1610,7 +1611,12 @@ static int print(lua_State* L)
|
|||
size_t l = 0;
|
||||
const char* s = luaL_tolstring(L, i, &l); // convert to string using __tostring et al
|
||||
if (i > 1)
|
||||
result.append('\t', 1);
|
||||
{
|
||||
if (FFlag::LuauTypeFunPrintFix)
|
||||
result.append(1, '\t');
|
||||
else
|
||||
result.append('\t', 1);
|
||||
}
|
||||
result.append(s, l);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ using namespace Luau;
|
|||
LUAU_FASTFLAG(LuauSolverV2)
|
||||
LUAU_FASTFLAG(DebugLuauEqSatSimplification)
|
||||
LUAU_FASTFLAG(LuauUserTypeFunTypeofReturnsType)
|
||||
LUAU_FASTFLAG(LuauTypeFunPrintFix)
|
||||
|
||||
TEST_SUITE_BEGIN("UserDefinedTypeFunctionTests");
|
||||
|
||||
|
@ -1885,4 +1886,24 @@ local _:test<number>
|
|||
CHECK(toString(result.errors[0]) == R"(type)");
|
||||
}
|
||||
|
||||
TEST_CASE_FIXTURE(BuiltinsFixture, "udtf_print_tab_char_fix")
|
||||
{
|
||||
ScopedFastFlag sffs[] = {{FFlag::LuauSolverV2, true}, {FFlag::LuauTypeFunPrintFix, true}};
|
||||
|
||||
CheckResult result = check(R"(
|
||||
type function test(t)
|
||||
print(1,2)
|
||||
|
||||
return t
|
||||
end
|
||||
|
||||
local _:test<number>
|
||||
)");
|
||||
|
||||
LUAU_REQUIRE_ERROR_COUNT(1, result);
|
||||
|
||||
// It should be \t and not \x1
|
||||
CHECK_EQ("1\t2", toString(result.errors[0]));
|
||||
}
|
||||
|
||||
TEST_SUITE_END();
|
||||
|
|
Loading…
Add table
Reference in a new issue