Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
4.0.18
-
None
Description
Consider the following:
@groovy.transform.TypeChecked test1(CharSequence chars) { if (chars instanceof Cloneable && chars instanceof Closeable) { chars } } @groovy.transform.TypeChecked test2(CharSequence chars) { if (chars instanceof Cloneable) { if (chars instanceof Closeable) { chars } } }
The last occurrence of "chars" in test1 has the inferred type "CharSequence & Cloneable & Closeable". However the last occurrence of "chars" in test2 has the inferred type "CharSequence & Closeable" instead of the expected result like test1.
Attachments
Attachments
Issue Links
- is related to
-
GROOVY-5226 Variables which type is determined thanks to instanceof checks should be usable as arguments without casts
- Closed
-
GROOVY-6429 flow typing detects unexpected error at if-else flow
- Closed
-
GROOVY-7333 Incorrect inferred type in instanceof check of array
- Closed
-
GROOVY-9455 STC: no error for if (!(x instanceof T)) x.methodFromT()
- Closed
-
GROOVY-9769 STC: UnionTypeClassNode created for simple instanceof scenarios
- Closed