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 2021/11/16 20:57:00 UTC

[jira] [Assigned] (GROOVY-10371) STC involves improper subtyping rules for parameterized types with wildcard types

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

Eric Milles reassigned GROOVY-10371:
------------------------------------

    Assignee: Eric Milles

> STC involves improper subtyping rules for parameterized types with wildcard types
> ---------------------------------------------------------------------------------
>
>                 Key: GROOVY-10371
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10371
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Major
>
> The following program should not type check
> {code:java}
> class A<T> {}
> class B<T> extends A<T> {}
> class Test {
>   B<? extends Number> x = new B<Double>();
>   A<Number> y = x;
> }
> {code}
> h3. Expected behaviour
> the compiler should have rejected the program and produced an error of the form (like javac does):
> {code}
>  error: incompatible types: B<CAP#1> cannot be converted to A<Number>
>   A<Number> y = x;
>                 ^
>   where CAP#1 is a fresh type-variable:
>     CAP#1 extends Number from capture of ? extends Number
> 1 error
> {code}
> Tested against master



--
This message was sent by Atlassian Jira
(v8.20.1#820001)