Skip to content

Commit d2f611e

Browse files
imitate the approach in other branches more closely
1 parent a7c0ed9 commit d2f611e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

R/data.table.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,9 +2989,9 @@ setDT = function(x, keep.rownames=FALSE, key=NULL, check.names=FALSE) {
29892989
}
29902990
} else if (name %iscall% "get") { # #6725
29912991
name = match.call(get, name)
2992-
name[[1L]] = quote(assign)
2993-
name$value = quote(x)
2994-
eval(name, parent.frame())
2992+
e = eval(name$envir, parent.frame(), parent.frame())
2993+
k = eval(name$x, parent.frame(), parent.frame())
2994+
assign(k, x, envir=e)
29952995
}
29962996
.Call(CexpandAltRep, x) # issue#2866 and PR#2882
29972997
invisible(x)

inst/tests/tests.Rraw

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20661,6 +20661,9 @@ foo = function(nm, env) {
2066120661
}
2066220662
foo('x', e)
2066320663
test(2295.4, is.data.table(x))
20664+
e = new.env(parent=topenv())
20665+
e$x = data.frame(a=1)
20666+
foo('x', e)
2066420667

2066520668
# #6588: .checkTypos used to give arbitrary strings to stopf as the first argument
2066620669
test(2296, d2[x %no such operator% 1], error = '%no such operator%')

0 commit comments

Comments
 (0)