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

STC incorrectly infers type of nested method call used in a return stmt

    XMLWordPrintableJSON

Details

    Description

      class Source {
          Object getValue() { '32' }
      }
      @groovy.transform.CompileStatic
      int m(Source src) {
          return Integer.parseInt((String) src.getValue())
      }
      null
      

      Fails with

      [Static type checking] - Inconvertible types: cannot cast int to java.lang.String
      

      Git bisect shows it is related to change for GROOVY-7753 (commit 9d7c1bf1b07d43c1efd16c9252b).

      Attachments

        Issue Links

          Activity

            People

              jwagenleitner John Wagenleitner
              jwagenleitner John Wagenleitner
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: