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 2021/10/30 17:33:00 UTC
[jira] [Assigned] (GROOVY-10322) Type variable of function does not
shadow the corresponding type variable of class
[ https://issues.apache.org/jira/browse/GROOVY-10322?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-10322:
------------------------------------
Assignee: Eric Milles
> 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
> Assignee: Eric Milles
> Priority: Major
>
> 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)