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

STC: Property inference issue with IntRange properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0.4
    • Static Type Checker
    • 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

            melix Cédric Champeau
            guillaume Guillaume Sauthier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: