Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Information Provided
-
None
-
None
Description
I have the following program:
import java.util.*; import java.util.function.*; class Bar { LinkedList<String> collect(Supplier<String> function) { } List<String> collect(String x, int y, int z) { } } class Main { static final void test() { Bar x = null; LinkedList<String> d = x.collect(() -> "fda"); } }
Actual behaviour
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 14: [Static type checking] - Cannot assign value of type java.util.List<java.lang.String> to variable of type java.util.LinkedList<java.lang.String> @ line 14, column 28. LinkedList<String> d = x.collect(() -> "fda"); ^ 1 error
Expected behaviour
Compile successfully
Notes
Tested against master (commit: cac91791764b8f0b3338318248474412f89e3456)
Adapted from:
import java.util.*; import java.util.function.*; import org.eclipse.collections.api.tuple.primitive.BooleanBooleanPair; import org.eclipse.collections.api.map.primitive.*; import org.eclipse.collections.api.factory.map.primitive.*; import org.eclipse.collections.api.collection.*; import org.eclipse.collections.api.factory.map.primitive.MutableDoubleFloatMapFactory; class Main { static final <G, W>void test() { ImmutableObjectDoubleMap<LongFunction<BooleanBooleanPair>> d = null; final ImmutableCollection<MutableDoubleFloatMapFactory> x = d.collect((p) -> (MutableDoubleFloatMapFactory) null ); } }
Attachments
Issue Links
- is related to
-
GROOVY-11002 Unexpected type mismatch when having overloaded methods with variable arguments
- Open