Eric Milles created GROOVY-8411:
-----------------------------------
Summary: Support instanceof-like flow typing for class literal
switch case
Key: GROOVY-8411
URL: https://issues.apache.org/jira/browse/GROOVY-8411
Project: Groovy
Issue Type: Improvement
Reporter: Eric Milles
Priority: Minor
Would it be possible to extend the {{maybeFile instanceof File ?
maybeFile.canonicalPath : maybeFile.toString()}} flow typing where
{{maybeFile}} is seen as {{File}} in the true expression position to work for
{{switch}}?
This is the kind of construct I am thinking of:
{code}
switch (maybeFile) {
case File:
maybeFile.canonicalPath
break
default:
maybeFile.toString()
}
{code}
Currently is the example falls in an {{@TypeChecked}} or {{@CompileStatic}}
scope, there is an error for the {{canonicalPath}} reference.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)