You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Christopher Smith (Jira)" <ji...@apache.org> on 2020/12/08 20:43:00 UTC
[jira] [Created] (GROOVY-9854) STC doesn't consider
switch-expression type for closure cases
Christopher Smith created GROOVY-9854:
-----------------------------------------
Summary: 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
{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.3.4#803005)