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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3133?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 `76.92308%` with `3 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 74.1073%. 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 
([`1ef5dab`](https://app.codecov.io/gh/apache/groovy/commit/1ef5dabdfbdaad8e6ef3ed5b09b8ec6531ddd490?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/3133?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/3133?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)
 | 77.7778% | [0 Missing and 2 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3133?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/3133?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)
 | 75.0000% | [0 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3133?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/3133/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/3133?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3133        +/-   ##
   ==================================================
   + Coverage     74.1016%   74.1073%   +0.0057%     
   - Complexity      43596      43614        +18     
   ==================================================
     Files            1692       1692                
     Lines          149245     149266        +21     
     Branches        28284      28290         +6     
   ==================================================
   + Hits           110593     110617        +24     
   + Misses          28475      28472         -3     
     Partials        10177      10177                
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3133?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...roovy/classgen/asm/sc/StaticTypesLambdaWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3133?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)
 | `89.8182% <75.0000%> (-0.2554%)` | :arrow_down: |
   | 
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3133?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)
 | `88.1890% <77.7778%> (-0.0200%)` | :arrow_down: |
   
   ... and [15 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3133/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 a closure or lambda returning a Closure<R> value where a 
> functional interface return type is expected
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12606
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12606
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.33, 5.0.8, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> import java.util.function.Supplier
> @groovy.transform.CompileStatic // or @TypeChecked
> class C {
>     static String take(Supplier<Supplier<String>> s) { s.get().get() }
>     static void main(args) {
>         Closure<String> c = { 'x' }
>         assert take { c } == 'x'
>         assert take(() -> c) == 'x'
>     }
> }
> {code}
> Actual:
> {noformat}
> [Static type checking] - Cannot return value of type 
> groovy.lang.Closure<java.lang.String> for closure expecting 
> java.util.function.Supplier<java.lang.String>
> [Static type checking] - Cannot return value of type 
> groovy.lang.Closure<java.lang.String> for lambda expecting 
> java.util.function.Supplier<java.lang.String>
> {noformat}
> Expected: both calls compile and the returned closure is converted to the 
> functional interface, as it is when a Closure value is passed as a Supplier 
> argument. A Closure<Integer> should still be rejected.
> The return check for closures and lambdas only accepts subtypes of the 
> expected return type and does not consider closure-to-SAM coercion. A 
> returned closure literal and a raw Closure are rejected the same way. Under 
> static compilation, a lambda also needs its generated method to declare the 
> SAM type, so that the returned closure is converted instead of being returned 
> as a Closure.
> Seen in 4.0.33, 5.0.8 and 6.0.0.
> PR: https://github.com/apache/groovy/pull/3133



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

Reply via email to