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

Eric Milles reassigned GROOVY-10116:
------------------------------------

    Assignee: Eric Milles

> STC: error when passing a type parameter in type constructor
> ------------------------------------------------------------
>
>                 Key: GROOVY-10116
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10116
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 3.0.8, 4.0.0-alpha-3
>            Reporter: Stefanos Chaliasos
>            Assignee: Eric Milles
>            Priority: Major
>
> I have the following Groovy program.
> {code:groovy}
> @groovy.transform.TypeChecked
> class Test<T> {
>   public void foo() {
>     Foo<T, Long> x = new Foo<T, Long>(new Bar<T, Long>());
>   }
> }
> class Foo<X, T> {
>   public Foo(Bar<X, T> y) {}
> }
> class Bar<X, T> {}
> {code}
> h2. Actual Behavior
> The program does not compile, and I get the following error.
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> Test.groovy: 4: [Static type checking] - Cannot call Foo#<init>(Bar<T, 
> java.lang.Long>) with arguments [Bar<T, java.lang.Long>]
>  @ line 4, column 22.
>        Foo<T, Long> x = new Foo<T, Long>(new Bar<T, Long>());
>                         ^
> 1 error
> {code}
> h2. Expected Behavior
> Compile successfully.
> h2. Affected Version
> This programs have been tested with the compiler from the master (commit: 
> c36c8bf3d24ce41e972e3f3e7a5763acf96f46b1), 4.0.0-alpha-3, and 3.0.8.



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

Reply via email to