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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3092?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 `80.70175%` with `11 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 73.7720%. Comparing base 
([`396e862`](https://app.codecov.io/gh/apache/groovy/commit/396e862eda6c8a2fddaeb3eaf58e86cb5e6f08bc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`50e5fa3`](https://app.codecov.io/gh/apache/groovy/commit/50e5fa32ac5b7e825cea12e812ab02a3edf92517?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3092?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3092?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fstc%2FStaticTypeCheckingVisitor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zdGMvU3RhdGljVHlwZUNoZWNraW5nVmlzaXRvci5qYXZh)
 | 75.8621% | [1 Missing and 6 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3092?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...ovy/classgen/asm/sc/StaticTypesLambdaAnalyzer.java](https://app.codecov.io/gh/apache/groovy/pull/3092?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FStaticTypesLambdaAnalyzer.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TdGF0aWNUeXBlc0xhbWJkYUFuYWx5emVyLmphdmE=)
 | 87.5000% | [0 Missing and 2 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3092?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...roovy/classgen/asm/sc/StaticTypesLambdaWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3092?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FStaticTypesLambdaWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TdGF0aWNUeXBlc0xhbWJkYVdyaXRlci5qYXZh)
 | 77.7778% | [0 Missing and 2 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3092?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/3092/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/3092?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3092        +/-   ##
   ==================================================
   - Coverage     73.7763%   73.7720%   -0.0043%     
   - Complexity      42753      42776        +23     
   ==================================================
     Files            1678       1678                
     Lines          147462     147514        +52     
     Branches        27899      27920        +21     
   ==================================================
   + Hits           108792     108824        +32     
   - Misses          28513      28521         +8     
   - Partials        10157      10169        +12     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3092?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/3092?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.8889% <100.0000%> (+0.0564%)` | :arrow_up: |
   | 
[...ovy/classgen/asm/sc/StaticTypesLambdaAnalyzer.java](https://app.codecov.io/gh/apache/groovy/pull/3092?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FStaticTypesLambdaAnalyzer.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TdGF0aWNUeXBlc0xhbWJkYUFuYWx5emVyLmphdmE=)
 | `90.6593% <87.5000%> (-0.3045%)` | :arrow_down: |
   | 
[...roovy/classgen/asm/sc/StaticTypesLambdaWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3092?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FStaticTypesLambdaWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TdGF0aWNUeXBlc0xhbWJkYVdyaXRlci5qYXZh)
 | `90.1460% <77.7778%> (-0.0796%)` | :arrow_down: |
   | 
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3092?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fstc%2FStaticTypeCheckingVisitor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zdGMvU3RhdGljVHlwZUNoZWNraW5nVmlzaXRvci5qYXZh)
 | `87.4861% <75.8621%> (-0.0139%)` | :arrow_down: |
   
   ... and [13 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3092/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>




> SC: closures and lambdas in a trait method see the trait helper class instead 
> of the trait instance
> ---------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12563
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12563
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 4.0.33, 5.0.8, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> In a statically compiled trait method, closures and lambdas get the static 
> helper class where the trait instance (or, in a static method, the 
> implementing class) is expected:
> {code:groovy}
> @groovy.transform.CompileStatic
> trait T {
>     String helper() { 'helper' }
>     Object own() { def c = { owner }; c() }
>     String viaThis() { def c = { this.helper() }; c() }
>     String viaLambda() { java.util.function.Supplier<String> s = () -> 
> helper(); s.get() }
> }
> @groovy.transform.CompileStatic
> class C implements T { }
> new C().own()       // GroovyCastException: Cannot cast object 'C@...' with 
> class 'C' to class 'T$Trait$Helper'
> new C().viaThis()   // ClassCastException: class java.lang.Class cannot be 
> cast to class T$Trait$Helper
> new C().viaLambda() // ClassCastException: class java.lang.Class cannot be 
> cast to class T
> {code}
> Also: {{thisObject}}, {{delegate}} without {{@DelegatesTo}}, {{getOwner()}} 
> and {{getThisObject()}} in such a closure (also under {{@TypeChecked}}); a 
> closure written in a lambda; {{this.m()}} in a closure of a dynamic or 
> {{@TypeChecked}} trait (MissingMethodException for a method with arguments, 
> the helper's {{toString()}} and {{getClass()}}); and calling a static closure 
> field of the trait as a method:
> {code:groovy}
> @groovy.transform.CompileStatic
> trait T {
>     static Closure<String> f = { 'f' }
>     static String callF() { f() }
> }
> @groovy.transform.CompileStatic
> class C implements T { }
> C.callF() // 6.0.0: MissingMethodException: No signature of static method: 
> T__f$get for class: T
>           // 4.0.33, 5.0.8: [Static type checking] - Cannot find matching 
> method java.lang.Class#f()
> {code}
> Expected: these give the values and calls dynamic Groovy gives: the trait 
> instance as this object, owner and delegate of a closure written directly in 
> a trait method, the lambda as the owner of a closure written in a lambda, and 
> the implementing class's static field.
> PR: https://github.com/apache/groovy/pull/3092



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

Reply via email to