[
https://issues.apache.org/jira/browse/GROOVY-12456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18131612#comment-18131612
]
ASF GitHub Bot commented on GROOVY-12456:
-----------------------------------------
paulk-asert commented on PR #3000:
URL: https://github.com/apache/groovy/pull/3000#issuecomment-6390287094
Thanks Daniel.
1. User-written dynamic keys are still rejected by STC ("Dynamic keys in
map-style constructors are unsupported in static type checking") before this
transformer runs. Only generated keys get past that check, because
addStaticTypeError skips nodes without a source position. Those now use the
normal dynamic property set: the bytecode calls the generated key (so Spock's
recording still happens), casts it to String and uses
ScriptBytecodeAdapter.setGroovyObjectProperty, rather than borrowing the key's
method target.
2. Checked: #3000 and #3013 merge without conflict. The constant-key guard
ends up in #3013's literal-map setProperties, and its non-literal path doesn't
use per-entry targets. Groovy12456, ConstructorsSTCTest and
StaticCompileConstructorsTest all pass on the merged tree.
3. The inner-class form goes through the same entry loop, so I've left the
test focused on the reported failure.
> Regression in SC: Binding failed for arguments
> ----------------------------------------------
>
> Key: GROOVY-12456
> URL: https://issues.apache.org/jira/browse/GROOVY-12456
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 5.0.3, 5.1.3, 6.0.0
> Reporter: Björn Kautler
> Assignee: Paul King
> Priority: Major
>
> Given this snippet:
> {code:groovy}
> @groovy.transform.CompileStatic
> class Foo extends Specification {
> def foo() {
> expect:
> new Person(name: 'fred')
> }
> }
> class Person {
> def name
> }
> {code}
> If you run it in Groovy console, it works fine up to Groovy 4 and starts
> failing with Groovy 5 and newer with the message:
> {code}
> script.groovy: -1: Binding failed for arguments [java.lang.Object] and
> parameters [int, java.lang.Object] @ line -1, column -1. {code}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)