Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Maybe related to GROOVY-10342
I have the following groovy program
class Foo<T> { Foo(T x) {} } class Main { static <T> void bar() { new Foo<T>(baz()); } static <Z> Z baz() { return null; } }
Actual behaviour
The compiler rejects the code with
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
Expected behaviour
Compile successfully.
Tested against https://github.com/apache/groovy/commit/5601ea14304b67e71586b0196e38f90fa1a46f5b.