Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse error on pattern expression with a quoted symbol in it #2634

Open
netrusov opened this issue Mar 26, 2024 · 0 comments
Open

Parse error on pattern expression with a quoted symbol in it #2634

netrusov opened this issue Mar 26, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@netrusov
Copy link

netrusov commented Mar 26, 2024

System configuration

I've tried different combinations of ruby/prism versions, picked the most recent for an example

$ ruby --version
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]

$ ruby -r prism -e 'p Prism::VERSION'
"0.24.0"

Steps to reproduce

here's a simplified example

code = <<~RUBY
response = { status: 'ok', '3ds_status': 'redirect', url: 'url' }

case response
in { status: 'ok', '3ds_status': 'redirect', url: url }
  redirect_to url
in { status: 'ok' }
  status :ok
end
RUBY

Current behavior

prism is unable to parse quoted symbol in pattern matching expression

require 'prism'
Prism.parse(code).errors
# => [#<Prism::ParseError @message="expected a label after the `,` in the hash pattern" @location=#<Prism::Location @start_offset=99 @length=0 start_line=4> @level=:fatal>]

Expected behavior

prism has to parse this expression correctly, the same code works with current parser with no problems

require 'parser/current'
Parser::CurrentRuby.parse(code) # no errors
@kddnewton kddnewton added the bug Something isn't working label Mar 27, 2024
@kddnewton kddnewton added this to the CRuby unblocked milestone Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants