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 16:17:00 UTC
[jira] [Resolved] (GROOVY-10787) STC: parameterized property check during map-style construction
[ https://issues.apache.org/jira/browse/GROOVY-10787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-10787.
----------------------------------
Resolution: Fixed
https://github.com/apache/groovy/commit/00d84da2f5b16b2e262f2bc58c4482d76ab6abe3
> 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
> Affects Versions: 2.5.18, 4.0.5, 3.0.13
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
>
> 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<Z> list_of_z) {
> new C(x: list_of_z.first()) // cannot assign Z to variable of type X
> }
> {code}
> The map-style construction gives improper error for "X x = z". It cannot work out that X is Z in this case.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)