[
https://issues.apache.org/jira/browse/GROOVY-10870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thodoris Sotiropoulos updated GROOVY-10870:
-------------------------------------------
Description:
I have the following program
{code}
class Foo<X> {}
class Test {
static void test() {
m(false, new Foo<>());
}
static <T> void m(T x1, Foo<T> x2) {}
}
{code}
h3. Actual behavior
{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 6: [Static type checking] - Cannot call <T> Test#m(T, Foo<T>) with
arguments [boolean, Foo<T>]
@ line 6, column 5.
m(false, new Foo<>());
^
1 error
{code}
h3. Expected behavior
Compile successfully
*note*: The issues occurs only when the type parameters of class Foo and method
m have different names.
Tested against master (commit: d7fa923bed20945074a41c54cce5133cc2ab63a0)
was:
I have the following program
{code}
class Foo<X> {}
class Test {
static void test() {
m(false, new Foo<>());
}
static <T> void m(T x1, Foo<T> x2) {}
}
{code}
h3. Actual behavior
{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 6: [Static type checking] - Cannot call <T> Test#m(T, Foo<T>) with
arguments [boolean, Foo<T>]
@ line 6, column 5.
m(false, new Foo<>());
^
1 error
{code}
h3. Expected behavior
Compile successfully
*note*: The issues occurs only when the type parameter of class Foo is
different from that of method "m".
Tested against master (commit: d7fa923bed20945074a41c54cce5133cc2ab63a0)
> Fail to infer type argument of parameterized function
> -----------------------------------------------------
>
> Key: GROOVY-10870
> URL: https://issues.apache.org/jira/browse/GROOVY-10870
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Priority: Major
>
> I have the following program
> {code}
> class Foo<X> {}
> class Test {
> static void test() {
> m(false, new Foo<>());
> }
> static <T> void m(T x1, Foo<T> x2) {}
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> test.groovy: 6: [Static type checking] - Cannot call <T> Test#m(T, Foo<T>)
> with arguments [boolean, Foo<T>]
> @ line 6, column 5.
> m(false, new Foo<>());
> ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> *note*: The issues occurs only when the type parameters of class Foo and
> method m have different names.
> Tested against master (commit: d7fa923bed20945074a41c54cce5133cc2ab63a0)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)