[
https://issues.apache.org/jira/browse/GROOVY-7333?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-7333:
--------------------------------
Language: groovy
> Incorrect inferred type in instanceof check of array
> ----------------------------------------------------
>
> Key: GROOVY-7333
> URL: https://issues.apache.org/jira/browse/GROOVY-7333
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 2.3.10, 2.4.1
> Reporter: Cédric Champeau
> Assignee: Cédric Champeau
> Priority: Major
> Fix For: 2.3.11, 2.4.2
>
>
> The following code fails with a weird type checking error:
> {code}
> import groovy.transform.TypeChecked
> int len(byte[] arr) { arr.length }
> @TypeChecked
> def foo(arg) {
> if (arg instanceof byte[]) {
> len(arg)
> }
> }
> foo(new byte[3])
> {code}
> Error:
> [Static type checking] - Cannot call ConsoleScript0#len(byte[]) with
> arguments [<UnionTypejava.lang.Object+[B>]
> at line: 7, column: 7
--
This message was sent by Atlassian Jira
(v8.20.10#820010)