You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2026/04/19 20:17:00 UTC

[jira] [Closed] (GROOVY-11815) STC: flow type after instanceof drops type args

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

Paul King closed GROOVY-11815.
------------------------------

> 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)