Skip to content
Snippets Groups Projects
Commit 07e9dc52 authored by Florian Angerer's avatar Florian Angerer
Browse files

Fix: Invalid argument matching for primitive functions with different or implicit signature.

parent f60694d7
Branches
No related tags found
No related merge requests found
...@@ -44,7 +44,6 @@ import com.oracle.truffle.r.nodes.builtin.base.FrameFunctions.SysFrame; ...@@ -44,7 +44,6 @@ import com.oracle.truffle.r.nodes.builtin.base.FrameFunctions.SysFrame;
import com.oracle.truffle.r.nodes.builtin.base.GetFunctions.Get; import com.oracle.truffle.r.nodes.builtin.base.GetFunctions.Get;
import com.oracle.truffle.r.nodes.builtin.base.GetFunctionsFactory.GetNodeGen; import com.oracle.truffle.r.nodes.builtin.base.GetFunctionsFactory.GetNodeGen;
import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode;
import com.oracle.truffle.r.runtime.RArguments;
import com.oracle.truffle.r.runtime.RCaller; import com.oracle.truffle.r.runtime.RCaller;
import com.oracle.truffle.r.runtime.RType; import com.oracle.truffle.r.runtime.RType;
import com.oracle.truffle.r.runtime.ReturnException; import com.oracle.truffle.r.runtime.ReturnException;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Copyright (c) 1995, 1996, 1997 Robert Gentleman and Ross Ihaka * Copyright (c) 1995, 1996, 1997 Robert Gentleman and Ross Ihaka
* Copyright (c) 1995-2014, The R Core Team * Copyright (c) 1995-2014, The R Core Team
* Copyright (c) 2002-2008, The R Foundation * Copyright (c) 2002-2008, The R Foundation
* Copyright (c) 2015, 2016, Oracle and/or its affiliates * Copyright (c) 2015, 2017, Oracle and/or its affiliates
* *
* All rights reserved. * All rights reserved.
*/ */
...@@ -14,14 +14,12 @@ package com.oracle.truffle.r.nodes.objects; ...@@ -14,14 +14,12 @@ package com.oracle.truffle.r.nodes.objects;
import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.r.nodes.RRootNode;
import com.oracle.truffle.r.nodes.access.variables.LocalReadVariableNode; import com.oracle.truffle.r.nodes.access.variables.LocalReadVariableNode;
import com.oracle.truffle.r.nodes.access.variables.ReadVariableNode; import com.oracle.truffle.r.nodes.access.variables.ReadVariableNode;
import com.oracle.truffle.r.nodes.function.CallMatcherNode; import com.oracle.truffle.r.nodes.function.CallMatcherNode;
import com.oracle.truffle.r.nodes.function.FormalArguments;
import com.oracle.truffle.r.nodes.function.signature.CollectArgumentsNode; import com.oracle.truffle.r.nodes.function.signature.CollectArgumentsNode;
import com.oracle.truffle.r.nodes.function.signature.CollectArgumentsNodeGen; import com.oracle.truffle.r.nodes.function.signature.CollectArgumentsNodeGen;
import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.RArguments;
import com.oracle.truffle.r.runtime.RArguments.S4Args; import com.oracle.truffle.r.runtime.RArguments.S4Args;
import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.RRuntime;
import com.oracle.truffle.r.runtime.data.RFunction; import com.oracle.truffle.r.runtime.data.RFunction;
...@@ -45,12 +43,8 @@ final class ExecuteMethod extends RBaseNode { ...@@ -45,12 +43,8 @@ final class ExecuteMethod extends RBaseNode {
callMatcher = insert(CallMatcherNode.create(false)); callMatcher = insert(CallMatcherNode.create(false));
} }
FormalArguments formals = ((RRootNode) fdef.getRootNode()).getFormalArguments();
ArgumentsSignature signature = formals.getSignature();
Object[] oldArgs = collectArgs.execute(frame, signature);
S4Args s4Args = new S4Args(readDefined.execute(frame), readMethod.execute(frame), readTarget.execute(frame), readGeneric.execute(frame), readMethods.execute(frame)); S4Args s4Args = new S4Args(readDefined.execute(frame), readMethod.execute(frame), readTarget.execute(frame), readGeneric.execute(frame), readMethods.execute(frame));
return callMatcher.execute(frame, signature, oldArgs, fdef, fname, s4Args); return callMatcher.execute(frame, RArguments.getSignature(frame), RArguments.getArguments(frame), fdef, fname, s4Args);
} }
} }
...@@ -60,7 +60,7 @@ Error: invalid assignment for reference class field ‘a’, should be from clas ...@@ -60,7 +60,7 @@ Error: invalid assignment for reference class field ‘a’, should be from clas
[1] TRUE [1] TRUE
[1] TRUE [1] TRUE
   
##com.oracle.truffle.r.test.S4.TestR5.testFieldAccess#Output.IgnoreWhitespace# ##com.oracle.truffle.r.test.S4.TestR5.testFieldAccess#Ignored.OutputFormatting#
#print(suppressMessages({clazz <- setRefClass('Foo20R5', methods = list(foo = function() NULL)); clazz$methods('foo')})) #print(suppressMessages({clazz <- setRefClass('Foo20R5', methods = list(foo = function() NULL)); clazz$methods('foo')}))
function() NULL function() NULL
attr(,"mayCall") attr(,"mayCall")
...@@ -745,6 +745,10 @@ Error in (function (cl, name, valueClass) : ...@@ -745,6 +745,10 @@ Error in (function (cl, name, valueClass) :
##com.oracle.truffle.r.test.S4.TestS4.testSlotUpdate# ##com.oracle.truffle.r.test.S4.TestS4.testSlotUpdate#
#{ x<-initialize@valueClass; initialize@valueClass<-"foo"; initialize@valueClass<-x } #{ x<-initialize@valueClass; initialize@valueClass<-"foo"; initialize@valueClass<-x }
   
##com.oracle.truffle.r.test.S4.TestS4.testStdGeneric#
#{ setClass('A4', representation(a = 'numeric')); setMethod('[[', 'A4', function(x, i, j, ...) NULL); obj <- new('A4'); obj[[1]] }
NULL
##com.oracle.truffle.r.test.S4.TestS4.testStdGeneric# ##com.oracle.truffle.r.test.S4.TestS4.testStdGeneric#
#{ standardGeneric("") } #{ standardGeneric("") }
Error in standardGeneric("") : Error in standardGeneric("") :
...@@ -62345,7 +62349,7 @@ Error in seq.int(NaN) : 'from' cannot be NA, NaN or infinite ...@@ -62345,7 +62349,7 @@ Error in seq.int(NaN) : 'from' cannot be NA, NaN or infinite
#argv <- list(from = 0, to = 0.793110173512391, length.out = FALSE);do.call('seq.int', argv); #argv <- list(from = 0, to = 0.793110173512391, length.out = FALSE);do.call('seq.int', argv);
integer(0) integer(0)
   
##com.oracle.truffle.r.test.builtins.TestBuiltin_serialize.testserialize# ##com.oracle.truffle.r.test.builtins.TestBuiltin_serialize.testserialize#Ignored.ImplementationError#
#options(keep.source=FALSE); fc <- setClass('FooSerial1', representation(a = 'call')); serialize(fc, connection=NULL) #options(keep.source=FALSE); fc <- setClass('FooSerial1', representation(a = 'call')); serialize(fc, connection=NULL)
[1] 58 0a 00 00 00 02 00 03 03 02 00 02 03 00 00 01 07 03 00 00 04 02 00 00 00 [1] 58 0a 00 00 00 02 00 03 03 02 00 02 03 00 00 01 07 03 00 00 04 02 00 00 00
[26] 01 00 04 00 09 00 00 00 09 63 6c 61 73 73 4e 61 6d 65 00 00 02 10 00 00 00 [26] 01 00 04 00 09 00 00 00 09 63 6c 61 73 73 4e 61 6d 65 00 00 02 10 00 00 00
...@@ -142,6 +142,7 @@ public class TestS4 extends TestRBase { ...@@ -142,6 +142,7 @@ public class TestS4 extends TestRBase {
assertEval("{ standardGeneric(\"\") }"); assertEval("{ standardGeneric(\"\") }");
assertEval(Output.IgnoreErrorContext, "{ standardGeneric(\"foo\", 42) }"); assertEval(Output.IgnoreErrorContext, "{ standardGeneric(\"foo\", 42) }");
assertEval(Output.IgnoreErrorContext, "{ x<-42; class(x)<-character(); standardGeneric(\"foo\", x) }"); assertEval(Output.IgnoreErrorContext, "{ x<-42; class(x)<-character(); standardGeneric(\"foo\", x) }");
assertEval("{ setClass('A4', representation(a = 'numeric')); setMethod('[[', 'A4', function(x, i, j, ...) NULL); obj <- new('A4'); obj[[1]] }");
} }
@Test @Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment