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

@wch wch 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 merged commit 2859841 into master Sep 13, 2018
@wch wch deleted the fix-subsubclass-super branch September 13, 2018 05:00
@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
Labels
None yet
Projects
None yet
1 participant