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

STC doesn't consider switch-expression type for closure cases

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0.7
    • 3.0.12, 4.0.4
    • Static Type Checker
    • None

    Description

      def foo() {
          switch(1) {
              case { it > 2 }:
                  break
          }
      }
      

      The STC should recognize the type of the switch expression and infer that it's looking for an Integer it closure, but it checks against Object instead and won't compile without an extra Integer it ->.

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              chrylis Christopher Smith
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: