Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-11047

Fail to catch incompatible return type of lambdas

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Static Type Checker

    Description

      Probably related to GROOVY-10277.

      I have the following program

      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.
        }
      }
      

      Actual behavior

      The compiler accepts the program

      Expected behavior

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            theosot Thodoris Sotiropoulos
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: