[
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)