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

Paul King closed GROOVY-11290.
------------------------------

> STC: multiple instanceof checks produce different results
> ---------------------------------------------------------
>
>                 Key: GROOVY-11290
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11290
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 4.0.18
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 3.0.21, 4.0.19, 5.0.0-alpha-6
>
>
> Consider the following:
> {code:groovy}
> @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
>     }
>   }
> }
> {code}
> 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}}.



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

Reply via email to