[
https://issues.apache.org/jira/browse/GROOVY-10482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-10482:
---------------------------------
Fix Version/s: 3.0.11
> 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
> Fix For: 5.0.0-alpha-1, 3.0.11, 4.0.2
>
>
> 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)