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 2023/04/15 16:07:00 UTC

[jira] [Updated] (GROOVY-10870) Fail to infer type argument of parameterized function

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

Eric Milles updated GROOVY-10870:
---------------------------------
    Priority: Minor  (was: Major)

> Fail to infer type argument of parameterized function
> -----------------------------------------------------
>
>                 Key: GROOVY-10870
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10870
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Minor
>
> I have the following program
> {code}
> class Foo<X> {}
> class Test {
>   static void test() {
>     m(false, new Foo<>());
>   }
>   static <T> void m(T x1, Foo<T> x2) {}
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 6: [Static type checking] - Cannot call <T> Test#m(T, Foo<T>) with arguments [boolean, Foo<T>]
>  @ line 6, column 5.
>        m(false, new Foo<>());
>        ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> *note*: The issues occurs only when the type parameters of class Foo and method m have different names.
> Tested against master (commit: d7fa923bed20945074a41c54cce5133cc2ab63a0)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)