Skip to content
Snippets Groups Projects
Commit 76ee7f0e authored by stepan's avatar stepan
Browse files

Deparse in BinaryBooleanNode removes backticks, e.g. around `+`

parent fb1dcf4c
No related branches found
No related tags found
No related merge requests found
......@@ -134,15 +134,19 @@ public abstract class BinaryBooleanNode extends RBuiltinNode {
@Cached("createRecursive()") BinaryBooleanNode recursive) {
Object recursiveLeft = left;
if (isSymbolOrLang(left)) {
recursiveLeft = RString.valueOf(RDeparse.deparse(left));
recursiveLeft = deparseSymbolOrLang(left);
}
Object recursiveRight = right;
if (isSymbolOrLang(right)) {
recursiveRight = RString.valueOf(RDeparse.deparse(right));
recursiveRight = deparseSymbolOrLang(right);
}
return recursive.execute(frame, recursiveLeft, recursiveRight);
}
private static RString deparseSymbolOrLang(Object val) {
return RString.valueOf(RDeparse.deparse(val, RDeparse.MAX_Cutoff, false, RDeparse.KEEPINTEGER, -1));
}
protected BinaryBooleanNode createRecursive() {
return BinaryBooleanNode.create(factory);
}
......
......@@ -34312,6 +34312,14 @@ NULL
[1] "some"
[1] "test"
 
##com.oracle.truffle.r.test.builtins.TestBuiltin_operators.testBinaryOperators#
#as.symbol('*') == '*'
[1] TRUE
##com.oracle.truffle.r.test.builtins.TestBuiltin_operators.testBinaryOperators#
#as.symbol('<-') == '<-'
[1] TRUE
##com.oracle.truffle.r.test.builtins.TestBuiltin_operators.testColon#
#8.2:NULL
Error in 8.2:NULL : argument of length 0
......@@ -1926,6 +1926,13 @@ public class TestBuiltin_operators extends TestBase {
"data[c('a','b')] + 1; 1 + data[c('a','b')]; data[c('a','b')] + c(1,2); c(1,2) + data[c('a','b')]");
}
@Test
public void testBooleanOperators() {
// tests that deparse in as.symbol removes backticks
assertEval("as.symbol('*') == '*'");
assertEval("as.symbol('<-') == '<-'");
}
@Test
public void testOperators() {
assertEval("{ `+`(1,2) }");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment