dry-initializer icon indicating copy to clipboard operation
dry-initializer copied to clipboard

Fix arity check for defaults

Open skryukov opened this issue 4 years ago • 1 comments

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 avatar Oct 11 '21 07:10 skryukov

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?

nepalez avatar Jul 25 '22 18:07 nepalez