From: "Earlopain (Earlopain _) via ruby-core" Date: 2026-03-05T19:34:10+00:00 Subject: [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/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/