Skip to content

Fix any_spec#1234

Merged
enebo merged 1 commit intojruby:jruby-1_7from
dmarcotte:any-spec-1_7
Nov 20, 2013
Merged

Fix any_spec#1234
enebo merged 1 commit intojruby:jruby-1_7from
dmarcotte:any-spec-1_7

Conversation

@dmarcotte
Copy link
Contributor

Use the appropriate arity to get Enumerable#any to handle its args correctly. Note that we need to switch from JavaInternalBlockBody to a BlockCallback since JavaInternalBlockBody does not properly respect its arity in 1_7.

Note: this does not need to be merged into master. any_spec was fixed for master in #1202

Use the appropriate arity to get Enumerable#any to handle its args
correctly.  Note that we need to switch from JavaInternalBlockBody to a
BlockCallback since JavaInternalBlockBody does not properly respect its
arity in 1_7.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please let me know if my thinking is wrong on this line... since this is an instance method on RubyArray, which has a native each, this is always true and so can totally be deleted. Correct?

Let me know if I'm missing something... if we do want to call into RubyEnumerable here, I can restore this line (though it will need a switch on Ruby version to decide what arity the any block should use)

Copy link
Member

Choose a reason for hiding this comment

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

I am trying to think of Enumerable is included into another core class which defines each. Although in that case it might also have an instance of any_p defined. I am ok with removing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting follow-up to this @enebo. Looking into #1265, I figured out what this line was good for: we don't want to directly consult the array elements for #any? if #each has bee overridden.

Restored the line in #1271 (though note I left out the RubyVersion switch since it's not used in the other places we're doing this. This probably leaves things subtly broken in 1.8, but in a pretty narrow use case: only affects multi-args yields on arrays which have #each overridden. Will have a look at it, and probably send another pull addressing it)

@dmarcotte
Copy link
Contributor Author

Travis note: the failures here are not related to this change. See a clean run of this branch here.

enebo added a commit that referenced this pull request Nov 20, 2013
@enebo enebo merged commit 7139a09 into jruby:jruby-1_7 Nov 20, 2013
dmarcotte added a commit to dmarcotte/jruby that referenced this pull request Nov 26, 2013
Fix a stack overflow in Array#all (jruby#1265)
and restore the correct behavior for Array#any (the needed isBuiltn
check was incorrectly removed in jruby#1234)

Also add a spec to ensure this remains stable going forward.
dmarcotte added a commit to dmarcotte/jruby that referenced this pull request Nov 26, 2013
Fix a stack overflow in Array#all (jruby#1265)
and restore the correct behavior for Array#any (the needed isBuiltn
check was incorrectly removed in jruby#1234)

Also add a spec to ensure this remains stable going forward.
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