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

Eric Milles updated GROOVY-9455:
--------------------------------
    Fix Version/s: 2.5.16

> STC: no error for if (!(x instanceof T)) x.methodFromT()
> --------------------------------------------------------
>
>                 Key: GROOVY-9455
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9455
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.19, 2.5.10, 3.0.2
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 4.0.0-alpha-1, 3.0.3, 2.5.16
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Variant of GROOVY-6429, GROOVY-8321, GROOVY-8412, GROOVY-8523 and GROOVY-8645.
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test(x) {
>   if (!(x instanceof Number)) {
>     x.byteValue() // accidentally had this and got no compiler error; STC has 
> Number for typeof(x)
>   } else {
>     // ...
>   }
> }
> {code}
> Since the inferred type of "x" inside then block is Number, the IDE shows 
> code assist for Number, which is misleading.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to