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

Inaccurate error message in lifecycle::deprecate_soft() and lifecycle::deprecate_warn() #152

Open
hpages opened this issue Dec 6, 2022 · 0 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@hpages
Copy link

hpages commented Dec 6, 2022

While I was playing around with lifecycle::deprecate_soft() before opening issue #150, I ran into the following:

library(lifecycle)

options(lifecycle_verbosity="warning")

lifecycle::deprecate_soft(when="1.0.0", what="foo()")
# Warning message:
# `foo()` was deprecated in <NA> 1.0.0.
# Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
# generated. 

All good.

But then:

lifecycle::deprecate_soft(when="1.0.0", what="foo()", with="bar")
# Error in `lifecycle_message()`:
# ! `what` must have function call syntax.
# 
#   # Good:
#   deprecate_soft("bar()")
# 
#   # Bad:
#   deprecate_soft("bar")
# Run `rlang::last_error()` to see where the error occurred.

Error should be "! `with` must have function call syntax" instead of "! `what` must have function call syntax".

lifecycle::deprecate_warn() has the same problem.

Best,
H.

**sessionInfo()**: ``` > sessionInfo() R version 4.2.0 Patched (2022-05-04 r82318) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 22.04.1 LTS

Matrix products: default
BLAS: /home/hpages/R/R-4.2.r82318/lib/libRblas.so
LAPACK: /home/hpages/R/R-4.2.r82318/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] lifecycle_1.0.3

loaded via a namespace (and not attached):
[1] compiler_4.2.0 cli_3.4.1 glue_1.6.2 crayon_1.5.2 rlang_1.0.6

</details>
@hadley hadley added the bug an unexpected problem or unintended behavior label Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants