You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniil Ovchinnikov (JIRA)" <ji...@apache.org> on 2019/01/22 12:13:00 UTC
[jira] [Created] (GROOVY-8965) instanceof with || inserts wrong
cast
Daniil Ovchinnikov created GROOVY-8965:
------------------------------------------
Summary: instanceof with || inserts wrong cast
Key: GROOVY-8965
URL: https://issues.apache.org/jira/browse/GROOVY-8965
Project: Groovy
Issue Type: Bug
Components: Static compilation
Affects Versions: 2.5.5
Reporter: Daniil Ovchinnikov
{code:java}
@groovy.transform.CompileStatic
def foo(a) {
if (a instanceof Integer || a instanceof Double) {
a.floatValue() // expected: cast to Number; actual: cast to Integer
}
}
println foo(1d).class // CCE: java.lang.Double cannot be cast to java.lang.Integer
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)