[
https://issues.apache.org/jira/browse/GROOVY-10158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles reassigned GROOVY-10158:
------------------------------------
Assignee: Eric Milles
> Unexpected type mismatch when combining conditional and bounded type parameter
> ------------------------------------------------------------------------------
>
> Key: GROOVY-10158
> URL: https://issues.apache.org/jira/browse/GROOVY-10158
> 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> {}
> class B<T extends A<String>> {
> T m() {
> final T x = null;
> final T y = null;
> (true) ? y : x
> }
> }
> {code}
>
> h3. Actual Behaviour
> groovyc rejects the program with
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> test.groovy: 7: [Static type checking] - Cannot return value of type
> A<java.lang.Object> on method returning type T
> @ line 7, column 5.
> (true) ? y : x
> ^1 error
> {code}
> h3. Expected Behaviour
> Compile successfully
>
> Tested against master
>
> {code:java}
> {code}
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)