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

STC: Property inference issue with IntRange properties

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.4
    • Component/s: Static Type Checker
    • Labels:
      None

      Description

      The following example fails:

      @groovy.transform.TypeChecked
      class Test {
          static void test() {
              def range = 1..10
              int i = range.fromInt
          }   
      }
      
      Test.test()
      

      With:

      [Static type checking] - Cannot assign value of type java.lang.Object to variable of type int
      

      Although using the getter method directly getFromInt() and the type checker is happy.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: