Thodoris Sotiropoulos created GROOVY-10630:
----------------------------------------------

             Summary: Subtyping does not work properly when having bounded type 
parameter and closure
                 Key: GROOVY-10630
                 URL: https://issues.apache.org/jira/browse/GROOVY-10630
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


This is related to GROOVY-10629, GROOVY-10115, GROOVY-10221

I have the following program

{code}
class B<X, Y extends X> {
  void test() {
    Closure<String> clos = { X x -> x.toString() }
    clos((Y) null);
  }
}
{code}

h3. Actual behaviour

{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 4: [Static type checking] - Cannot call closure that accepts [X] 
with [Y]
 @ line 4, column 9.
       clos((Y) null);
           ^

1 error
{code}

h3. Expected behaviour

Compile successfully

Tested against master (commit: a976ecdee1f17f7fafc55767de2d857c44d44697)



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to