-
Notifications
You must be signed in to change notification settings - Fork 37
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
Call vec_restore() on original objects, call vec_proxy() before operating #316
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,7 +185,7 @@ vec_arith.pillar_num <- function(op, x, y, ...) { | |
vec_arith.pillar_num.default <- function(op, x, y, ...) { | ||
"!!!!DEBUG vec_arith.pillar_num.default(`v(op)`)" | ||
stopifnot(is.numeric(x), is.numeric(y)) | ||
out <- vec_arith_base(op, x, y) | ||
out <- vec_arith_base(op, vec_proxy(x), vec_proxy(y)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure this is quite right, but I don't have any better advice for generic Also conceptually there is no general guarantee that |
||
|
||
if (inherits(x, "pillar_num")) { | ||
vec_restore(out, x) | ||
|
@@ -199,7 +199,7 @@ vec_arith.pillar_num.MISSING <- function(op, x, y, ...) { | |
"!!!!DEBUG vec_arith.pillar_num.MISSING(`v(op)`)" | ||
stopifnot(is.numeric(x)) | ||
# FIXME | ||
out <- vec_arith_base(op, 0, x) | ||
out <- vec_arith_base(op, 0, vec_proxy(x)) | ||
|
||
vec_restore(out, x) | ||
} | ||
|
@@ -214,7 +214,7 @@ vec_math.pillar_num <- function(op, x, ...) { | |
"!!!!DEBUG vec_math(`v(op)`)" | ||
|
||
stopifnot(is.numeric(x)) | ||
out <- vec_math_base(op, x) | ||
out <- vec_math_base(op, vec_proxy(x)) | ||
|
||
if (is.numeric(out)) { | ||
out <- vec_restore(out, x) | ||
|
@@ -358,7 +358,7 @@ vec_cast.double.pillar_num <- function(x, to, ...) { | |
} | ||
#' @export | ||
vec_cast.pillar_num.double <- function(x, to, ...) { | ||
vec_restore(x, to) | ||
vec_restore(vec_proxy(x), to) | ||
} | ||
#' @export | ||
vec_cast.pillar_num.integer <- function(x, to, ...) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm actually in this case this doesn't make much of a difference since cast methods are not inherited. So you're guaranteed to get a bare character. Sorry for misleading you here.