Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning Message Appears When Reloading a Module #363

Open
thothal opened this issue May 2, 2024 · 0 comments
Open

Warning Message Appears When Reloading a Module #363

thothal opened this issue May 2, 2024 · 0 comments

Comments

@thothal
Copy link

thothal commented May 2, 2024

Error description

Assume the following modules:

dbg/a.R

#' Title
#' @export
a <- function() {
  print("I am a")
}

dbg/b.R

box::use(dbg/a)
#' Title
#' @export
b <- function() {
  print("I am b and call a")
  a$a()
}

dbg/c.R

box::use(dbg/a)
box::use(dbg/b)

#' Title
#' @export
c <- function() {
  print("I am c and call a and b")
  a$a()
  b$b()
}

When trying to reload module c you get the following error:

box::use(dbg/c)
box::reload(c)
# Warning message:
# In rm(list = info$source_path, envir = loaded_mods) :
#   object '<path stripped>\\dbg\\a.R' not found

Issue lies within box:::deregister_mod where we try to remove the module. Because it is loaded twice (once via dbg/b and once via dbg/c) the second attempt to delete it will eventually raise the warning, which I consider spurious.

Easy fix would be to muffle it or to include some chekc to see whether the module is still in loaded_mods.

R version

_                                
platform       x86_64-w64-mingw32               
arch           x86_64                           
os             mingw32                          
crt            ucrt                             
system         x86_64, mingw32                  
status                                          
major          4                                
minor          2.2                              
year           2022                             
month          10                               
day            31                               
svn rev        83211                            
language       R                                
version.string R version 4.2.2 (2022-10-31 ucrt)
nickname       Innocent and Trusting

‘box’ version

1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant