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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3161?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.1624%. Comparing base 
([`923db24`](https://app.codecov.io/gh/apache/groovy/commit/923db24d7160654f72164b98019d32d05517e7e8?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`68c725b`](https://app.codecov.io/gh/apache/groovy/commit/68c725b1d49f1482519040a6999090f299455940?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/3161/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/3161?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3161        +/-   ##
   ==================================================
   + Coverage     74.1522%   74.1624%   +0.0102%     
   - Complexity      43747      43757        +10     
   ==================================================
     Files            1692       1692                
     Lines          149510     149511         +1     
     Branches        28364      28367         +3     
   ==================================================
   + Hits           110865     110881        +16     
   + Misses          28449      28439        -10     
   + Partials        10196      10191         -5     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3161?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/3161?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==)
 | `92.0000% <100.0000%> (+0.1633%)` | :arrow_up: |
   
   ... and [9 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3161/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>




> Elvis assignment (?=) to a trait field does not assign the field
> ----------------------------------------------------------------
>
>                 Key: GROOVY-12638
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12638
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.33, 5.1.3, 6.0.0
>            Reporter: Paul King
>            Priority: Major
>
> {code:groovy}
> trait T {
>     Integer n
>     def m() { n ?= 5; n }
> }
> class C implements T {}
> println new C().m()
> {code}
> Actual: prints {{null}} in dynamic and @TypeChecked code. With 
> @CompileStatic, compilation fails with {{General error during instruction 
> selection: Internal compiler error}}. The same happens inside a closure in 
> trait code.
> Expected: 5, as for the same field and method in an ordinary class, or for a 
> local variable in trait code.
> Cause: NAryOperationRewriter rewrites the compound assignments of trait 
> fields using TokenUtil.removeAssignment, which has no entry for ELVIS_EQUAL, 
> so {{n ?= 5}} is not rewritten. TraitReceiverTransformer handles only plain 
> assignment ({{=}}) to a trait field specially, so the field on the left of 
> {{?=}} is transformed as a read (a call of the field helper's getter), and 
> the value is never written to the field. Rewriting {{x ?= y}} for a trait 
> field as {{x = x ?: y}} (an ElvisOperatorExpression, since there is no binary 
> elvis operator to pass back) would give the expected result.



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

Reply via email to