Double-quote non-syntactic names in combined importFrom() - #1924
Merged
Merged
Conversation
roxygen2 8.x merges `@importFrom` tags into one directive per package, but a base R bug in `parseNamespaceFile()` only strips backticks from the *first* name in an `importFrom()` directive (`as.character()` on a call object takes the head verbatim but deparses the rest). Backticked names like `` `model<-` `` in position 2+ were recorded with literal backticks and failed installation with "object '`model<-`' is not exported". Normalise all import names to double quotes, which parse correctly in any position, and dedupe equivalent quoting forms while at it. Fixes #1915.
hadley
force-pushed
the
fix-importfrom-nonsyntactic
branch
from
October 2, 2026 12:53
04145b3 to
4abeb7c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1915.
roxygen2 8.x merges
@importFromtags into a single directive per package (to fix aloadNamespace()performance issue). But this exposed a base R bug inparseNamespaceFile(): it converts the import names withas.character()on a call object, which takes the first element verbatim but deparses the rest — and deparse adds backticks around non-syntactic names:We fix this by normalising all names to double quotes, which parse correctly in any position:
Apart from tests, also verified end-to-end locally with a minimal package with the generated
importFrom(rxode2,\n "model<-",\n RxODE\n)installs cleanly against the real rxode2.