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/09/02 12:10:00 UTC

[jira] [Created] (GROOVY-10744) STC support assignment of primitive literals to interface types like Comparable and Serializable

Eric Milles created GROOVY-10744:
------------------------------------

             Summary: STC support assignment of primitive literals to interface types like Comparable and Serializable
                 Key: GROOVY-10744
                 URL: https://issues.apache.org/jira/browse/GROOVY-10744
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
@groovy.transform.TypeChecked
void test() {
  Serializable x = 0
  Serializable y = 1.2
  Serializable z = Math.PI
  System.err.println(x.class.name)
  System.err.println(y.class.name)
  System.err.println(z.class.name)
}
test()
{code}

The {{BigDecimal}} literal 1.2 works fine.  The other two give an error.



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