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

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

paulk-asert commented on PR #3093:
URL: https://github.com/apache/groovy/pull/3093#issuecomment-6535904411

   Verdict: ready to merge. It's a five-line change in the type checker, it 
does more than the description claims, and I found no regressions. The backport 
is 6.0.x only.




> STC: calling a closure of intersection type is typed as "?", giving 
> NoClassDefFoundError: ?
> -------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12564
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12564
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 4.0.33, 5.0.8, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> A closure whose return type is an intersection, such as the value of {{flag ? 
> 1 : 'x'}}, is typed {{Closure<? extends A & B>}}. A call of such a closure 
> through a variable is typed as the wildcard's placeholder class, named "?". A 
> closure returning that call gets a {{doCall}} declared to return class "?":
> {code:groovy}
> @groovy.transform.CompileStatic
> Object make(boolean flag) { def outer = { def inner = { flag ? 1 : 'x' }; 
> inner() }; outer() }
> make(true) // NoClassDefFoundError: ?
> {code}
> The same under {{@TypeChecked}}, in traits, and in static methods and field 
> initializers.
> Expected: the call is typed as the wildcard's upper bound (the closure's 
> return type).
> PR: https://github.com/apache/groovy/pull/3093



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

Reply via email to