Skip to content

Conversation

@Earlopain
Copy link
Contributor

Prism 1.5.0 contains an incorrect polyfill for warn, which causes it to always output with location information, even if no uplevel is provided.

I fixed this in ruby/prism#3647 but it is not released yet.

@Earlopain Earlopain requested a review from a team as a code owner September 16, 2025 08:55
name: Prism
steps:
- uses: actions/checkout@v5
- name: Use prism parser
Copy link
Contributor Author

@Earlopain Earlopain Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed, it gets pulled in by rubocop-ast and also prevents me from specifying it in the gemfile since it then would appear twice.

Gemfile Outdated
gem 'yard'

# FIXME: Remove when the next prism version is released.
gem 'prism', '< 1.5.0' if RUBY_VERSION < '3.0' || RUBY_ENGINE == 'jruby'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since your PR is merged, this could probably be '!= 1.5.0', '!= 1.5.1' instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, it can be. BTW, jruby is included in this list because it has an incompatible UnboundMethod#parameters implementation, which causes the polyfill to be also be applied even though it really shouldn't be

Prism 1.5.0 contains an incorrect polyfill for `warn`, which
causes it to always output with location information,
even if no uplevel is provided.
@bquorning bquorning merged commit 413770b into rubocop:master Sep 16, 2025
27 checks passed
@pirj
Copy link
Member

pirj commented Sep 16, 2025

Just thinking out loud.
Prism is opt-in with PARSER_ENGINE=parser_prism in rubocop.
Those who opt-in, most certainly are early adopters, and unlikely to run Ruby 2.7
We're kind of interested in how well Prism is with the oldest Rubies, but we're also interested how Prism would work with modern code, e.g. support the itblock on Ruby 3.4.

With this in mind, does it make sense to keep the Prism build on 2.7? I can't recall why we've introduced it with 2.7 in the first place.
Should we switch it to 3.4?

Please accept my apologies if I'm missing something obvious.

@Earlopain
Copy link
Contributor Author

I don't think the runtime version here is actually that important. You can use any really, since it doesn't impact as what ruby version the code is actually being parsed. All code for 3.4 will still get analyzed as 3.4 even with prism running on ruby 2.7

You are certainly right that the intersection of analyzing as ruby 3.4 but running 2.7 would be very small. But you are not missing out on any tests because of that.

Prism is opt-in with PARSER_ENGINE=parser_prism in rubocop.

Prism is now used automatically with AllCops: { TargetRubyVersion: 3.4 }.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants