Groovy
  1. Groovy
  2. GROOVY-5258

Static type checker incorrectly handles assignments of variables used as parameters in control structures

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta-2
    • Fix Version/s: 2.0-beta-3
    • Component/s: None
    • Labels:
      None

      Description

      Imagine the following code:

      Double foo(Integer x) { x+1 }
      Integer foo(Double x) { x+1 }
      def x = 0
      for (int i=0;i<10;i++) {
         // there are two possible target methods. This is not a problem for STC, but it is for static compilation
         x = foo(x)
      }
      

      The type checker should not allow this to compile. There are more cases (even more complex) like this in the patch (groovy.transform.stc.LoopsSTCTest).

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Cédric Champeau
            Reporter:
            Cédric Champeau
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development