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

Eric Milles updated GROOVY-10688:
---------------------------------
    Fix Version/s: 4.0.5
                       (was: 5.0.0-alpha-1)

> LUB does not work properly when mixing type parameter names and using 
> wildcards
> -------------------------------------------------------------------------------
>
>                 Key: GROOVY-10688
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10688
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.5
>
>
> This might be related to GROOVY-10662.
> I have the following program
> {code}
> class A<T, X> {
> }
> class Test<T> {
>   void test(A<Double, ? extends T> x) {
>     A<Double, ? extends T> y = x;
>     A<Double, ? extends T> z = (true) ? y : x;
>   }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 7: [Static type checking] - Incompatible generic argument types. 
> Cannot assign A<java.lang.Double, java.lang.Object> to: A<java.lang.Double, ? 
> extends T>
>  @ line 7, column 32.
>        A<Double, ? extends T> z = (true) ? y : x;
>                                   ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> *Notes*: The bug is triggered when the following conditions hold:
> * The name of the first type parameter of class A matches the type parameter 
> of class Test.
> * We the wildcard type "? extends T" for instantiating the type constructor A 
> on lines 5, 6, 7.
> Tested against master (commit: 1ea7b9619e7a3ec0da9a3e065f78e394206ea632)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to