Skip to content

Conversation

@Earlopain
Copy link
Contributor

It used to not emit this token type, but now it does. So when a newer version of prism is present, we can fall back to the same code that ripper uses.

Ref:

@Earlopain Earlopain marked this pull request as draft January 20, 2026 11:35
@Earlopain Earlopain marked this pull request as ready for review January 20, 2026 11:47
@eregon eregon requested a review from schneems January 20, 2026 11:56
last&.type == :on_tstring_end
return false unless last

last.type == :on_tstring_end || (last.type == :on_sp && last.token == TRAILING_SLASH)
Copy link
Member

Choose a reason for hiding this comment

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

The (last.type == :on_sp && last.token == TRAILING_SLASH) part is to handle the fact there is no Prism 1.8.1/1.9.0 yet and so no easy way to detect Prism has :on_sp vs not, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's right. I tried feature detection (Prism.lex_compat(" ").value.dig(0, 1) == :on_sp) but then some other test here fails because prism loads delegate and that adds a method to Kernel which it didn't like

Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

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

Looks good and safe to me.

@eregon
Copy link
Member

eregon commented Jan 20, 2026

Some CI jobs are failing, the 4.0 job failures seem unrelated & pre-existing but https://github.com/ruby/syntax_suggest/actions/runs/21170190500/job/60887146934?pr=241 needs a changelog entry or so

@Earlopain
Copy link
Contributor Author

CI should be green with #242. I added a changelog entry

It used to not emit this token type, but now it does.
So when a newer version of prism is present, we can fall back
to the same code that ripper uses.

Ref:
* ruby/ruby#15914
* ruby/prism#3859
@eregon
Copy link
Member

eregon commented Jan 20, 2026

What's the order here, I suppose we could merge this PR, and that will then auto-push/sync a commit to ruby/ruby and then we only need the Reapply commit from ruby/ruby#15914?

Also not sure how urgent it is, I suppose it can get messy if other PRs are merged in ruby/prism as then that sync might not work either. If it's not urgent I would probably wait for @schneems' review.

@Earlopain
Copy link
Contributor Author

I think we can merge the ruby PR, leave this open, and then apply any desired changes on top of this PR so that those get synced over.

We should not merge much in prism related to ripper until the commit is reapplied. Since we know, we can wait a bit until we get a review here.

@eregon
Copy link
Member

eregon commented Jan 20, 2026

Makes sense, I merged the ruby/ruby PR.

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.

2 participants