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/16 15:01:00 UTC

[jira] [Resolved] (GROOVY-10363) STC produces compile-time error on encoutering bounded type parameter with conditional

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

Eric Milles resolved GROOVY-10363.
----------------------------------
    Fix Version/s: 5.0.0-alpha-1
       Resolution: Fixed

https://github.com/apache/groovy/commit/2632e241b39692ce6fbc16a6198ab638ab316c13

> STC produces compile-time error on encoutering bounded type parameter with conditional
> --------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10363
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10363
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 5.0.0-alpha-1
>
>
> I have the following program:
> {code:groovy}
> import java.util.function.Supplier;
> class A {
>   static final <X extends Supplier<Number>> X m(X x, X y) {
>     X z = (true) ? x : y
>     z
>   }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 10: [Static type checking] - Incompatible generic argument types. Cannot assign java.util.function.Supplier<java.lang.Object> to: X
>  @ line 10, column 5.
>        z
>        ^
> 1 error
> {code}
> h3. Compile successfully
> NOTE: The bug is triggered only when the type parameter is named other than `T`.
> Tested against master



--
This message was sent by Atlassian Jira
(v8.20.7#820007)