Thodoris Sotiropoulos created GROOVY-10870:
----------------------------------------------
Summary: 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
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 parameter of class Foo is
different from that of method "m".
Tested against master (commit: d7fa923bed20945074a41c54cce5133cc2ab63a0)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)