From 13d30adcffdf24de725bc5ab648d7cee7543c7cb Mon Sep 17 00:00:00 2001
From: stepan <stepan.sindelar@oracle.com>
Date: Thu, 26 Apr 2018 19:48:34 +0200
Subject: [PATCH] More informative errors in ListAccessNodes

---
 .../truffle/r/ffi/impl/nodes/ListAccessNodes.java     | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/ListAccessNodes.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/ListAccessNodes.java
index 1faf261501..e27f21a892 100644
--- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/ListAccessNodes.java
+++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/ListAccessNodes.java
@@ -22,6 +22,7 @@
  */
 package com.oracle.truffle.r.ffi.impl.nodes;
 
+import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.Cached;
 import com.oracle.truffle.api.dsl.Fallback;
 import com.oracle.truffle.api.dsl.Specialization;
@@ -32,6 +33,7 @@ import com.oracle.truffle.r.ffi.impl.nodes.ListAccessNodesFactory.SETCARNodeGen;
 import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.GetNamesAttributeNode;
 import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.SetNamesAttributeNode;
 import com.oracle.truffle.r.runtime.RInternalError;
+import com.oracle.truffle.r.runtime.Utils;
 import com.oracle.truffle.r.runtime.data.CharSXPWrapper;
 import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames;
 import com.oracle.truffle.r.runtime.data.RDataFactory;
@@ -79,8 +81,9 @@ public final class ListAccessNodes {
         }
 
         @Fallback
+        @TruffleBoundary
         protected Object car(@SuppressWarnings("unused") Object obj) {
-            throw RInternalError.unimplemented("CAR only works on pair lists, language objects, argument lists, and symbols");
+            throw RInternalError.unimplemented("CAR only works on pair lists, language objects, and argument lists, type given: " + Utils.getTypeName(obj));
         }
 
         public static CARNode create() {
@@ -128,8 +131,9 @@ public final class ListAccessNodes {
         }
 
         @Fallback
+        @TruffleBoundary
         protected Object cdr(@SuppressWarnings("unused") Object obj) {
-            throw RInternalError.unimplemented("CDR only works on pair lists, language objects, and argument lists");
+            throw RInternalError.unimplemented("CDR only works on pair lists, language objects, and argument lists, type given: " + Utils.getTypeName(obj));
         }
 
         public static CDRNode create() {
@@ -223,8 +227,9 @@ public final class ListAccessNodes {
         }
 
         @Fallback
+        @TruffleBoundary
         protected Object car(@SuppressWarnings("unused") Object x, @SuppressWarnings("unused") Object y) {
-            throw RInternalError.unimplemented("SETCAR only works on pair lists or language objects");
+            throw RInternalError.unimplemented("SETCAR only works on pair lists or language objects, types given: " + Utils.getTypeName(x) + ',' + Utils.getTypeName(y));
         }
     }
 
-- 
GitLab