Eric Milles created GROOVY-10712:
------------------------------------
Summary: STC: for-each over Iterator fails to infer element type
Key: GROOVY-10712
URL: https://issues.apache.org/jira/browse/GROOVY-10712
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Reporter: Eric Milles
Assignee: Eric Milles
Consider the following:
{code:groovy}
@groovy.transform.TypeChecked
void test() {
def list = ['a','b']
for (item in list.iterator()) {
item.toUpperCase() // Cannot find matching method Object#toUpperCase()
}
}
{code}
Inferred type of "item" is {{java.lang.Object}}. Without ".iterator()" it is
{{java.lang.String}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)