Daniel Sun created GROOVY-12814:
-----------------------------------
Summary: A method call inside tap or with is still not resolved
when used as a special constructor argument
Key: GROOVY-12814
URL: https://issues.apache.org/jira/browse/GROOVY-12814
Project: Groovy
Issue Type: Bug
Components: Compiler
Reporter: Daniel Sun
On master `ca71425976fd2e3da6db9634955ba0d39550a6d4`,
`bugs.Groovy8327#testTapExpressionAsSpecialConstructorArgument2` and
`#testWithExpressionAsSpecialConstructorArgument2` in
`src/test/groovy/bugs/Groovy8327.groovy` are still `@NotYetImplemented`. They
do `this(new A(null).tap { init() })` and `this(new A(null).with { init();
return it })`, expecting `A`'s `init()` to run and leave `b == 42`. The sibling
tests that assign `b = 42` directly already pass.
Re-checked on 22 Nov 2026 (Asia/Taipei) at the same SHA by temporarily removing
@NotYetImplemented and running both methods on JDK 17: both still fail.
Compilation reports "Cannot reference 'init' before supertype constructor has
been called" at this(new A(null).tap { init() }) and at this(new A(null).with {
init(); return it }). The tap / with call used as a special constructor
argument is still not resolved.
**Acceptance criterion:** Both method-call forms work as special constructor
arguments, and the annotations are removed.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)