diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/ReadVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/ReadVariableNode.java index 0482836c0119317f7a47d9ff631e6ffc8a3058d8..9797aab076824e094dcb7ba23d432f6065d03913 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/ReadVariableNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/ReadVariableNode.java @@ -932,12 +932,17 @@ abstract class CheckTypeNode extends RBaseNode { return type == RType.Function || type == RType.Closure || type == RType.Builtin || type == RType.Special; } + @Specialization(guards = "isExternalObject(o)") + boolean checkType(@SuppressWarnings("unused") TruffleObject o) { + return type == RType.Function || type == RType.Closure || type == RType.Builtin || type == RType.Special; + } + + protected static boolean isExternalObject(TruffleObject o) { + return !(o instanceof RTypedValue); + } + @Fallback - boolean checkType(Object o) { - if (type == RType.Function || type == RType.Closure || type == RType.Builtin || type == RType.Special) { - return o instanceof TruffleObject && !(o instanceof RTypedValue); - } else { - return false; - } + boolean checkType(@SuppressWarnings("unused") Object o) { + return false; } }