Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.5
-
None
Description
@groovy.transform.CompileStatic def foo(a) { if (a instanceof Integer || a instanceof Double) { a.floatValue() // expected: cast to Number; actual: cast to Integer } } println foo(1d).class // CCE: java.lang.Double cannot be cast to java.lang.Integer
Attachments
Issue Links
- is duplicated by
-
GROOVY-10668 Reference to method is ambiguous if block in "if" with "instanceof"
- Closed
- is related to
-
GROOVY-7971 @CS flow typing incorrectly casting to map at runtime
- In Progress
- relates to
-
GROOVY-10702 STC: no error for multiple instanceof and sparse method call
- Open
-
GROOVY-11250 Compilation fails when accessing getter with shortcut notation on Java class
- Closed
-
GROOVY-11008 incorrect type inference after (instanceof || instanceof)
- Closed
-
GROOVY-11014 CompileStatic & Elvis operator: Cannot assign literal value of type (java.lang.Number or java.lang.Comparable) to variable of type double
- Closed
-
GROOVY-11137 Improve support for union and intersection types
- Open
- links to