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

Eric Milles reassigned GROOVY-10266:
------------------------------------

    Assignee: Eric Milles

> The diamond operator does not work when passing a value whose type is a type 
> variable
> -------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10266
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10266
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Major
>
> I have the following program
>  
> {code:java}
> class A<T> {
>   void foo() {
>     T z = null;
>     T x = new B<>(z).f // does not work
>     String y = ""
>     String k = new B<>(y).f // works
>   }
>   
> }
> class B<X> {
>   X f;
>   B(X f) {
>     this.f = f;
>   }
> }
> {code}
> h3. Actual behaviour
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 4: [Static type checking] - Cannot assign value of type X to 
> variable of type T
>  @ line 4, column 11.
>        T x = new B<>(z).f // does not work
>              ^1 error
> {code}
> h3. Expected behaviour
> Compile successfully
>  
> Tested against master
>  



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

Reply via email to