Thodoris Sotiropoulos created GROOVY-10221:
----------------------------------------------

             Summary: Unexpected compile-time error when combining closures and 
bounded type parameters
                 Key: GROOVY-10221
                 URL: https://issues.apache.org/jira/browse/GROOVY-10221
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


Program

 
{code:java}
class A<T1, T2 extends T1> {
  void foo() {
    def cls1 = { T2 x -> "" }
    Closure<T2> cls2 = { T2 x -> x }
    cls1(cls2((T2) null))
  }
}
{code}
h3. Actual Behavior
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 5: [Static type checking] - Cannot call closure that accepts [T2] 
with [T1]
 @ line 5, column 9.
       cls1(cls2((T2) null))
           ^1 error

{code}
h3. Expected Behavior

Compile successfully

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to