Skip to content

Commit d26e8ba

Browse files
committed
metamorphic: tolerate integers for user key suffixes
This prevents a crossversion failure when parsing the NewIter op, which switched from integers to strings in the filterMin/filterMax arguments.
1 parent 9c9786f commit d26e8ba

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

metamorphic/parser.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,14 @@ func (p *parser) parseArgs(op op, methodName string, args []interface{}) {
372372
*t = p.parseUserKey(elem.pos, elem.lit)
373373

374374
case *UserKeySuffix:
375-
elem.expectToken(p, token.STRING)
376-
*t = p.parseUserKeySuffix(elem.pos, elem.lit)
375+
if elem.tok == token.INT {
376+
// Tolerate integers for backward compatibility (when loading ops from a
377+
// previous version).
378+
*t = UserKeySuffix(elem.lit)
379+
} else {
380+
elem.expectToken(p, token.STRING)
381+
*t = p.parseUserKeySuffix(elem.pos, elem.lit)
382+
}
377383

378384
case *[]byte:
379385
elem.expectToken(p, token.STRING)

0 commit comments

Comments
 (0)