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

Fix arity check for defaults #93

Open
wants to merge 2 commits into
base: fix/default-arity-checks
Choose a base branch
from

Conversation

skryukov
Copy link
Member

This PR fixes false negatives for default values wrapped into lambdas and procs.

Source of the problem:

la = ->(a,b,*c) {}
pr = proc {|a,b,*c|}


lambda.arity #=> -3
proc.arity #=> -3

lambda.method(:call).arity #=> -1
proc.method(:call).arity #=> -1

I left it possible to use defaults with one (and only one) splat operator.

@skryukov skryukov requested a review from solnic as a code owner October 11, 2021 07:56
@nepalez nepalez changed the base branch from main to fix/default-arity-checks July 25, 2022 18:11
@nepalez nepalez requested review from nepalez and removed request for nepalez July 25, 2022 18:18
@nepalez
Copy link
Member

nepalez commented Jul 25, 2022

Hey @solnic
It looks like your review is necessary even to merge Svyatoslav's PR into my branch (I'd like to recheck and fix rubocop issues before opening a PR to main branch)
Could you look at it, please?

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