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

Fixed nested ':=' reference assignment fails #6789

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

AntonNM
Copy link

@AntonNM AntonNM commented Feb 2, 2025

Fixed nested ':=' reference assignment fails (#6768)

By reference assignments (':=') with functions that modified the data.table by reference e.g. (foo=function(DT){modify(DT);return(1L)}, DT[,a:=foo(DT)]) returned a mallformed data.table due to the modification of the targeted named column index ("a") during the j expression evaluation

*Completed TODO: by mattdowle from commits to '2-space indentation #2420' to move allocation logic after jsub evaluation

chmatch and setalloccol calls moved below jsub evaluation which fixed name to column index mapping. Warnings and conditions to terminate early remain before the evaluation. selfrefok warning and following branch were split to accommodate this and to avoid duplicate warnings

*Added tests for jsub expressions that modify DT by-reference

Includes the test that initially demonstrated the bug and an additional test case for future regression testing.

*Added test case for integer vector indexing

Removed pre-jsub-eval numerical lhs to name mapping to prevent issues with duplicate name issues.

Closes #6768

*Followed TODO: by mattdowle from resolution to '2-space indentation Rdatatable#2420'

*Added tests for jsub that modify DT by-reference

*Added test case for interger vector indexing
@AntonNM AntonNM changed the title Fixed nested ':=' reference assignment fails (https://github.com/Rdatatable/data.table/issues/6768) Fixed nested ':=' reference assignment fails [#6768](https://github.com/Rdatatable/data.table/issues/6768) Feb 2, 2025
@AntonNM AntonNM changed the title Fixed nested ':=' reference assignment fails [#6768](https://github.com/Rdatatable/data.table/issues/6768) Fixed nested ':=' reference assignment fails (#6768) Feb 2, 2025
@AntonNM AntonNM changed the title Fixed nested ':=' reference assignment fails (#6768) Fixed nested ':=' reference assignment fails Feb 2, 2025
Copy link

codecov bot commented Feb 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.60%. Comparing base (f6dca2d) to head (e5bb0e3).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6789   +/-   ##
=======================================
  Coverage   98.60%   98.60%           
=======================================
  Files          79       79           
  Lines       14642    14651    +9     
=======================================
+ Hits        14438    14447    +9     
  Misses        204      204           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MichaelChirico MichaelChirico added this to the 1.18.0 milestone Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nested ':=' reference assignment fails
2 participants