[
https://issues.apache.org/jira/browse/GROOVY-12588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18143342#comment-18143342
]
ASF GitHub Bot commented on GROOVY-12588:
-----------------------------------------
testlens-app[bot] commented on PR #3113:
URL: https://github.com/apache/groovy/pull/3113#issuecomment-6813265356
## 🚨 All tests passed but jobs failed 🚨
### Failed Jobs without Test Failures
❌ [Lint gate /
lint](https://github.com/apache/groovy/actions/runs/43146073765/job/130944056849?pr=3113)
🏷️ Commit: 044382c976312893707b65b72d4fcc30fc91680a
▶️ Tests: 872 executed
🟡 Checks: 4/24 completed
### Rerun Controls
Click the checkbox to trigger a rerun:
🔲 **Rerun jobs**
---
_Learn more about TestLens at
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
> STC rejects a Closure<R> value assigned to a parameterized functional
> interface ("Incompatible generic argument types")
> -----------------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12588
> URL: https://issues.apache.org/jira/browse/GROOVY-12588
> 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.TypeChecked // or @CompileStatic
> def m() {
> Closure<String> c = { 'a' }
> Supplier<String> s = c
> s.get()
> }
> assert m() == 'a'
> {code}
> Actual result:
> {noformat}
> [Static type checking] - Incompatible generic argument types. Cannot assign
> groovy.lang.Closure<java.lang.String> to:
> java.util.function.Supplier<java.lang.String>
> {noformat}
> Expected result: the script compiles and the closure is coerced to the
> interface, as it is for a closure literal, for a raw target ({{Supplier s =
> c}}) and in dynamic Groovy.
> The same error is reported when the value comes from a property, a subscript,
> a field assignment or a generic method returning a Closure, and for SAM types
> with parameters such as {{Function<Integer,String>}}. The assignment check
> accepts Closure to SAM coercion, but the generics check that follows it
> compares {{Closure<String>}} with {{Supplier<String>}} as if Closure had to
> implement the interface.
> Seen in 4.0.33, 5.0.8, 6.0.0 and master.
> PR: https://github.com/apache/groovy/pull/3113
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)