Displaying 1 result from an estimated 1 matches for "sourceutil".
Did you mean:
sourceutils
2017 Dec 11
1
possible bug in utils::removeSource - NULL argument is silently dropped
...ction() {
x <- 1:3
x <- foo(x, NULL)
x
}
# this works fine
testSrc()
# this fails
testNoSrc <- utils::removeSource(testSrc)
testNoSrc()
# removeSource removes NULL from the 'foo' call
print(testNoSrc)
---
I traced back the bug to this row in removeSource:
(line 33 in sourceutils.R)
part[[i]] <- recurse(part[[i]])
it should be (IMHO):
part[i] <- list(recurse(part[[i]]))
---
# create a function with the above patch
rmSource <- function (fn) {
stopifnot(is.function(fn))
if (is.primitive(fn))
return(fn)
attr(fn, "srcref") <- NULL
attr...