Displaying 1 result from an estimated 1 matches for "testnosrc".
2017 Dec 11
1
possible bug in utils::removeSource - NULL argument is silently dropped
...ULL argument
foo <- function(x, y) {
if (is.null(y)) y <- "default foo"
attr(x, "foo") <- y
x
}
# create a function which utilizes 'foo'
testSrc <- function() {
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]]...