[
https://issues.apache.org/jira/browse/GROOVY-12678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18137507#comment-18137507
]
ASF GitHub Bot commented on GROOVY-12678:
-----------------------------------------
codecov-commenter commented on PR #3199:
URL: https://github.com/apache/groovy/pull/3199#issuecomment-6612647297
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3199?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.1521%. Comparing base
([`0941dba`](https://app.codecov.io/gh/apache/groovy/commit/0941dbacf496a1667c27681c6fe76deee59bfb57?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`46b304a`](https://app.codecov.io/gh/apache/groovy/commit/46b304a0eac1ece972582aed7aa06f80a30e9b5d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 11 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/3199?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3199 +/- ##
==================================================
- Coverage 74.1533% 74.1521% -0.0011%
- Complexity 43751 43756 +5
==================================================
Files 1692 1692
Lines 149516 149521 +5
Branches 28366 28369 +3
==================================================
+ Hits 110871 110873 +2
- Misses 28448 28450 +2
- Partials 10197 10198 +1
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3199?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/3199?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.2303% <100.0000%> (+0.0125%)` | :arrow_up: |
... and [12 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3199/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 types owner and delegate as Closure inside a lambda nested in a closure
> or lambda, so SC throws GroovyCastException
> -----------------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12678
> URL: https://issues.apache.org/jira/browse/GROOVY-12678
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.33, 5.0.8, 7.0.0-alpha-1, 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> {code:groovy}
> import java.util.function.Supplier
> @groovy.transform.CompileStatic
> class C {
> String name = 'n'
> def q() {
> Supplier<Supplier<Object>> s = () -> { name; (Supplier<Object>) (()
> -> { name; owner.maximumNumberOfParameters }) }
> s.get().get()
> }
> def r() {
> def c = { -> Supplier<Object> s = () -> { name;
> owner.maximumNumberOfParameters }; s.get() }
> c()
> }
> def t() {
> def c = { -> Supplier<String> s = () -> { name; owner.name }; s.get()
> }
> c()
> }
> }
> new C().q()
> {code}
> *Actual:* {{q()}} and {{r()}} throw {{GroovyCastException: Cannot cast object
> 'C@...' with class 'C' to class 'groovy.lang.Closure'}}, and {{t()}} fails to
> compile with "No such property: name for class: groovy.lang.Closure".
> {{delegate}}, {{getOwner()}} and {{getDelegate()}} behave the same.
> *Expected:* the owner of a statically compiled native lambda is the enclosing
> instance at any depth of nesting, as it is for a top-level lambda. So
> {{owner}} and {{delegate}} should be typed as {{C}}: {{t()}} returns 'n', and
> {{owner.maximumNumberOfParameters}} is rejected at compile time, as it is in
> a top-level lambda.
> Cause: {{StaticTypeCheckingVisitor}} types {{owner}} and {{getOwner()}}, and
> {{delegate}} without delegation metadata, as {{Closure}} whenever more than
> one closure or lambda encloses the reference. A native lambda's owner is the
> enclosing {{this}}, not the enclosing function. A closure, or a lambda
> compiled as a closure (type-checked code, or no functional-interface target),
> is still owned by the enclosing function.
> Verified on 4.0.33 (owner reference in a lambda inside a closure), 5.0.8,
> 6.0.0 and master.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)