[ 
https://issues.apache.org/jira/browse/GROOVY-12613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135653#comment-18135653
 ] 

ASF GitHub Bot commented on GROOVY-12613:
-----------------------------------------

codecov-commenter commented on PR #3140:
URL: https://github.com/apache/groovy/pull/3140#issuecomment-6540130217

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3140?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 74.1042%. Comparing base 
([`cd944a5`](https://app.codecov.io/gh/apache/groovy/commit/cd944a5f0ee353126e6f6a484f574b4b53e555fd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`b54a116`](https://app.codecov.io/gh/apache/groovy/commit/b54a1164238f42198ddc397a55e6804b746b0442?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/3140/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/3140?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3140        +/-   ##
   ==================================================
   + Coverage     74.1016%   74.1042%   +0.0026%     
   - Complexity      43596      43602         +6     
   ==================================================
     Files            1692       1692                
     Lines          149245     149256        +11     
     Branches        28284      28287         +3     
   ==================================================
   + Hits           110593     110605        +12     
   + Misses          28475      28471         -4     
   - Partials        10177      10180         +3     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3140?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[.../groovy/transform/trait/NAryOperationRewriter.java](https://app.codecov.io/gh/apache/groovy/pull/3140?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Ftrait%2FNAryOperationRewriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS90cmFpdC9OQXJ5T3BlcmF0aW9uUmV3cml0ZXIuamF2YQ==)
 | `91.3044% <100.0000%> (+16.3043%)` | :arrow_up: |
   
   ... and [15 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3140/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> Compound assignment in a trait method evaluates its target twice when the 
> target is not a trait field
> -----------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12613
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12613
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.33, 5.0.8, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> trait T {
>     def m() { def l = [0, 0]; int i = 0; l[i++] += 1; [i, l] }
> }
> class C implements T {}
> assert new C().m() == [1, [1, 0]]
> {code}
> Actual: {{new C().m()}} returns {{[2, [1, 0]]}}. The index expression runs 
> twice. The same method in a class returns {{[1, [1, 0]]}}. The receiver or 
> subscript of any compound assignment in a trait method is evaluated twice, 
> for example a map subscript key() is called twice. This happens with and 
> without @CompileStatic / @TypeChecked.
> Expected: {{[1, [1, 0]]}}. A compound assignment evaluates its target once, 
> as it does in a class.
> Cause: the trait transformation (NAryOperationRewriter) rewrites every 
> compound assignment in trait code into a plain assignment (a = a op b). The 
> rewrite is only needed when the target is a trait field, which becomes a 
> field-helper getter/setter call.
> Seen in 4.0.33, 5.0.8 and 6.0.0.
> PR: https://github.com/apache/groovy/pull/3140



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to