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

Bug: DEE should check if eliminating an undefined variable #31

Open
jcrodriguez1989 opened this issue Jul 12, 2019 · 0 comments
Open

Bug: DEE should check if eliminating an undefined variable #31

jcrodriguez1989 opened this issue Jul 12, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@jcrodriguez1989
Copy link
Owner

Dead Expression Elimination is optimizing the code:

code <- paste(
  "foo <- function() {",
  "  undef_var + 3",
  "  rnorm(1)",
  "}",
  "foo()",
  sep = "\n"
)
cat(opt_dead_expr(list(code))$codes[[1]])

to:

foo <- function() {
  rnorm(1)
}
foo()

However, their behavior is not equivalent, in the first definition, if undef_var is not present in the parent env, then it will give an error.
DEE should check if expression to eliminate have never-assigned variables.

@jcrodriguez1989 jcrodriguez1989 added the bug Something isn't working label Jul 12, 2019
saxenism pushed a commit to saxenism/rco that referenced this issue Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant