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 2020/11/11 02:01:04 UTC

[jira] [Closed] (GROOVY-9455) STC: no error for if (!(x instanceof T)) x.methodFromT()

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

Paul King closed GROOVY-9455.
-----------------------------

> 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
>
>          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.3.4#803005)