groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Milles (JIRA)" <j...@apache.org>
Subject [jira] [Created] (GROOVY-9064) STC: explicit declared variable type ignored in favor of assigned value type(s)
Date Wed, 03 Apr 2019 15:40:00 GMT
Eric Milles created GROOVY-9064:
-----------------------------------

             Summary: STC: explicit declared variable type ignored in favor of assigned value
type(s)
                 Key: GROOVY-9064
                 URL: https://issues.apache.org/jira/browse/GROOVY-9064
             Project: Groovy
          Issue Type: Bug
            Reporter: Eric Milles


Follow up to GROOVY-9058.  Consider the following:
{code:groovy}
List getSomeRows() { ... }
@groovy.transform.CompileStatic
void meth() {
  List<Object[]> rows = getSomeRows()
  rows.each { row ->
    def col = row[0]
  }
}
{code}

The inferred type of {{rows}} is {{List}} and not {{List<Object[]>}} even though the
assignment cleared type checking.  This causes the inferred type of {{row}} to be {{Object}}
instead of {{Object[]}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message