hhvm
hhvm copied to clipboard
FormatString doesn't understand positional modifiers
<?hh // strict
function test(): void {
printf('%1$d.%1$d', 1);
}
$ hh_client
test.php:4:5,26: Too many arguments (Typing[4105])
/tmp/hh_server/hhi_3f2f7faf/printf.hhi:88:10,15: Definition is here
test.php:4:12,22: I don't understand the format string %1$ in %1$d.%1$d (Typing[4038])
/tmp/hh_server/hhi_3f2f7faf/printf.hhi:70:35,46: You can add a new format specifier by adding format_0x24() to PlainSprintf
test.php:4:12,22: I don't understand the format string %1$ in %1$d.%1$d (Typing[4038])
/tmp/hh_server/hhi_3f2f7faf/printf.hhi:70:35,46: You can add a new format specifier by adding format_0x24() to PlainSprintf
Not sure if this does just need the format_0x24() method or if Hack needs to know how to handle them (not sure if that part's missing)
It's more involved - if you say "%s %d" the typechecker checks the next args are a string followed by an integer. It needs to be told it's the other way around for "%2$s %1$d"
Additionally, FormatString
Duplicate of #2122