You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2025/06/04 14:46:00 UTC
[jira] [Closed] (GROOVY-11600) Static compiler should treat inner records as static
[ https://issues.apache.org/jira/browse/GROOVY-11600?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-11600.
------------------------------
> Static compiler should treat inner records as static
> ----------------------------------------------------
>
> Key: GROOVY-11600
> URL: https://issues.apache.org/jira/browse/GROOVY-11600
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation, Static Type Checker
> Affects Versions: 4.0.25, 4.0.26
> Reporter: Leonard Brünings
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-beta-1, 4.0.27
>
>
> {code:title=should work|language=groovy}
> @groovy.transform.CompileStatic
> class Reproducer {
> def foo() {
> new MyRecord(42)
> }
> record MyRecord(int i) {}
> }
> {code}
> But fails with {{[Static type checking] - Cannot find matching constructor Reproducer$MyRecord(Reproducer, int)}}
> These work
> {code:title=static record|language=groovy}
> @groovy.transform.CompileStatic
> class Reproducer {
> def foo() {
> new MyRecord(42)
> }
> static record MyRecord(int i) {}
> }
> {code}
> {code:title=static method|language=groovy}
> @groovy.transform.CompileStatic
> class Reproducer {
> static def foo() {
> new MyRecord(42)
> }
> record MyRecord(int i) {}
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)