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

Require prism >= 0.19.0 #4

Merged
merged 7 commits into from
Dec 17, 2023
Merged

Require prism >= 0.19.0 #4

merged 7 commits into from
Dec 17, 2023

Conversation

tompng
Copy link
Member

@tompng tompng commented Dec 2, 2023

Remove StringNode workaround
Simplify CallNode attribute assign check (CallNode#attribute_write? is added)
Fix for added nodes NumberedParametersNode CallTargetNode IndexTargetNode ImplicitRestNode

@tompng tompng marked this pull request as ready for review December 8, 2023 12:51
@tompng tompng changed the title Use prism 0.19.0 (not released yet) Prepare for prism 0.19.0 (not released yet) Dec 8, 2023
Copy link
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

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

If I understand it correctly, after this change we'll be supporting both Prism 0.18 and 0.19? If that's the case, maybe we should just move towards 0.19 as people should always upgrade Prism, especially before Ruby 3.3?
In the meantime, we can point Prism to GH source in the Gemfile.

lib/repl_type_completor.rb Outdated Show resolved Hide resolved
@tompng
Copy link
Member Author

tompng commented Dec 8, 2023

I was thinking of:

  1. Support both(prism head and 0.18.0) for now
  2. Switch to 0.19.0, remove code for 0.18.0
  3. Release repl_type_completor

Mainly to make CI green. (but it makes code complicated...)

Using github source in Gemfile seems good, I'll try it.

@tompng tompng marked this pull request as draft December 9, 2023 13:36
@tompng tompng force-pushed the prism_0_19_0 branch 7 times, most recently from 74fa4ab to d518e98 Compare December 14, 2023 20:54
@tompng tompng changed the title Prepare for prism 0.19.0 (not released yet) Require prism >= 0.19.0 Dec 14, 2023
@tompng tompng marked this pull request as ready for review December 14, 2023 20:56
@tompng tompng requested a review from a team December 15, 2023 15:17
lib/repl_type_completor.rb Outdated Show resolved Hide resolved
@@ -925,8 +923,7 @@ def assign_parameters(node, scope, args, kwargs)
node.posts.zip posts do |n, v|
assign_required_parameter n, v, scope
end
if node.rest&.name
# node.rest is Prism::RestParameterNode
if node.rest.is_a?(Prism::RestParameterNode) && node.rest.name
Copy link
Member

Choose a reason for hiding this comment

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

There's a if node.rest condition a few lines above, which seems to already expect it to be Prism::RestParameterNode? Perhaps we can merge that and this together?

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the confusing comment in the if node.rest condition and add a comment about Prism::ImplicitRestNode that does not have name.

The if node.rest above part is separating given args to reqs, posts, rest
method do |a,b=1,*c| and given args [Integer, String, Symbol] to reqs = [Integer], opts = [String], posts = [], rest = [Symbol].

This part is assigning each of them.

node.requireds.zip{assign}
node.optionals.zip{assign}
node.posts.zip{assign}
if node.rest; assign; end

I want to separate them, not to merge it together.

Copy link
Member

Choose a reason for hiding this comment

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

I see, thanks for the clear explanation 👍

@tompng tompng merged commit e88b2ce into main Dec 17, 2023
18 checks passed
@tompng tompng deleted the prism_0_19_0 branch December 17, 2023 11:42
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