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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3112?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 73.7663%. Comparing base 
([`12ce174`](https://app.codecov.io/gh/apache/groovy/commit/12ce174090162bdded6fb759c8af39ebd1593353?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`5aae64a`](https://app.codecov.io/gh/apache/groovy/commit/5aae64aa085e013d222f92a2873f57dfe4295b06?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 59 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/3112/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/3112?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3112        +/-   ##
   ==================================================
   - Coverage     73.7672%   73.7663%   -0.0009%     
   + Complexity      42748      42746         -2     
   ==================================================
     Files            1678       1678                
     Lines          147464     147463         -1     
     Branches        27899      27899                
   ==================================================
   - Hits           108780     108778         -2     
   - Misses          28520      28521         +1     
     Partials        10164      10164                
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3112?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...oovy/transform/trait/TraitReceiverTransformer.java](https://app.codecov.io/gh/apache/groovy/pull/3112?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Ftrait%2FTraitReceiverTransformer.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS90cmFpdC9UcmFpdFJlY2VpdmVyVHJhbnNmb3JtZXIuamF2YQ==)
 | `88.7755% <100.0000%> (-0.0570%)` | :arrow_down: |
   
   ... and [13 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3112/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>




> STC rejects reading a static trait property through "this" inside a trait 
> method
> --------------------------------------------------------------------------------
>
>                 Key: GROOVY-12587
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12587
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.33, 5.0.8, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> @groovy.transform.CompileStatic
> trait T {
>     static boolean flag = true
>     static boolean sm() { this.flag }
>     boolean im() { this.flag }
> }
> class C implements T {}
> assert C.sm() && new C().im()
> {code}
> Actual, under both @CompileStatic and @TypeChecked:
> {noformat}
> [Static type checking] - Cannot find matching method 
> java.lang.Class#T__flag$get() or static method T#T__flag$get(). Please check 
> if the declared type is correct and if the method exists.
> [Static type checking] - Cannot find matching method 
> T$Trait$FieldHelper#T__flag$get(). Please check if the declared type is 
> correct and if the method exists.
> {noformat}
> The first error is for the static method, the second for the instance method. 
> The same happens for a static trait property or field of any type, for 
> compound assignments such as {{this.count += 1}}, and inside closures and 
> lambdas.
> Expected: the script compiles and the assertion passes, as it does without 
> the annotation and when the property is referenced without {{this.}}.
> Cause: the trait receiver transformer rewrites {{this.flag}} with a 
> placeholder non-static field instead of the trait's declared field, so the 
> accessor call targets the field helper (instance method) or the Class 
> receiver (static method), without the dynamic-dispatch marker that static 
> trait fields get.
> Seen in 4.0.33, 5.0.8, 6.0.0 and master.
> PR: https://github.com/apache/groovy/pull/3112



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

Reply via email to