[
https://issues.apache.org/jira/browse/GROOVY-9854?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles reassigned GROOVY-9854:
-----------------------------------
Assignee: Eric Milles
> STC doesn't consider switch-expression type for closure cases
> -------------------------------------------------------------
>
> Key: GROOVY-9854
> URL: https://issues.apache.org/jira/browse/GROOVY-9854
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 3.0.7
> Reporter: Christopher Smith
> Assignee: Eric Milles
> Priority: Minor
>
> {code:groovy}
> def foo() {
> switch(1) {
> case { it > 2 }:
> break
> }
> }
> {code}
> The STC should recognize the type of the switch expression and infer that
> it's looking for an {{Integer it}} closure, but it checks against Object
> instead and won't compile without an extra {{Integer it ->}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)