Support Symbol#to_proc block inference#452
Open
pvcresin wants to merge 1 commit into
Open
Conversation
Co-authored-by: Codex <codex@openai.com>
Collaborator
|
I tried this branch against Redmine 6.1.1 with this script, and the analysis hangs (master finishes in under 20s). Could you take a look? |
sinsoku
reviewed
May 11, 2026
| resolve(genv, changes) do |me, ty, mid, orig_ty| | ||
| if !me | ||
| if @node.is_a?(AST::YieldNode) && mid == :call && orig_ty.is_a?(Type::Symbol) | ||
| box = add_symbol_proc_call_box(changes, genv, orig_ty.sym, @a_args.positionals) |
Collaborator
There was a problem hiding this comment.
yield with keyword arguments is valid Ruby, e.g.:
def foo
yield 1, key: "v"
end
foo { |x, key:| puts "x=#{x}, key=#{key}" } # => x=1, key=vSo I think @a_args.keywords should also be passed through to add_symbol_proc_call_box here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #414
Support
Symbol#to_procblocks such asmap(&:to_i).This treats a symbol passed as a block as a method call where the first yielded block argument is the receiver and the remaining yielded arguments are method arguments.
Changes
["1", "2"].map(&:to_i)asArray[Integer]yield