You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
debugSource() throws a warning when getOption("keep.source") is FALSE #12375
debugSource() throws a warning when options(keep.source = FALSE):
> debugSource(this.path())
> LINENO()
[1] NA
Warning message:
In structure(c(refs[[1]][1], refs[[1]][2], refs[[lastref]][3], refs[[lastref]][[4]], :
Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
Consider 'structure(list(), *)' instead.
>
I think this is easily fixed in .rs.makeSourceEquivFunction(), right after refs <- attr(content, "srcref"), by adding something like:
if (is.null(srcref))
return(fun)
I'm not sure if this has any further implications for other functions in RStudio, but I'd imagine something similar could be added to those as well. Thank you!
> options(keep.source = FALSE)
> rfile <- tempfile(fileext = ".R")
> writeLines("print('Hello, world!')", con = rfile)
> debugSource(rfile)
Warning in structure(c(refs[[1]][1], refs[[1]][2], refs[[lastref]][3], refs[[lastref]][[4]], :
Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
Consider 'structure(list(), *)' instead.
[1] "Hello, world!"
Internal note: options(keep.source = FALSE) is not the default, but might be set by R users in order to save a bit of extra memory in the R session (at the cost of losing source references, IIUC)
Activity
kevinushey commentedon Jan 9, 2023
Thanks for the bug report. To confirm, here's a small reproducible example:
When executed, I see:
Internal note:
options(keep.source = FALSE)is not the default, but might be set by R users in order to save a bit of extra memory in the R session (at the cost of losing source references, IIUC)AzazelSensei commentedon Aug 29, 2026
Opened #18686. makeSourceEquivFunction now returns before wiring srcrefs when parse() leaves them NULL.
Reset NEWS.md to main's 2026.11 notes plus the rstudio#12375 entry
run debugSource() on files without source references (#19284)