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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3141?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.0958%. Comparing base 
([`ef76fcb`](https://app.codecov.io/gh/apache/groovy/commit/ef76fcba756be3331227627f78b5ba6b62109645?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`cb61c63`](https://app.codecov.io/gh/apache/groovy/commit/cb61c63b4e680f94eb63d972400256287738c4a8?dropdown=coverage&el=desc&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/3141/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/3141?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3141        +/-   ##
   ==================================================
   - Coverage     74.1012%   74.0958%   -0.0054%     
     Complexity      43600      43600                
   ==================================================
     Files            1692       1692                
     Lines          149254     149254                
     Branches        28286      28286                
   ==================================================
   - Hits           110599     110591         -8     
   - Misses          28475      28481         +6     
   - Partials        10180      10182         +2     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3141?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/3141?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% <100.0000%> (ø)` | |
   
   ... and [9 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3141/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 to a trait field nested in the right operand of another 
> compound assignment fails at run time
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12615
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12615
>             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 { int a = 1, b = 1; def m() { a += (b += 1); [a, b] } }
> class C implements T {}
> assert new C().m() == [3, 2]
> {code}
> Actual: dynamic and type-checked code throws {{java.lang.ClassCastException: 
> Cannot cast java.lang.Integer to T$Trait$FieldHelper}}; with @CompileStatic 
> it throws {{GroovyCastException: Cannot cast object '2' with class 
> 'java.lang.Integer' to class 'T'}}. With static trait fields it throws a 
> VerifyError (dynamic) or fails to compile (@CompileStatic). A postfix update 
> in the same position, {{a += (b++)}}, compiles and silently loses the 
> increment, although postfix updates of trait fields are a compile error 
> everywhere else.
> Expected: [3, 2], and a postfix update there rejected with "Postfix 
> expressions on trait fields/properties are not supported in traits."
> Cause: NAryOperationRewriter rewrites x op= y into x = x op y but reuses the 
> right operand without transforming it, so a nested compound assignment to a 
> trait field stays a compound assignment applied to the field helper call, and 
> a nested postfix update is never checked.
> Seen in 4.0.33, 5.0.8 and 6.0.0.
> PR: https://github.com/apache/groovy/pull/3141



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

Reply via email to