oracle / fastr

A high-performance implementation of the R programming language, built on GraalVM.
Other
623 stars 64 forks source link

throws 'invalid or unimplemented arguments' when argument name is special #36

Closed comicfans closed 5 years ago

comicfans commented 5 years ago

running following code leads fastR throw

Error in forceAndCall(1, FUN, newX[, i], ...) : invalid or unimplemented arguments

func <- function(x, n) {
    return (x)
}
ary <- array(1,dim=c(2,3))
apply(ary, c(2), func, n = 1)

but if change second argument name of func from 'n' to 'n1', 'n2', 'nq' or something else, fastR gives correct result for example:

func <- function(x, nq) {
    return (x)
}
ary <- array(1,dim=c(2,3))
apply(ary, c(2), func, nq = 3)

(I'm on fastR ee11fce71b2 )

steve-s commented 5 years ago

Hi comicfans,

thanks for reporting this issue. It seems that GNU-R does not match arguments of primitive functions by name. An even simpler example is:

as.character(3, x=42)

gives 3 in GNU-R, but 42 in FastR. However, there are some special arguments matched by name, e.g. drop argument of [. We are working on a fix.

steve-s commented 5 years ago

Should be fixed by abdce2eccc7361c6eaff88a50cb97e101996da4f