[
https://issues.apache.org/jira/browse/GROOVY-10317?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-10317:
---------------------------------
Fix Version/s: 3.0.13
> Type variable substitution does not work properly on parameterized function's
> return type
> -----------------------------------------------------------------------------------------
>
> Key: GROOVY-10317
> URL: https://issues.apache.org/jira/browse/GROOVY-10317
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-beta-2, 3.0.13
>
>
> I have the following program
> {code:java}
> class A<T1, T2> {
> void m1(T1 x) {}
> void test() {
> var x = new B();
> T2 y = null;
> (new A<T2, T2>()).m1(x.m2(y));
> }
>
> }
> class B {
> <X, Y> X m2(Y x) { return null; }
> }
> {code}
> h3. Actual behaviour
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> test.groovy: 8: [Static type checking] - Cannot call A#m1(T2) with arguments
> [#X]
> @ line 8, column 5.
> (new A<T2, T2>()).m1(x.m2(y));
> ^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully.
> **Note**: If I change the expected type of parameter `x` in method `m1(T1 x)`
> to `m1(T2 x`), the program compiles as expected.
> Tested against master
--
This message was sent by Atlassian Jira
(v8.20.10#820010)