Skip to content
Permalink
Browse files
[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 c1bf2b643873b323ffa5107cc733d5f51b77370c
Showing with 2 additions and 8 deletions.
  1. +2 −8 core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
@@ -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;
@@ -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));
}
}

0 comments on commit c1bf2b6

Please sign in to comment.