[ruby-core:124935] [Ruby Bug#21946] `and?` predicate confused for leading `and` keyword
Issue #21946 has been reported by Earlopain (Earlopain _). ---------------------------------------- Bug #21946: `and?` predicate confused for leading `and` keyword https://bugs.ruby-lang.org/issues/21946 * Author: Earlopain (Earlopain _) * Status: Open * Assignee: prism * ruby -v: ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [x86_64-linux] * Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED ---------------------------------------- Originally reported at https://github.com/ruby/prism/pull/3337#issuecomment-4004880188 ```sh $ 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
Fix in https://github.com/ruby/prism/pull/3966
--
https://bugs.ruby-lang.org/
Issue #21946 has been updated by k0kubun (Takashi Kokubun). Backport changed from 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED to 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE ruby_4_0 commit:83c261f30bd43dc3465c0026b96e79af585fdfab. ---------------------------------------- Bug #21946: `and?` predicate confused for leading `and` keyword https://bugs.ruby-lang.org/issues/21946#change-116720 * Author: Earlopain (Earlopain _) * Status: Closed * Assignee: prism * ruby -v: ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [x86_64-linux] * Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE ---------------------------------------- Originally reported at https://github.com/ruby/prism/pull/3337#issuecomment-4004880188 ```sh $ 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
Fix in https://github.com/ruby/prism/pull/3966
--
https://bugs.ruby-lang.org/
participants (2)
-
Earlopain (Earlopain _) -
k0kubun (Takashi Kokubun)