You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/11/09 16:48:00 UTC

[jira] [Assigned] (GROOVY-10351) Wrong type argument is inferred on combining use-site variance and diamond operator

     [ https://issues.apache.org/jira/browse/GROOVY-10351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles reassigned GROOVY-10351:
------------------------------------

    Assignee: Eric Milles

> Wrong type argument is inferred on combining use-site variance and diamond operator
> -----------------------------------------------------------------------------------
>
>                 Key: GROOVY-10351
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10351
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Major
>
> This bug may be related to GROOVY-10337.
> I have the following program
> {code:java}
> class A<T> {
>   A(T f, B<T, ? extends T> x){  } 
> }
> class B<T1, T2> {}
> class Test {
>   void test() {
>     B<Integer, ? extends Integer> x = null;
>     A<Integer> y = new A<>(1, x);
>   }
> }
> {code}
> h3. Actual behaviour
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 10: [Static type checking] - Incompatible generic argument types. Cannot assign A<? extends java.lang.Object> to: A<java.lang.Integer>
>  @ line 10, column 20.
>        A<Integer> y = new A<>(1, x);
>                       ^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully
> Tested against master (https://github.com/apache/groovy/commit/de17150ee844a943c070c01c07b81fd547ff074d).



--
This message was sent by Atlassian Jira
(v8.20.1#820001)