Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by roxygen2: do not edit by hand

S3method(conditionMessage,lifecycle_stage)
S3method(print,lifecycle_warnings)
export(badge)
export(deprecate_soft)
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# lifecycle (development version)

* `signal_stage()` is now deprecated. This was never hooked up to anything, and our original ideas for it never panned out, so the overhead it entails no longer feels worth it.
* `signal_stage()` no longer does anything, and is now purely a way to express intent at the call site of whether a function is superseded or experimental (#203).

* `deprecate_soft()` and `deprecate_warn()` are faster thanks to some internal refactoring (#191, #194, #195, #201).

Expand Down
93 changes: 0 additions & 93 deletions R/deprecated-signal.R

This file was deleted.

64 changes: 64 additions & 0 deletions R/signal.R
Copy link
Member Author

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

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)
}
5 changes: 1 addition & 4 deletions man/deprecated-signallers.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions man/signal_stage.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 0 additions & 48 deletions tests/testthat/_snaps/deprecated-signal.md

This file was deleted.

18 changes: 18 additions & 0 deletions tests/testthat/_snaps/signal.md
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.

45 changes: 0 additions & 45 deletions tests/testthat/test-deprecated-signal.R

This file was deleted.

12 changes: 12 additions & 0 deletions tests/testthat/test-signal.R
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()")
})
})