Thodoris Sotiropoulos created GROOVY-11077:
----------------------------------------------
Summary: STC overconstraints lambda's parameter types when
expecting a SAM that involves wildcards
Key: GROOVY-11077
URL: https://issues.apache.org/jira/browse/GROOVY-11077
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Reporter: Thodoris Sotiropoulos
I have the following program
{code}
class Test {
void test() {
m((Integer x, Integer y) -> 1);
}
void m(java.util.Comparator<? extends Object> x) {}
}
{code}
h3. Actual behavior
{code}
test.groovy: 3: [Static type checking] - Expected type java.lang.Object for
lambda parameter: x
@ line 3, column 8.
m((Integer x, Integer y) -> 1);
^
test.groovy: 3: [Static type checking] - Expected type java.lang.Object for
lambda parameter: y
@ line 3, column 19.
m((Integer x, Integer y) -> 1);
^
2 errors
{code}
h3. Expected behaviour
Compile successfully
h3. Tested against master (commit: 1d9f35a448a2a731499534841ffe64150e80744c)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)