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

Eric Milles resolved GROOVY-11815.
----------------------------------
    Fix Version/s: 5.0.4
       Resolution: Fixed

https://github.com/apache/groovy/commit/cc8bc3e408f5bc7a6779c70f11a29a4cffdf04a8

> STC: flow type after instanceof drops type args
> -----------------------------------------------
>
>                 Key: GROOVY-11815
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11815
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 5.0.4
>
>
> Consider the following:
> {code:groovy}
> @TypeChecked
> void test(flag) {
>   def x = flag ? new ArrayDeque<Number>() : new Stack<Number>()
>   if (x instanceof Deque) {
>     x
>   }
> }
> {code}
> The type of "x" in the then block is "AbstractCollection<E>" when 
> "AbstractCollection<Number>" is expected.



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

Reply via email to