-
Notifications
You must be signed in to change notification settings - Fork 26
Bring back fast signal_stage()
#203
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#' Signal other experimental or superseded features | ||
#' | ||
#' @description | ||
#' `r badge("experimental")` | ||
#' | ||
#' `signal_stage()` allows you to signal life cycle stages other than | ||
#' deprecation (for which you should use [deprecate_warn()] and friends). There | ||
#' is no behaviour associated with this signal, it is currently purely a way to | ||
#' express intent at the call site. In the future, we hope to replace this with | ||
#' a standardized call to `base::declare()`. | ||
#' | ||
#' @param stage Life cycle stage, either `"experimental"` or `"superseded"`. | ||
#' | ||
#' @param what String describing what feature the stage applies too, using the | ||
#' same syntax as [deprecate_warn()]. | ||
#' | ||
#' @param with An optional string giving a recommended replacement for a | ||
#' superseded function. | ||
#' | ||
#' @param env `r badge("deprecated")` | ||
#' | ||
#' @export | ||
#' @examples | ||
#' foofy <- function(x, y, z) { | ||
#' signal_stage("experimental", "foofy()") | ||
#' x + y / z | ||
#' } | ||
#' foofy(1, 2, 3) | ||
signal_stage <- function(stage, what, with = NULL, env = deprecated()) { | ||
# Does nothing | ||
invisible() | ||
} | ||
|
||
#' Deprecated functions for signalling lifecycle stages | ||
#' | ||
#' @description | ||
#' `r badge("deprecated")` | ||
#' @name deprecated-signallers | ||
#' @keywords internal | ||
NULL | ||
|
||
#' @rdname deprecated-signallers | ||
#' @export | ||
signal_experimental <- function(when, what, env = caller_env()) { | ||
deprecate_soft( | ||
"1.1.0", | ||
what = "signal_experimental()", | ||
with = "signal_stage()", | ||
id = "lifecycle_signal_experimental" | ||
) | ||
signal_stage("experimental", what) | ||
} | ||
|
||
#' @rdname deprecated-signallers | ||
#' @export | ||
signal_superseded <- function(when, what, env = caller_env()) { | ||
deprecate_soft( | ||
"1.1.0", | ||
what = "signal_superseded()", | ||
with = "signal_stage()", | ||
id = "lifecycle_signal_superseded" | ||
) | ||
signal_stage("superseded", what) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# `signal_experimental()` and `signal_superseded()` are deprecated | ||
|
||
Code | ||
signal_experimental("1.1.0", "foo()") | ||
Condition | ||
Warning: | ||
`signal_experimental()` was deprecated in lifecycle 1.1.0. | ||
i Please use `signal_stage()` instead. | ||
|
||
--- | ||
|
||
Code | ||
signal_superseded("1.1.0", "foo()") | ||
Condition | ||
Warning: | ||
`signal_superseded()` was deprecated in lifecycle 1.1.0. | ||
i Please use `signal_stage()` instead. | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
test_that("`signal_stage()` does nothing", { | ||
expect_null(signal_stage("experimental", "pkg::foo(bar = 'baz')"), NULL) | ||
}) | ||
|
||
test_that("`signal_experimental()` and `signal_superseded()` are deprecated", { | ||
expect_snapshot({ | ||
signal_experimental("1.1.0", "foo()") | ||
}) | ||
expect_snapshot({ | ||
signal_superseded("1.1.0", "foo()") | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately git diff thinks this is a "new" file