Add FFlag for %*

This commit is contained in:
Kampfkarren 2022-07-27 17:59:21 -07:00
parent 41fa546a17
commit 8ef45854f7
2 changed files with 20 additions and 1 deletions

View file

@ -8,6 +8,9 @@
#include <string.h>
#include <stdio.h>
LUAU_FASTFLAG(LuauInterpolatedStringBaseSupport)
LUAU_FASTFLAGVARIABLE(LuauTostringFormatSpecifier, false);
/* macro to `unsign' a character */
#define uchar(c) ((unsigned char)(c))
@ -1034,6 +1037,18 @@ static int str_format(lua_State* L)
}
case '*':
{
if (!FFlag::LuauTostringFormatSpecifier)
{
if (FFlag::LuauInterpolatedStringBaseSupport)
{
luaL_error(L, "interpolated strings are enabled, but the '*' format specifier is not. this is a configuration bug.");
break;
}
luaL_error(L, "invalid option '%%*' to 'format'");
break;
}
if (formatItemSize != 1)
{
luaL_error(L, "'%%*' does not take a form");

View file

@ -291,12 +291,16 @@ TEST_CASE("Clear")
TEST_CASE("Strings")
{
ScopedFastFlag sff{"LuauTostringFormatSpecifier", true};
runConformance("strings.lua");
}
TEST_CASE("StringInterp")
{
ScopedFastFlag sff{"LuauInterpolatedStringBaseSupport", true};
ScopedFastFlag sffInterpStrings{"LuauInterpolatedStringBaseSupport", true};
ScopedFastFlag sffTostringFormat{"LuauTostringFormatSpecifier", true};
runConformance("stringinterp.lua");
}