Skip to content

Commit f131465

Browse files
committed
Fixes #2902. Enumerable#find_index gives wrong result in case with types cast
Conflicts: core/src/main/java/org/jruby/RubyEnumerable.java
1 parent 08c65d4 commit f131465

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
import static org.jruby.CompatVersion.RUBY1_8;
5555
import static org.jruby.CompatVersion.RUBY1_9;
5656
import static org.jruby.RubyEnumerator.enumeratorize;
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

@@ -666,7 +667,7 @@ public static IRubyObject find_indexCommon(ThreadContext context, IRubyObject se
666667
callEach(runtime, context, self, Arity.ONE_ARGUMENT, new BlockCallback() {
667668
public IRubyObject call(ThreadContext ctx, IRubyObject[] largs, Block blk) {
668669
IRubyObject larg = packEnumValues(runtime, largs);
669-
if (larg.equals(cond)) throw JumpException.SPECIAL_JUMP;
670+
if (equalInternal(ctx, larg, cond)) throw JumpException.SPECIAL_JUMP;
670671
result[0]++;
671672
return runtime.getNil();
672673
}

0 commit comments

Comments
 (0)