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

Eric Milles updated GROOVY-11137:
---------------------------------
    Component/s: parser-antlr4

> Improve support for union and intersection types
> ------------------------------------------------
>
>                 Key: GROOVY-11137
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11137
>             Project: Groovy
>          Issue Type: Improvement
>          Components: parser-antlr4
>            Reporter: Eric Milles
>            Priority: Major
>
> Union types are partially supported:
> {code:groovy}
> try {
>  foo()
> } catch (Exception | Error e) { // parses
>   e.printStackTrace() // flow type of e is probably Throwable but should be 
> (Exception | Error)
> }
> {code}
> But don't have direct representation or support in the AST.
> Intersection types (declared with {{&}}) are not supported:
> {code:groovy}
> // parses as method call: (a & b).call({ ... })
> var fun = (Function<String,String> & Serializable) { x -> x }
> void test(Number number) {
>   if (number instanceof Comparable) {
>     number // flow type is ? but should be (Number & Comparable)
>   }
> }
> {code}



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

Reply via email to