You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/08/18 16:08:00 UTC
[jira] [Closed] (GROOVY-6503) Compiler should not fail if a var is assigned inside if-branches
[ https://issues.apache.org/jira/browse/GROOVY-6503?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles closed GROOVY-6503.
-------------------------------
Resolution: Duplicate
> Compiler should not fail if a var is assigned inside if-branches
> -----------------------------------------------------------------
>
> Key: GROOVY-6503
> URL: https://issues.apache.org/jira/browse/GROOVY-6503
> Project: Groovy
> Issue Type: Improvement
> Components: Static Type Checker
> Affects Versions: 2.2.1
> Reporter: Maxim Medvedev
> Priority: Major
>
> The following code should not fail on compilation:
> {code}
> @CompileStatic
> String foo(prop) {
> def var = 4
> if (prop) var = ''; else var = ''
>
> print var.substring(0)
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)