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 2022/05/01 15:06:00 UTC
[jira] [Assigned] (GROOVY-10614) Fail to infer the correct type argument when having conditionals and diamond operator
[ https://issues.apache.org/jira/browse/GROOVY-10614?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-10614:
------------------------------------
Assignee: Eric Milles
> 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: Major
>
> 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.7#820007)