Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4f28b9b2282e
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 96be43fd5ea9
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Dec 1, 2014

  1. [Truffle] Implemented NilClass#to_f.

    To get this passing I needed to provide a partial implementation for Float#==.  This will need to be revisited.
    nirvdrum committed Dec 1, 2014
    Copy the full SHA
    b7cdd6c View commit details
  2. Copy the full SHA
    96be43f View commit details
Original file line number Diff line number Diff line change
@@ -384,6 +384,12 @@ public boolean equal(double a, double b) {
public boolean equal(double a, RubyBignum b) {
return a == b.doubleValue();
}

@Specialization(guards = "!isBignum(arguments[1])")
public boolean less(@SuppressWarnings("unused") double a, RubyBasicObject other) {
// TODO (nirvdrum Dec. 1, 2014): This is a stub. There is one case where this should return 'true', but it's not a trivial fix.
return false;
}
}

@CoreMethod(names = "<=>", required = 1)
17 changes: 17 additions & 0 deletions core/src/main/java/org/jruby/truffle/nodes/core/NilClassNodes.java
Original file line number Diff line number Diff line change
@@ -85,6 +85,23 @@ public int toI() {
}
}

@CoreMethod(names = "to_f", needsSelf = false)
public abstract static class ToFNode extends CoreMethodNode {

public ToFNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public ToFNode(ToINode prev) {
super(prev);
}

@Specialization
public double toF() {
return 0.0f;
}
}

@CoreMethod(names = "to_s", needsSelf = false)
public abstract static class ToSNode extends CoreMethodNode {

1 change: 0 additions & 1 deletion spec/truffle/tags/core/float/equal_value_tags.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
fails:Float#== returns true if self has the same value as other
fails:Float#== calls 'other == self' if coercion fails
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/nil/to_f_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/nil/to_i_tags.txt

This file was deleted.