You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/02/03 22:33:00 UTC

[jira] [Closed] (GROOVY-10315) Unable to infer type variable of parameterized function that expects two parameters

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

Paul King closed GROOVY-10315.
------------------------------

> Unable to infer type variable of parameterized function that expects two parameters
> -----------------------------------------------------------------------------------
>
>                 Key: GROOVY-10315
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10315
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-beta-2
>
>
> I have the following program
> {code:java}
> class A<T> {
>   void m(T x) {}
>   <T2> T m2() {
>     return null;
>   }
> }
> class Main {
>   <T> void m1() {
>     A<T> x = new A<T>();
>     m3(m2(), x.m2()); // does not work
>   }
>   <T> T m2() {
>     return null;
>   }
>   <T> void m3(T x, T y) {}
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 12: [Static type checking] - Cannot call <T> Main#m3(T, T) with arguments [#T, T]
>  @ line 12, column 5.
>        m3(m2(), x.m2()); // does not work
>        ^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully.
> Tested against master



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