Eric Milles created GROOVY-11815:
------------------------------------

             Summary: 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


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