Skip to content

Usage for replacement S3 methods: generic without <-, value on the right - #43

Merged
TroyHernandez merged 2 commits into
mainfrom
s3-replacement-usage
Oct 6, 2026
Merged

TroyHernandez merged 2 commits into
mainfrom
s3-replacement-usage

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

format_usage() tested for a replacement function with grepl("<-$", name). A replacement S3 method's name is $<-.myclass: the <- sits on the generic and the class follows, so the test never fired and the usage came out as

\method{$<-}{myclass}(x, name, value)

which R CMD check reports under "checking Rd \usage sections ... WARNING" as a bad \usage line. When detect_s3_method() finds a method, the replacement test now looks at the generic, and the result is what R expects:

\method{$}{myclass}(x, name) <- value

Tests for $<-, [[<-, dim<- methods and a package-defined replacement generic. Found through glinty's two output-registration methods, whose pages had carried the bad lines since they were first generated.

`$<-.myclass` was formatted as \method{$<-}{myclass}(x, name, value),
which R CMD check reports as a bad \usage line. The replacement test
looked for a trailing <- on the whole name, which a method's class
suffix hides; it looks at the generic now. Found in glinty.
TroyHernandez added a commit to cornball-ai/glinty that referenced this pull request Oct 6, 2026
…usage (#97)

* R CMD check clean: ASCII-only code, build-ignore sandbox and PROTOCOL.md, replacement-method usage

- The two non-ASCII literals (the feed's jump arrow, the markdown
  bullet) are spelled with intToUtf8(); R CMD check wants portable
  packages ASCII-only outside comments.
- sandbox/ and PROTOCOL.md are build-ignored: both stay in the repo,
  neither belongs in the tarball (hidden-file and top-level NOTEs).
- The usage lines of $<-.glinty_output and [[<-.glinty_output come
  out as \method{$}{glinty_output}(x, name) <- value, regenerated
  with tinyrox 0.4.1.3 (cornball-ai/tinyrox#43), which fixes the
  formatting of replacement S3 methods at the root. The explicit
  @Usage lines in R/output.R document the intent; tinyrox skips the
  tag.
- CI sets _R_CHECK_CRAN_INCOMING_=false, as veleta does: glinty is not
  on CRAN, so the "New submission" NOTE is structural.

* Drop the @Usage tags tinyrox does not read

tinyrox 0.4.1.3 formats the replacement methods correctly from their
formals; the tag only drew an unknown-tag warning on every document().
@TroyHernandez
TroyHernandez merged commit 7d2d557 into main Oct 6, 2026
2 checks passed
@TroyHernandez
TroyHernandez deleted the s3-replacement-usage branch October 6, 2026 00:57
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.

1 participant