Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
I have the following program
import java.util.function.Function; class A<T> { T y; void foo(T x, Function<T, T> func) { foo((true) ? x : y, func) } }
Actual behavior
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 6: [Static type checking] - Cannot call A#foo(java.lang.Object, java.util.function.Function<java.lang.Object, java.lang.Object>) with arguments [java.lang.Object<T>, java.util.function.Function<T, T>] @ line 6, column 5. foo((true) ? x : y, func) ^ 1 error
Expected behaviour
Compile successfully
Note: If replace `Function<T, T> func` with `Supplier<T> func`, the code compiles as expected.
Tested against master.