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

Eric Milles updated GROOVY-10614:
---------------------------------
    Priority: Minor  (was: Major)

> Fail to infer the correct type argument when having conditionals and diamond 
> operator
> -------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10614
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10614
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Minor
>
> I think this is a regression bug, because Groovy 4.0.2 compiles the program 
> successfully.
> {code}
> class Foo<T> {}
> class Test {
>   public static void test() {
>     foo((true) ? new Foo<Boolean>() : new Foo<>());
>     
>   }
>   public static void foo(Foo<Boolean> x) {}
>   
> }
> {code}
> h3. Actual behaviour
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 5: [Static type checking] - Cannot call 
> Test#foo(Foo<java.lang.Boolean>) with arguments [Foo<? extends 
> java.lang.Object>]
>  @ line 5, column 5.
>        foo((true) ? new Foo<Boolean>() : new Foo<>());
>        ^
> 1 error
> {code}
> h3. Expected Behaviour
> Compile successfully
> Tested against master (commit: e183dc8e04a8ca8762e85e21ac3ee0c03138b6e1)



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

Reply via email to