Skip to content

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

@hpages

Description

@hpages

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions