You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ffae969
Browse filesBrowse the repository at this point in the historyBrowse files
* deps: bump go-ruby-parser/parser v0.6.0 -> v0.7.0
v0.6.0 routed the unparenthesised `defined?` through the command-args
gate, which refuses everything in an `arg` position. In parse.y
`defined?` without parentheses is an `arg` production
(`arg: keyword_defined '\n'? begin_defined arg`), so it is legal
anywhere an `arg` is. That regression is live: `a = [defined? foo, 1]`,
`[defined? foo]` and `{k: defined? foo}` all parse under MRI 4.0.5 and
were rejected by us.
v0.7.0 restores those, and additionally requires `then`/`do` where
parse.y requires it, so `if x end`, `while x end` and
`case x; when 1 end` are SyntaxErrors for us as they are for MRI.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test: parenthesise 21 fixtures MRI refuses (`p(x rescue y)`)
Every one of these was `p(EXPR rescue FALLBACK)`, which MRI 4.0.5 refuses
under BOTH parsers: `arg` has no `modifier_rescue` alternative — only `stmt`
and the assignment right-hand sides `arg_rhs`/`command_rhs`/`endless_arg`
do — so a modifier `rescue` cannot appear inside a paren-delimited argument
list. `ruby -c` and `ruby --parser=parse.y -c` both say
"unexpected 'rescue' modifier; expected a `)` to close the arguments", and
running the file fails the same way.
They passed only because parser v0.6.0 accepted them, so these tests pinned
our own divergence. v0.7.0 refuses them, which is correct, and the fixtures
are what has to change. Wrapping the expression — `p((EXPR rescue FALLBACK))`
— is legal MRI and preserves exactly what each case asserts, because a
parenthesised expression is a `primary` and `compstmt` inside it admits the
modifier.
The comment above TestRescueModifierCommandCall claimed every `want` was
verified against MRI 4.0.5; the wants may well have been, but the sources
were not, since MRI cannot parse one of them at all.
Found by extracting all 1893 `rescue`-bearing Go string literals under
internal/ + cmd/ with go/ast and judging each with both parser versions:
21 changed verdict, all in one direction, all refused by MRI.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test: parenthesise the one concatenated fixture the literal scan could not see
`seed + "p(IO.binread(" + q(p) + ", 1, -1) rescue $!.class)"` assembles to
`p(... rescue $!.class)`, which MRI refuses — but no single literal in it is
both parseable and rescue-bearing, so judging literals could not witness it.
The assembled program was judged instead: v0.6.0 ACCEPT, v0.7.0 REFUSE,
`ruby -c` REFUSE, `ruby --parser=parse.y -c` REFUSE.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
0 commit comments