Skip to content

pars(terms =) now reports as defunct for every input type - #109

Merged
joethorley merged 1 commit into
mainfrom
fix-pars-terms-defunct-message
Aug 31, 2026
Merged

joethorley merged 1 commit into
mainfrom
fix-pars-terms-defunct-message

Conversation

@joethorley

Copy link
Copy Markdown
Member

Closes #108

Only pars.term() carried terms as a formal, so every other method absorbed it into ... and failed with chk_unused()'s message, which named neither the defunct argument nor its replacement:

pars(term("a[1]"), terms = TRUE)
#> Error: The `terms` argument of `pars()` was deprecated in term 0.2.0 and is now defunct.

pars(c("a[1]"), terms = TRUE)
#> Error: `...` must be unused.

0.4.0 escalated this argument from a warning to a hard error, so this is precisely when people are migrating call sites. Character input is the likely case in practice, since pars() accepts it directly.

Approach

stop_defunct_terms() checks ...names() for terms and raises the same deprecate_stop() error. It is called before chk_unused() in pars.default(), pars.character() and pars.term_rcrd(); pars.term() is unchanged, as its formal already handles it.

Intercepting ... rather than adding a terms formal to the other three methods keeps the defunct argument out of their signatures and so out of their \usage sections.

...names() needs R >= 4.1, which DESCRIPTION already requires.

Verification

All five input paths now give the same message:

call before after
pars(term("a[1]"), terms = TRUE) defunct error defunct error
pars(term("a[1]"), terms = FALSE) defunct error defunct error
pars(c("a[1]"), terms = TRUE) ... must be unused defunct error
pars(as_term_rcrd(...), terms = TRUE) ... must be unused defunct error
pars(matrix(1:4, nrow = 2), terms = TRUE) ... must be unused defunct error

The change is deliberately narrow, and a second test pins that down: genuinely unused arguments still report as unused.

pars(c("a[1]"), nope = TRUE)
#> Error in `pars.character()`: `...` must be unused.

devtools::test() 574 pass, 0 fail. devtools::check() 0 errors, 0 warnings, 0 notes.

Notes

NEWS.md is fledge-generated, so it is not edited here; the commit subject is written to serve as the release note.

Out of scope, but worth a look separately: npdims() had its own terms argument retired in 0.3.0 and carries no equivalent handling, so it may have the same gap.

… `term` vectors (#108)

Only `pars.term()` carried `terms` as a formal, so `pars.default()`,
`pars.character()` and `pars.term_rcrd()` absorbed it into `...` and failed
with "`...` must be unused", which named neither the defunct argument nor the
`pars_terms()` replacement. 0.4.0 escalated this argument to a hard error, so
this is exactly when call sites are being migrated.

Intercept `terms` in `...` before `chk_unused()` and raise the same
`deprecate_stop()` error. Kept narrow: other unused arguments still report as
unused, covered by a test.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@joethorley
joethorley merged commit d5fd9a0 into main Aug 31, 2026
9 checks passed
@joethorley
joethorley deleted the fix-pars-terms-defunct-message branch August 31, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pars(terms =) defunct message only reaches term input, not character or term_rcrd

1 participant