[
https://issues.apache.org/jira/browse/GROOVY-12620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135687#comment-18135687
]
ASF GitHub Bot commented on GROOVY-12620:
-----------------------------------------
codecov-commenter commented on PR #3146:
URL: https://github.com/apache/groovy/pull/3146#issuecomment-6540551008
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3146?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 `88.88889%` with `1 line` in your changes missing
coverage. Please review.
:white_check_mark: Project coverage is 74.1001%. 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
([`c0a42e1`](https://app.codecov.io/gh/apache/groovy/commit/c0a42e1c64476b30038088ffd6b795db12898cee?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/3146?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/3146?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.8889% | [0 Missing and 1 partial :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3146?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>
[](https://app.codecov.io/gh/apache/groovy/pull/3146?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3146 +/- ##
==================================================
- Coverage 74.1012% 74.1001% -0.0011%
- Complexity 43600 43609 +9
==================================================
Files 1692 1692
Lines 149254 149263 +9
Branches 28286 28291 +5
==================================================
+ Hits 110599 110604 +5
- Misses 28475 28476 +1
- Partials 10180 10183 +3
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3146?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3146?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.2103% <88.8889%> (+0.0013%)` | :arrow_up: |
... and [11 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3146/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 an int constant for a byte, short
> or char SAM return type
> ---------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12620
> URL: https://issues.apache.org/jira/browse/GROOVY-12620
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.33, 5.0.8, 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> {code:groovy}
> interface S { short get() }
> interface B { byte get() }
> interface C { char get() }
> @groovy.transform.TypeChecked // or @CompileStatic
> void test() {
> S s = () -> 1
> B b = { -> 2 }
> C c = () -> 65
> assert s.get() == (short) 1 && b.get() == (byte) 2 && c.get() == (char) 65
> }
> test()
> {code}
> Actual:
> {noformat}
> [Static type checking] - Cannot return value of type int for lambda expecting
> short
> [Static type checking] - Cannot return value of type int for closure
> expecting byte
> [Static type checking] - Cannot return value of type int for lambda expecting
> char
> {noformat}
> Expected: the script compiles and runs. Java accepts these lambdas, because
> JLS 5.2 allows narrowing an int constant that fits the target type in an
> assignment context, and a lambda result expression is in an assignment
> context. Groovy already accepts a short variable or a short method return
> initialised from such a constant, and dynamic Groovy runs the script. A
> constant that does not fit, such as 70000 for short, or a non-constant int
> must still be rejected.
> The closure/lambda return check in StaticTypeCheckingVisitor.checkReturnType
> accepts only a return type that is compatible after wrapping, so int is never
> accepted where byte, short or char is expected.
> Seen in 4.0.33, 5.0.8 and 6.0.0.
> PR: https://github.com/apache/groovy/pull/3146
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)