diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/TypeConvert.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/TypeConvert.java
index 49204b765ddbc5dee540d31c69888ec6a8c857f2..81362811de3c5143b33e6276efeece26e09e6920 100644
--- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/TypeConvert.java
+++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/TypeConvert.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@ import com.oracle.truffle.r.runtime.data.RIntVector;
 import com.oracle.truffle.r.runtime.data.RLogicalVector;
 import com.oracle.truffle.r.runtime.data.RVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
+import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
 
 public abstract class TypeConvert extends RExternalBuiltinNode.Arg5 {
 
@@ -123,31 +124,41 @@ public abstract class TypeConvert extends RExternalBuiltinNode.Arg5 {
         }
 
         String s = x.getDataAt(i);
-        try {
-            int intVal = RRuntime.string2intNoCheck(s, true);
-            return readIntVector(x, i, intVal, naStrings);
-        } catch (NumberFormatException ix) {
+        if (RRuntime.hasHexPrefix(s)) {
+            // this is a mess
+            // double takes precedense even if s is a hexadecimal integer
             try {
                 double doubleVal = RRuntime.string2doubleNoCheck(s, true);
+                return readDoubleVector(x, i, doubleVal, naStrings);
+            } catch (NumberFormatException ix) {
+                // fall through
+            }
+        } else {
+            try {
+                int intVal = RRuntime.string2intNoCheck(s, true);
+                return readIntVector(x, i, intVal, naStrings);
+            } catch (NumberFormatException ix) {
                 try {
-                    return readDoubleVector(x, i, doubleVal, naStrings);
-                } catch (NumberFormatException lx) {
-                    // fall through
-                }
-            } catch (NumberFormatException dx) {
-                try {
-                    byte logicalVal = RRuntime.string2logicalNoCheck(s, true);
+                    double doubleVal = RRuntime.string2doubleNoCheck(s, true);
                     try {
-                        return readLogicalVector(x, i, logicalVal, naStrings);
+                        return readDoubleVector(x, i, doubleVal, naStrings);
+                    } catch (NumberFormatException lx) {
+                        // fall through
+                    }
+                } catch (NumberFormatException dx) {
+                    try {
+                        byte logicalVal = RRuntime.string2logicalNoCheck(s, true);
+                        try {
+                            return readLogicalVector(x, i, logicalVal, naStrings);
+                        } catch (NumberFormatException lx) {
+                            // fall through
+                        }
                     } catch (NumberFormatException lx) {
                         // fall through
                     }
-                } catch (NumberFormatException lx) {
-                    // fall through
                 }
             }
         }
-
         // fall through target - conversion to int, double or logical failed
 
         if (asIs == RRuntime.LOGICAL_TRUE) {
diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java
index 4723391c1cf5ffb854e54e93e1f782cbb0120e17..4b3743e6598b9a5e6f38c20f7d4206c28af54290 100644
--- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java
+++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,5 +88,6 @@ public class ParserGeneration {
         "support ? for help",
         "support for hex float literals",
         "support for hex float literals without decimal point: 0x0p0",
+        "different warning for hex and dec integer literals"
     };
 }
diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g
index 78c92fcb0f7257ea1525b48384da9a7573b3ba7e..e30c5f77e93f06e835f9ed79e84535940fbac7eb 100644
--- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g
+++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g
@@ -4,7 +4,7 @@
  * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * Copyright (c) 2012-2014, Purdue University
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates
  *
  * All rights reserved.
  */
@@ -421,7 +421,9 @@ number returns [T v]
             $v = builder.constant(src($i), (int) value);
         } else {
             if ($i.text.indexOf('.') != -1) {
-                RError.warning(RError.NO_CALLER, RError.Message.INTEGER_VALUE_DECIAML, $i.text + "L");
+                RError.warning(RError.NO_CALLER, RError.Message.INTEGER_VALUE_DECIMAL, $i.text + "L");
+            } else if ($i.text.startsWith("0x")) {
+                RError.warning(RError.NO_CALLER, RError.Message.NON_INTEGER_VALUE, $i.text);
             } else {
                 RError.warning(RError.NO_CALLER, RError.Message.NON_INTEGER_VALUE, $i.text + "L");
             }
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java
index 51a817d01c891a0aca9fd10b710348bfe3c5bad9..4dc0d3ea79964500f619c71890b9937cea168c9b 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java
@@ -725,7 +725,7 @@ public final class RError extends RuntimeException {
         PRIM_GENERIC_NOT_FUNCTION("the formal definition of a primitive generic must be a function object (got type '%s')"),
         NON_INTEGER_VALUE("non-integer value %s qualified with L; using numeric value"),
         NON_INTEGER_N("non-integer %s = %f"),
-        INTEGER_VALUE_DECIAML("integer literal %s contains decimal; using numeric value"),
+        INTEGER_VALUE_DECIMAL("integer literal %s contains decimal; using numeric value"),
         INTEGER_VALUE_UNNECESARY_DECIMAL("integer literal %s contains unnecessary decimal point"),
         NON_LANG_ASSIGNMENT_TARGET("target of assignment expands to non-language object"),
         INVALID_LARGE_NA_VALUE("invalid '%s' value (too large or NA)"),
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java
index 4342d43ff2b671d87988cf957959583b2bc324f5..fcda893df18d824b9e459a9126d9e80313560589 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java
@@ -39,6 +39,7 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
 import com.oracle.truffle.r.runtime.env.frame.FrameSlotChangeMonitor;
+import java.math.BigInteger;
 
 public class RRuntime {
 
@@ -387,10 +388,15 @@ public class RRuntime {
         try {
             return Double.parseDouble(v);
         } catch (NumberFormatException e) {
-            if (v.startsWith("0x")) {
-                try {
-                    return int2double(Integer.decode(v));
-                } catch (NumberFormatException ein) {
+            if (hasHexPrefix(v)) {
+                switch (v.charAt(0)) {
+                    case '-':
+                        return -1 * new BigInteger(v.substring(3, v.length()), 16).doubleValue();
+                    case '+':
+                        return new BigInteger(v.substring(3, v.length()), 16).doubleValue();
+                    default:
+                        assert v.charAt(0) == '0';
+                        return new BigInteger(v.substring(2, v.length()), 16).doubleValue();
                 }
             }
             if (exceptionOnFail) {
@@ -400,6 +406,10 @@ public class RRuntime {
         return DOUBLE_NA;
     }
 
+    public static boolean hasHexPrefix(String s) {
+        return s.startsWith("0x") || s.startsWith("-0x") || s.startsWith("+0x");
+    }
+
     @TruffleBoundary
     public static double string2doubleNoCheck(String v) {
         return string2doubleNoCheck(v, false);
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test
index 105ccc56b2cb5a7d879956b7db2580716a9eee2c..b69fe6363cea325c1fe0f2c2c43fd62d13deb516 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test
@@ -136282,6 +136282,214 @@ NULL
 #type.convert(c(NA, '44.5'))
 [1]   NA 44.5
 
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('+0xFFF')
+[1] 4095
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('+0xFFFFFFFFFFF')
+[1] 1.759219e+13
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('+0xFFFFFFFFFFFL')
+[1] +0xFFFFFFFFFFFL
+Levels: +0xFFFFFFFFFFFL
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('+0xFFFL')
+[1] +0xFFFL
+Levels: +0xFFFL
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('+123')
+[1] 123
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('+123L')
+[1] +123L
+Levels: +123L
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('+2147483648')
+[1] 2147483648
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('+2147483648L')
+[1] +2147483648L
+Levels: +2147483648L
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('-0xFFF')
+[1] -4095
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('-0xFFFFFFFFFFF')
+[1] -1.759219e+13
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('-0xFFFFFFFFFFFL')
+[1] -0xFFFFFFFFFFFL
+Levels: -0xFFFFFFFFFFFL
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('-0xFFFL')
+[1] -0xFFFL
+Levels: -0xFFFL
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('-123')
+[1] -123
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('-123L')
+[1] -123L
+Levels: -123L
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('-2147483648')
+[1] -2147483648
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('-2147483648L')
+[1] -2147483648L
+Levels: -2147483648L
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('0xFFF')
+[1] 4095
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('0xFFFFFFFFFFF')
+[1] 1.759219e+13
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('0xFFFFFFFFFFFL')
+[1] 0xFFFFFFFFFFFL
+Levels: 0xFFFFFFFFFFFL
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('0xFFFL')
+[1] 0xFFFL
+Levels: 0xFFFL
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('123')
+[1] 123
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('123L')
+[1] 123L
+Levels: 123L
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('2147483648')
+[1] 2147483648
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#type.convert('2147483648L')
+[1] 2147483648L
+Levels: 2147483648L
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('+0xFFF'))
+[1] "double"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('+0xFFFFFFFFFFF'))
+[1] "double"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('+0xFFFFFFFFFFFL'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('+0xFFFL'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('+123'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('+123L'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('+2147483648'))
+[1] "double"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('+2147483648L'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('-0xFFF'))
+[1] "double"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('-0xFFFFFFFFFFF'))
+[1] "double"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('-0xFFFFFFFFFFFL'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('-0xFFFL'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('-123'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('-123L'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('-2147483648'))
+[1] "double"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('-2147483648L'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('0xFFF'))
+[1] "double"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('0xFFFFFFFFFFF'))
+[1] "double"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('0xFFFFFFFFFFFL'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('0xFFFL'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('123'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('123L'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('2147483648'))
+[1] "double"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testConvertLiterals#
+#typeof(type.convert('2147483648L'))
+[1] "integer"
+
+##com.oracle.truffle.r.test.library.utils.TestTypeConvert.testFirstTypeMustBeOfModeTest#Ignored.Unimplemented#
+#type.convert('NA', 1)
+Error in type.convert("NA", 1) : invalid 'na.strings' argument
+
 ##com.oracle.truffle.r.test.library.utils.TestUtils.testHeadNTail#
 #{head(letters)}
 [1] "a" "b" "c" "d" "e" "f"
@@ -136377,6 +136585,114 @@ see '?methods' for accessing help and source code
 #0xa.p2
 [1] 40
 
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#+0xFFF
+[1] 4095
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#+0xFFFFFFFFFFF
+[1] 1.759219e+13
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#+0xFFFFFFFFFFFL
+[1] 1.759219e+13
+Warning message:
+non-integer value 0xFFFFFFFFFFF qualified with L; using numeric value
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#+0xFFFL
+[1] 4095
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#-0xFFF
+[1] -4095
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#-0xFFFFFFFFFFF
+[1] -1.759219e+13
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#-0xFFFFFFFFFFFL
+[1] -1.759219e+13
+Warning message:
+non-integer value 0xFFFFFFFFFFF qualified with L; using numeric value
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#-0xFFFL
+[1] -4095
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#0xFFF
+[1] 4095
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#0xFFFFFFFFFFF
+[1] 1.759219e+13
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#0xFFFFFFFFFFFL
+[1] 1.759219e+13
+Warning message:
+non-integer value 0xFFFFFFFFFFF qualified with L; using numeric value
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#0xFFFL
+[1] 4095
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#typeof(+0xFFF)
+[1] "double"
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#typeof(+0xFFFFFFFFFFF)
+[1] "double"
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#typeof(+0xFFFFFFFFFFFL)
+[1] "double"
+Warning message:
+non-integer value 0xFFFFFFFFFFF qualified with L; using numeric value
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#typeof(+0xFFFL)
+[1] "integer"
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#typeof(-0xFFF)
+[1] "double"
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#typeof(-0xFFFFFFFFFFF)
+[1] "double"
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#typeof(-0xFFFFFFFFFFFL)
+[1] "double"
+Warning message:
+non-integer value 0xFFFFFFFFFFF qualified with L; using numeric value
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#typeof(-0xFFFL)
+[1] "integer"
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#typeof(0xFFF)
+[1] "double"
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#typeof(0xFFFFFFFFFFF)
+[1] "double"
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#typeof(0xFFFFFFFFFFFL)
+[1] "double"
+Warning message:
+non-integer value 0xFFFFFFFFFFF qualified with L; using numeric value
+
+##com.oracle.truffle.r.test.parser.TestParser.testHexLiterals#
+#typeof(0xFFFL)
+[1] "integer"
+
 ##com.oracle.truffle.r.test.parser.TestParser.testLexerError#Output.IgnoreErrorMessage#
 #%0
 Error: unexpected input in "%0"
@@ -136454,6 +136770,48 @@ Error: unexpected '*' in:
 ##com.oracle.truffle.r.test.parser.TestParser.testNewLinesNesting#
 #y <- 2; z <- 5; x <- ({y +<<<NEWLINE>>>  z})
 
+##com.oracle.truffle.r.test.parser.TestParser.testNonIntegerQualifiedWithLWarning#Ignored.OutputFormatting#
+#0xFFFFFFFFFFFL<<<NEWLINE>>>0xFFFFFFFFFFFL
+[1] 1.759219e+13
+Warning message:
+non-integer value 0xFFFFFFFFFFF qualified with L; using numeric value
+[1] 1.759219e+13
+Warning message:
+non-integer value 0xFFFFFFFFFFF qualified with L; using numeric value
+
+##com.oracle.truffle.r.test.parser.TestParser.testNonIntegerQualifiedWithLWarning#Ignored.OutputFormatting#
+#0xFFFFFFFFFFFL; 0xFFFFFFFFFFFL; 0xFFFFFFFFFFFL
+[1] 1.759219e+13
+Warning message:
+non-integer value 0xFFFFFFFFFFF qualified with L; using numeric value
+[1] 1.759219e+13
+Warning message:
+non-integer value 0xFFFFFFFFFFF qualified with L; using numeric value
+[1] 1.759219e+13
+Warning message:
+non-integer value 0xFFFFFFFFFFF qualified with L; using numeric value
+
+##com.oracle.truffle.r.test.parser.TestParser.testNonIntegerQualifiedWithLWarning#Ignored.OutputFormatting#
+#123456789098765432121L<<<NEWLINE>>>123456789098765432121L
+[1] 1.234568e+20
+Warning message:
+non-integer value 123456789098765432121L qualified with L; using numeric value
+[1] 1.234568e+20
+Warning message:
+non-integer value 123456789098765432121L qualified with L; using numeric value
+
+##com.oracle.truffle.r.test.parser.TestParser.testNonIntegerQualifiedWithLWarning#Ignored.OutputFormatting#
+#12345678909876543212L; 12345678909876543212L; 12345678909876543212L
+[1] 1.234568e+19
+Warning message:
+non-integer value 12345678909876543212L qualified with L; using numeric value
+[1] 1.234568e+19
+Warning message:
+non-integer value 12345678909876543212L qualified with L; using numeric value
+[1] 1.234568e+19
+Warning message:
+non-integer value 12345678909876543212L qualified with L; using numeric value
+
 ##com.oracle.truffle.r.test.parser.TestParser.testOpName#
 #{ "%??%" <- function(x,y) x + y; 7 %??% 42 }
 [1] 49
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestTypeConvert.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestTypeConvert.java
index bc17a53675c0835d35dd2890716885b057e9656a..972ac0da24429ada9a1df550e8466f806b13cf2b 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestTypeConvert.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestTypeConvert.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,4 +39,23 @@ public class TestTypeConvert extends TestBase {
         // looks like integer, but is double (because it would be INT_NA)
         assertEval("type.convert('-2147483648')");
     }
+
+    private static final String[] LIT_VALUES = new String[]{"0xFFF", "0xFFFFFFFFFFF", "123", "2147483648"};
+
+    @Test
+    public void testConvertLiterals() {
+        for (String suf : new String[]{"", "L"}) {
+            for (String sign : new String[]{"", "-", "+"}) {
+                String l = sign + "%0" + suf;
+                assertEval(template("type.convert('" + l + "')", LIT_VALUES));
+                assertEval(template("typeof(type.convert('" + l + "'))", LIT_VALUES));
+            }
+        }
+    }
+
+    @Test
+    public void testFirstTypeMustBeOfModeTest() {
+        // UnsupportedSpecializationException: Unexpected values provided for ...
+        assertEval(Ignored.Unimplemented, "type.convert('NA', 1)");
+    }
 }
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/parser/TestParser.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/parser/TestParser.java
index eec0fb6933b2b887143e19524bb5c7f5fcf6ab09..c68a0188632178498a05af8e4ae893ddfe2fa08b 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/parser/TestParser.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/parser/TestParser.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,6 +61,27 @@ public class TestParser extends TestBase {
         assertEval("0xa.bp1i");
     }
 
+    private static final String[] HEX_VALUES = new String[]{"0xFFF", "0xFFFFFFFFFFF"};
+
+    @Test
+    public void testHexLiterals() {
+        for (String sign : new String[]{"", "-", "+"}) {
+            for (String suffix : new String[]{"", "L"}) {
+                String l = sign + "%0" + suffix;
+                assertEval(template(l, HEX_VALUES));
+                assertEval(template("typeof(" + l + ")", HEX_VALUES));
+            }
+        }
+    }
+
+    @Test
+    public void testNonIntegerQualifiedWithLWarning() {
+        assertEval(Ignored.OutputFormatting, "12345678909876543212L; 12345678909876543212L; 12345678909876543212L");
+        assertEval(Ignored.OutputFormatting, "123456789098765432121L\n123456789098765432121L");
+        assertEval(Ignored.OutputFormatting, "0xFFFFFFFFFFFL; 0xFFFFFFFFFFFL; 0xFFFFFFFFFFFL");
+        assertEval(Ignored.OutputFormatting, "0xFFFFFFFFFFFL\n0xFFFFFFFFFFFL");
+    }
+
     @Test
     public void testSpaceEscapeSequence() {
         assertEval("\"\\ \" == \" \"");