Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix references to super in cloned objects, and don't treat non-method functions as methods when cloning #156

Merged
merged 5 commits into from Sep 13, 2018

Conversation

@wch
Copy link
Member

commented Sep 13, 2018

Fixes #155, fixes #94, fixes #133. The latter two issues are that when cloning an object with a function that is not a method, the new object would turn it into a method, and alter the environment.

This now works:

A <- R6Class("A",
  public = list(
    f = NULL
  )
)

a <- A$new()
self <- 1
a$f <- function() self
expect_identical(a$f(), 1)

a2 <- a$clone()
expect_identical(a2$f(), 1)

@thomasp85, @cpsievert, I believe you guys asked about this in an issue in another repo, but I can't remember where it was.

@wch wch requested a review from gaborcsardi as a code owner Sep 13, 2018

@wch wch merged commit 2859841 into master Sep 13, 2018

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details

@wch wch deleted the fix-subsubclass-super branch Sep 13, 2018

@wch wch changed the title Fix subsubclass super Fix references to super in cloned objects, and don't treat non-method functions as methods when cloning Sep 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.