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/21 11:36:00 UTC
[jira] [Created] (GROOVY-10322) Type variable of function does not
shadow the corresponding type variable of class
Thodoris Sotiropoulos created GROOVY-10322:
----------------------------------------------
Summary: Type variable of function does not shadow the corresponding type variable of class
Key: GROOVY-10322
URL: https://issues.apache.org/jira/browse/GROOVY-10322
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Reporter: Thodoris Sotiropoulos
I have the following program
{code:java}
class A<T> {
<T> T foo(T t) { return t; }
}
class B {
void bar(int x) {}
void test() {
int x = (new A<String>()).foo(1);
}
}
{code}
h3. Actual behaviour
{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 11: [Static type checking] - Cannot find matching method A#foo(int). Please check if the declared type is correct and if the method exists.
@ line 11, column 13.
int x = (new A<String>()).foo(1);
^
1 error
{code}
h3. Expected behaviour
Compile successfully
Tested against master
--
This message was sent by Atlassian Jira
(v8.3.4#803005)