Skip to content

Commit 5dc447a

Browse files
committed
Fixes #2902. Enumerable#find_index gives wrong result in case with types cast
1 parent d58fd29 commit 5dc447a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/src/main/java/org/jruby/RubyEnumerable.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
import static org.jruby.RubyEnumerator.enumeratorize;
5656
import static org.jruby.RubyEnumerator.enumeratorizeWithSize;
57+
import static org.jruby.RubyObject.equalInternal;
5758
import static org.jruby.runtime.Helpers.invokedynamic;
5859
import static org.jruby.runtime.invokedynamic.MethodNames.OP_CMP;
5960
import static org.jruby.RubyEnumerator.SizeFn;
@@ -717,7 +718,7 @@ public static IRubyObject find_indexCommon(ThreadContext context, IRubyObject se
717718
callEach(runtime, context, self, Signature.ONE_ARGUMENT, new BlockCallback() {
718719
public IRubyObject call(ThreadContext ctx, IRubyObject[] largs, Block blk) {
719720
IRubyObject larg = packEnumValues(runtime, largs);
720-
if (larg.equals(cond)) throw JumpException.SPECIAL_JUMP;
721+
if (equalInternal(ctx, larg, cond)) throw JumpException.SPECIAL_JUMP;
721722
result[0]++;
722723
return runtime.getNil();
723724
}

0 commit comments

Comments
 (0)