Skip to content

Commit 309b411

Browse files
committed
Fix specializations in Kernel#hash to cover all Ruby values
(cherry picked from commit ef7c3dc)
1 parent 5f78ee1 commit 309b411

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/main/java/org/truffleruby/core/kernel/KernelNodes.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,6 @@ protected boolean isFrozen(Object self,
933933
@CoreMethod(names = "hash")
934934
public abstract static class HashNode extends CoreMethodArrayArgumentsNode {
935935

936-
937936
public static HashNode create() {
938937
return KernelNodesFactory.HashNodeFactory.create(null);
939938
}
@@ -965,17 +964,12 @@ protected long hashBignum(RubyBignum value) {
965964
return HashOperations.hashBignum(value, getContext(), this);
966965
}
967966

968-
@Specialization
969-
protected int hash(Nil self) {
967+
@Specialization(guards = "!isRubyBignum(self)")
968+
protected int hash(ImmutableRubyObject self) {
970969
return System.identityHashCode(self);
971970
}
972971

973972
@Specialization
974-
protected int hashEncoding(RubyEncoding self) {
975-
return System.identityHashCode(self);
976-
}
977-
978-
@Specialization(guards = "!isRubyBignum(self)")
979973
protected int hash(RubyDynamicObject self) {
980974
return System.identityHashCode(self);
981975
}

0 commit comments

Comments
 (0)