r-lib/pkgload

load_all() removes methods provided by downstream packages without a warning

krlmlr opened this issue · 4 comments

pkgload::load_all("~/git/R/pillar")
#> ℹ Loading pillar
tbl_sum(tibble::tibble(a = 1))
#> A tibble 
#>  "1 x 1"
pkgload::load_all("~/git/R/pillar")
#> ℹ Loading pillar
tbl_sum(tibble::tibble(a = 1))
#> A data frame 
#>      "1 × 1"

Created on 2021-06-05 by the reprex package (v2.0.0)

tbl_sum.tbl_df() is provided by the tibble package, tbl_sum.tbl() is provided by pillar. It looks like the second load_all() somehow invaldiates the method registration. This happens on Ubuntu and on macOS M1.

This also happens in R 3.6 and R 4.0. Earlier versions of pkgload issue a warning, with v1.1.0 (63d383c) I see:

unloadNamespace("pillar") not successful, probably because another loaded package depends on it. Forcing unload. If you encounter problems, please restart R.

Even if we can't fix the problem, restoring the warning would be very nice.

Downstream issue: r-lib/pillar#330.

This warning was removed in #145, you can see there the reasons it was removed.

Thanks. Let's fix the problem then.

Should load_all() perhaps copy registration info for methods provided by other packages?