You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Stefanos Chaliasos (Jira)" <ji...@apache.org> on 2021/06/08 09:16:00 UTC

[jira] [Updated] (GROOVY-10115) STC: compiler error when using type parameter with extends

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

Stefanos Chaliasos updated GROOVY-10115:
----------------------------------------
    Component/s: Static Type Checker
                 Static compilation

> STC: compiler error when using type parameter with extends
> ----------------------------------------------------------
>
>                 Key: GROOVY-10115
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10115
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>            Reporter: Stefanos Chaliasos
>            Priority: Major
>
> I have the following Groovy program.
> {code:groovy}
> @groovy.transform.TypeChecked
> class Bar<L, T extends L> {
>     T x;
>     public Bar(T x) {
>       this.x = x;
>     }
> }
> {code}
> h2. Actual Behavior
> The program does not compile, and I get the following error.
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> Bar.groovy: 5: [Static type checking] - Cannot assign value of type L to variable of type T
>  @ line 5, column 16.
>          this.x = x;
>                   ^
> 1 error
> {code}
> h2. Expected Behavior
> Compile successfully.
> h2. Comment
> This bug is probably a regression because it compiles successfully with 3.0.8 and 4.0.0-alpha-3.
> h2. Affected Version
> This programs have been tested with the compiler from the master (commit: c36c8bf3d24ce41e972e3f3e7a5763acf96f46b1).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)