Skip to content

Commit 38fdc44

Browse files
committed
Add missing specialization for Float#instance_variables
1 parent 68825d1 commit 38fdc44

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

spec/ruby/core/kernel/instance_variables_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
describe "Kernel#instance_variables" do
55
describe "immediate values" do
66
it "returns an empty array if no instance variables are defined" do
7-
0.instance_variables.should == []
7+
[0, 0.5, true, false, nil].each do |value|
8+
value.instance_variables.should == []
9+
end
810
end
911

1012
it "returns the correct array if an instance variable is added" do

src/main/java/org/truffleruby/core/support/TypeNodes.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ protected RubyArray instanceVariables(long object) {
159159
return ArrayHelpers.createEmptyArray(getContext());
160160
}
161161

162+
@Specialization
163+
protected RubyArray instanceVariables(double object) {
164+
return ArrayHelpers.createEmptyArray(getContext());
165+
}
166+
162167
@Specialization
163168
protected RubyArray instanceVariables(boolean object) {
164169
return ArrayHelpers.createEmptyArray(getContext());

0 commit comments

Comments
 (0)