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]: get_code doesn't return dependencies of the lines with # @linksto #261

Closed
gogonzo opened this issue Jan 19, 2024 · 4 comments · Fixed by #263
Closed

[Bug]: get_code doesn't return dependencies of the lines with # @linksto #261

gogonzo opened this issue Jan 19, 2024 · 4 comments · Fixed by #263
Assignees

Comments

@gogonzo
Copy link
Contributor

gogonzo commented Jan 19, 2024

What happened?

tdata <- teal_data() |>
  eval_code("
    foo <- function() {
      env <- parent.frame()
      env$x <- 0
    }
    foo() # @linksto x
    y <- x
  ")
  
  
get_code(tdata, datanames = "x")
# character(0)

In this case get_code should return all the code

@gogonzo gogonzo self-assigned this Jan 19, 2024
@gogonzo gogonzo mentioned this issue Jan 19, 2024
Closed
@gogonzo
Copy link
Contributor Author

gogonzo commented Jan 19, 2024

I was trying to fix this problem but it is more complex. Something to talk on monday

@donyunardi donyunardi mentioned this issue Jan 19, 2024
33 tasks
@donyunardi
Copy link
Contributor

@gogonzo I can't reproduce your result as I got foo() returned.

library(teal.data)
#> Loading required package: teal.code
tdata <- teal_data() |>
  eval_code("
    foo <- function() {
      env <- parent.frame()
      env$x <- 0
    }
    foo() # @linksto x
    y <- x
  ")  
  
get_code(tdata, datanames = "x")
#> [1] "foo()"

Created on 2024-01-19 with reprex v2.0.2

I have latest main for teal.data

SessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.6.3

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Los_Angeles
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] teal.data_0.3.0.9039 teal.code_0.5.0.9000

loaded via a namespace (and not attached):
 [1] vctrs_0.6.5       cli_3.6.2         knitr_1.44        rlang_1.1.2       xfun_0.40         processx_3.8.2   
 [7] purrr_1.0.2       styler_1.10.2     glue_1.6.2        backports_1.4.1   clipr_0.8.0       htmltools_0.5.7  
[13] ps_1.7.5          fansi_1.0.6       rmarkdown_2.25    R.cache_0.16.0    evaluate_0.22     tibble_3.2.1     
[19] fastmap_1.1.1     yaml_2.3.7        lifecycle_1.0.4   compiler_4.3.2    fs_1.6.3          pkgconfig_2.0.3  
[25] rstudioapi_0.15.0 R.oo_1.25.0       R.utils_2.12.3    digest_0.6.33     R6_2.5.1          utf8_1.2.4       
[31] reprex_2.0.2      pillar_1.9.0      callr_3.7.3       magrittr_2.0.3    checkmate_2.3.1   R.methodsS3_1.8.2
[37] tools_4.3.2       withr_2.5.2  

@gogonzo
Copy link
Contributor Author

gogonzo commented Jan 19, 2024

@donyunardi we have a bug here, foo() only is not enough as definition of the foo should be also returned. We are going to work on this on Monday.

@m7pr
Copy link
Contributor

m7pr commented Jan 22, 2024

Fixed in #263

@m7pr m7pr self-assigned this Jan 22, 2024
@m7pr m7pr closed this as completed in #263 Jan 24, 2024
m7pr added a commit that referenced this issue Jan 24, 2024
…on (#263)

~~Close #216~~

EDIT
Close #261

---------

Signed-off-by: Marcin <[email protected]>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: go_gonzo <[email protected]>
Co-authored-by: Aleksander Chlebowski <[email protected]>
Co-authored-by: André Veríssimo <[email protected]>
Co-authored-by: Aleksander Chlebowski <[email protected]>
Co-authored-by: Dawid Kałędkowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants