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

STC: type inferencing for (a instanceof C && a...) bleeds into enclosing scope

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.16, 3.0.0-alpha-4, 2.5.6
    • 3.0.0-rc-2, 2.5.19
    • Static Type Checker
    • None

    Description

      Expecting type checking error for the following:

      @groovy.transform.TypeChecked
      def m(def obj) {
        def isA = (obj instanceof String && obj.equalsIgnoreCase('a'))
        obj.toLowerCase() // should be STC error; if above line is commented out, error shows
      }
      

      Same for @CompileStatic.

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h