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 2022/02/15 02:53:00 UTC
[jira] [Assigned] (GROOVY-10482) Incorrect inference of type argument of parameterized method call
[ https://issues.apache.org/jira/browse/GROOVY-10482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-10482:
------------------------------------
Assignee: Eric Milles
> Incorrect inference of type argument of parameterized method call
> -----------------------------------------------------------------
>
> Key: GROOVY-10482
> URL: https://issues.apache.org/jira/browse/GROOVY-10482
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
>
> Maybe related to GROOVY-10342
> I have the following groovy program
> {code:java}
> class Foo<T> {
> Foo(T x) {}
> }
> class Main {
> static <T> void bar() {
> new Foo<T>(baz());
> }
> static <Z> Z baz() {
> return null;
> }
> }
> {code}
> h3. Actual behaviour
> The compiler rejects the code with
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 9: [Static type checking] - Cannot call Foo#<init>(T) with arguments [#Z]
> @ line 9, column 5.
> new Foo<T>(baz());
> ^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully.
> Tested against https://github.com/apache/groovy/commit/5601ea14304b67e71586b0196e38f90fa1a46f5b.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)