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 2024/07/09 17:22:00 UTC

[jira] [Created] (GROOVY-11438) STC: loss of precision check for typecast number literals

Eric Milles created GROOVY-11438:
------------------------------------

             Summary: STC: loss of precision check for typecast number literals
                 Key: GROOVY-11438
                 URL: https://issues.apache.org/jira/browse/GROOVY-11438
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
@TypeChecked test() {
  byte b = (short) 123
}
{code}

This code warns of "Possible loss of precision".  However, the number is okay and there is no way to write a {{byte}} or {{short}} literal without a typecast.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)