Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Truffle] Fixed exception message when boxed primitives are used.
We want to use the Ruby logical name, e.g., Fixnum rather than java.lang.Integer.
  • Loading branch information
nirvdrum committed Dec 5, 2014
1 parent e29effb commit c1bf2b6
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
Expand Up @@ -506,7 +506,7 @@ public Object eval(RubyString source, RubyBinding binding) {
}

@Specialization(guards = "!isString")
public Object eval(VirtualFrame frame, RubyBasicObject object, UndefinedPlaceholder binding) {
public Object eval(VirtualFrame frame, RubyBasicObject object, @SuppressWarnings("unused") UndefinedPlaceholder binding) {
notDesignedForCompilation();

Object coerced;
Expand All @@ -527,18 +527,12 @@ public Object eval(VirtualFrame frame, RubyBasicObject object, UndefinedPlacehol
if (coerced instanceof RubyString) {
return getContext().eval(coerced.toString(), this);
} else {
String coercedClassName = coerced.getClass().getName();

if (coerced instanceof RubyBasicObject) {
coercedClassName = ((RubyBasicObject) coerced).getLogicalClass().getName();
}

throw new RaiseException(
getContext().getCoreLibrary().typeError(
String.format("can't convert %s to String (%s#to_str gives %s)",
object.getLogicalClass().getName(),
object.getLogicalClass().getName(),
coercedClassName),
getContext().getCoreLibrary().getLogicalClass(coerced).getName()),
this));
}
}
Expand Down

0 comments on commit c1bf2b6

Please sign in to comment.