You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Thodoris Sotiropoulos (Jira)" <ji...@apache.org> on 2023/05/05 15:31:00 UTC

[jira] [Created] (GROOVY-11047) Fail to catch incompatible return type of lambdas

Thodoris Sotiropoulos created GROOVY-11047:
----------------------------------------------

             Summary: Fail to catch incompatible return type of lambdas
                 Key: GROOVY-11047
                 URL: https://issues.apache.org/jira/browse/GROOVY-11047
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


Probably related to GROOVY-10277.

I have the following program

{code}
class Main {
  static final void test() {
        java.util.stream.StreamSupport.<Process>stream(()-> 1, 1, false); // Error, the return type of lamba is not compatible with the expected type.
  }
}
{code}

h3. Actual behavior

The compiler accepts the program

h3. Expected behavior

Reject the program with an error of the form: "error: incompatible types: bad return type in lambda expression"



--
This message was sent by Atlassian Jira
(v8.20.10#820010)