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

Flow typing doesn't work with assignment to a parameter

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.10
    • Fix Version/s: 2.4.12
    • Component/s: Static Type Checker
    • Labels:
      None

      Description

      import groovy.transform.CompileStatic
      
      class A {}
      class B extends A { def bbb() {} }
      
      @CompileStatic
      def fooLocalAssignment() {
          A a = new B()
          a.bbb()
      }
      
      @CompileStatic
      def fooParameterAssignment(A a) {
          a = new B() 
          a.bbb() // Cannot find matching method A#bbb()
      }
      

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user shils opened a pull request:

          https://github.com/apache/groovy/pull/537

          GROOVY-8157: Flow typing doesn't work with assignment to a parameter

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/shils/groovy GROOVY-8157

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/groovy/pull/537.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #537


          commit f864ead5ca2938d59a08986c5fb02c01dba0f2aa
          Author: Shil Sinha <shils@apache.org>
          Date: 2017-05-06T08:32:20Z

          GROOVY-8157: Flow typing doesn't work with assignment to a parameter


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user shils opened a pull request: https://github.com/apache/groovy/pull/537 GROOVY-8157 : Flow typing doesn't work with assignment to a parameter You can merge this pull request into a Git repository by running: $ git pull https://github.com/shils/groovy GROOVY-8157 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/537.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #537 commit f864ead5ca2938d59a08986c5fb02c01dba0f2aa Author: Shil Sinha <shils@apache.org> Date: 2017-05-06T08:32:20Z GROOVY-8157 : Flow typing doesn't work with assignment to a parameter
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/groovy/pull/537

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/537

            People

            • Assignee:
              shils Shil Sinha
              Reporter:
              daniilo Daniil Ovchinnikov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development