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

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

testlens-app[bot] commented on PR #3113:
URL: https://github.com/apache/groovy/pull/3113#issuecomment-6539702505

   ## 🚨 All tests passed but jobs failed 🚨
   
   ### Failed Jobs without Test Failures
   
   ❌ [Build and test / lts \(17, 
macos-latest\)](https://github.com/apache/groovy/actions/runs/41169525055/job/124444255330?pr=3113)
   ❌ [Build and test / lts \(17, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41169525055/job/124444255253?pr=3113)
   ❌ [Build and test / lts \(17, windows-latest, 
1\)](https://github.com/apache/groovy/actions/runs/41169525055/job/124444255343?pr=3113)
   
   🏷️ Commit: 07e977a3420aece57547e4be59594d4e76c858ac
   ▶️ Tests:  45295 executed
   ⚪️ Checks: 26/26 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)

Reply via email to