You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Thodoris Sotiropoulos (Jira)" <ji...@apache.org> on 2021/10/18 13:55:00 UTC
[jira] [Created] (GROOVY-10315) Unable to infer type variable of
parameterized function that expects two parameters
Thodoris Sotiropoulos created GROOVY-10315:
----------------------------------------------
Summary: 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
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.3.4#803005)