Actions
Bug #21946
closed`and?` predicate confused for leading `and` keyword
Bug #21946:
`and?` predicate confused for leading `and` keyword
Description
Originally reported at https://github.com/ruby/prism/pull/3337#issuecomment-4004880188
$ ruby -ce $'foo\nand?'
ruby: -e:2: syntax errors found (SyntaxError)
1 | foo
> 2 | and?
| ^ expected an expression after `?` in the ternary operator
| ^ unexpected '?'; expected an expression after the operator
| ^ unexpected end-of-input, assuming it is closing the parent ternary expression
Same for and! and or . parse.y is not impacted
Updated by Earlopain (Earlopain _) about 7 hours ago
- Status changed from Open to Closed
Applied in changeset git|54eb330f8cc9f5a5b67ccfa5247cd8b98fb1ef44.
[ruby/prism] Correctly handle and? and similar on ruby 4.0
It gets confused for syntax introduced in https://bugs.ruby-lang.org/issues/20925
But it actually should be a plain method call.
!/? are not valid as part of an identifier, methods
however allow them as the last character.
Fixes [Bug #21946]
Actions