[
https://issues.apache.org/jira/browse/GROOVY-11760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles reassigned GROOVY-11760:
------------------------------------
Assignee: Eric Milles
> @CompileStatic method triggers static type checking error in Groovy 5 but not
> Groovy 4
> --------------------------------------------------------------------------------------
>
> Key: GROOVY-11760
> URL: https://issues.apache.org/jira/browse/GROOVY-11760
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 5.0.1
> Reporter: Stephen Albrecht
> Assignee: Eric Milles
> Priority: Major
>
> This script executes in Groovy 4.0.28 but fails to compile in 5.0.1.
> I would expect Groovy 5 to be able to handle this type coercion the same as
> Groovy 4
> {code:java}
> import groovy.transform.CompileStatic
> @CompileStatic
> float getFoo() { 1f / 1 }
> foo{code}
> Groovy 4.0.28
> {code:java}
> Result: 1.0{code}
> Groovy 5.0.1
> {code:java}
> [Static type checking] - Possible loss of precision from double to float
> at line: 5, column: 4{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)