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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.16, 3.0.0-alpha-4, 2.5.6
    • Fix Version/s: 3.0.0-rc-2
    • Component/s: Static Type Checker
    • Labels:
      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

              • Assignee:
                emilles Eric Milles
                Reporter:
                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