Repository navigation
Preserve method argument expressions on R before 4.4 - #785
Merged
Merged
Conversation
Forward method arguments through dots so errors, warnings, and tracebacks record symbolic calls without evaluating argument promises. This also avoids the deparser failure on R 4.3. Restore the generic's original dots on every exit, and match generic calls in their caller's frame. Create dots nodes from a cached prototype to avoid adding a dependency on a non-API allocator.
Use applyClosure() on R before 4.4 to forward the original promises while recording their expressions in a separate method call. Restore the existing dispatcher on newer R and cover errors, warnings, dots, and super().
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.
On R 4.2 and 4.3, deparsing the call recorded by a plain
stop()inside an S7 method can fail with'S4SXP': should not happen - please report. S7 now records the argument expressions, so an error fromg(Foo())has a readable call such as`method(g, Foo)`(x = Foo()). This also applies to warnings andsys.call()inside methods.Internally, builds for R < 4.4 use
applyClosure()to supply the original argument promises separately from the recorded call. This preserves laziness andsubstitute()behavior, including forwarded...andsuper(). The compatibility code uses internal R APIs exposed by those older versions and is excluded from newer builds. R >= 4.4 retains the existing dispatcher. Public regressions cover argument expressions, promise behavior, and the version boundary.Literal S7 values supplied through
do.call()still encounter the older base-R deparser limitation; ordinary R functions fail in the same case.Fixes #783.