You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/07/23 16:24:00 UTC

[jira] [Updated] (GROOVY-10476) STC: for-each loop on iterable-like types

     [ https://issues.apache.org/jira/browse/GROOVY-10476?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-10476:
---------------------------------
    Fix Version/s:     (was: 5.0.0-alpha-1)

> STC: for-each loop on iterable-like types
> -----------------------------------------
>
>                 Key: GROOVY-10476
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10476
>             Project: Groovy
>          Issue Type: Improvement
>    Affects Versions: 3.0.9, 4.0.0
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 4.0.1
>
>
> Follow up from GROOVY-8133.  Using a {{Stream}} or other iterable-like type (provides {{iterator()}} method but does not implement {{Iterable}}) in a for-each loop works but does not provide type inference beyond {{Object}} for the loop element type.
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test() {
>   for (e in ['a','b','c'].stream()) {
>     println e.toUpperCase()
>   }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)