Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Union types are partially supported:
try { foo() } catch (Exception | Error e) { // parses e.printStackTrace() // flow type of e is probably Throwable but should be (Exception | Error) }
But don't have direct representation or support in the AST.
Intersection types (declared with &) are not supported:
// 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) } }
Attachments
Issue Links
- is related to
-
GROOVY-7971 @CS flow typing incorrectly casting to map at runtime
- In Progress
-
GROOVY-8965 instanceof with || inserts wrong cast
- Closed
-
GROOVY-9769 STC: UnionTypeClassNode created for simple instanceof scenarios
- Closed
-
GROOVY-9320 Support serializable lambda expression
- Closed
-
GROOVY-7333 Incorrect inferred type in instanceof check of array
- Closed