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/10/06 14:44:00 UTC

[jira] [Created] (GROOVY-10787) STC: parameterized property check during map-style construction

Eric Milles created GROOVY-10787:
------------------------------------

             Summary: STC: parameterized property check during map-style construction
                 Key: GROOVY-10787
                 URL: https://issues.apache.org/jira/browse/GROOVY-10787
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
abstract class A<X extends Serializable> {
  X x
}
class C<Y extends Serializable> extends A<Y> {
}
@groovy.transform.TypeChecked
def <Z extends Number> C<Z> m(List<List<Z>> list_of_lists) {
  new C(x: list_of_lists.first()) // cannot assig List<Z> to variable of type X
}
{code}

The map-style construction gives improper error for "X x = list_of_z".  It cannot work out that X is Z in this case.



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