lang: core: fmt: Catch printf edge case

This commit is contained in:
James Shubin
2025-05-24 21:03:19 -04:00
parent 861ba50f9c
commit 876834ff29
2 changed files with 4 additions and 1 deletions

View File

@@ -169,6 +169,9 @@ func (obj *PrintfFunc) FuncInfer(partialType *types.Type, partialValues []types.
if err != nil {
return nil, nil, errwrap.Wrapf(err, "could not parse format string")
}
if a, l := len(typList)-1, len(formatList); a != l {
return nil, nil, fmt.Errorf("number of args (%d) doesn't match format string verb count (%d)", a, l)
}
for i, x := range typList {
if i == 0 { // format string
continue