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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3130?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :x: Patch coverage is `75.00000%` with `2 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 74.0959%. 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 
([`e4a025d`](https://app.codecov.io/gh/apache/groovy/commit/e4a025d0ac1ef2d72aa45861b5b02e593cbfd58c?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.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3130?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[.../groovy/transform/trait/NAryOperationRewriter.java](https://app.codecov.io/gh/apache/groovy/pull/3130?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==)
 | 75.0000% | [1 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3130?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/3130/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/3130?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3130        +/-   ##
   ==================================================
   - Coverage     74.1016%   74.0959%   -0.0058%     
   - Complexity      43596      43600         +4     
   ==================================================
     Files            1692       1692                
     Lines          149245     149262        +17     
     Branches        28284      28288         +4     
   ==================================================
   + Hits           110593     110597         +4     
   - Misses          28475      28481         +6     
   - Partials        10177      10184         +7     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3130?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/3130?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==)
 | `75.0000% <75.0000%> (ø)` | |
   
   ... and [13 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3130/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, increment or decrement of a trait field inside a closure 
> or lambda loses the update or fails
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12603
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12603
>             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 {
>     private int x = 1
>     def m() { [1].each { x++ }; [1].each { x += 2 }; x }
> }
> class C implements T {}
> new C().m()
> {code}
> Actual: m() returns 1 because both updates are lost. With @CompileStatic on 
> the trait, the += throws GroovyCastException: Cannot cast object '3' with 
> class 'java.lang.Integer' to class 'T'. For a static field, or inside a 
> lambda, @CompileStatic fails at compile time instead ("Cannot access method: 
> T__x$get() of class: java.lang.Object", or an ASM instruction selection 
> error). The same applies to public and static fields, x--, ++x, and the other 
> compound operators.
> Expected: x += 2 and the other compound operators update the field, as they 
> do in a trait method body. x++, x--, ++x and --x are rejected at compile time 
> with "Postfix/Prefix expressions on trait fields/properties are not supported 
> in traits", as they are in a trait method body.
> Cause: the trait transformation rewrites x op= y into x = x op y and rejects 
> prefix and postfix operations on trait fields, but that rewriter never 
> visited closure or lambda bodies. The field reference inside the closure was 
> turned into a field-helper getter call, and the operator was applied to the 
> call result.
> Seen in 4.0.33, 5.0.8 and 6.0.0.
> PR: https://github.com/apache/groovy/pull/3130



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

Reply via email to