Project

General

Profile

« Previous | Next » 

Revision 5fa28ce0

Added by koic (Koichi ITO) over 1 year ago

[ruby/prism] Warn & interpreted as argument prefix

This PR makes Prism warn & interpreted as argument prefix.
This carries a similar meaning to the following Ruby warning:

$ ruby -cwe "foo &bar" -e:1: warning: `&' interpreted as argument prefix Syntax OK 

Previously, it did not issue a warning:

$ bundle exec ruby -rprism -ve "p Prism.parse('foo &bar').warnings" ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22] [] 

From now on, it will issue a warning similar to Ruby's:

$ bundle exec ruby -rprism -ve "p Prism.parse('foo &bar').warnings" ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22] [#<Prism::ParseWarning @type=:ambiguous_prefix_amp @message="ambiguous `&` has been interpreted as an argument prefix" @location=#<Prism::Location @start_offset=4 @length=1 start_line=1> @level=:verbose>] 

https://github.com/ruby/prism/commit/312f99cd1e