Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Consider the following:
@groovy.transform.TypeChecked void test() { def c = { p = 'foo' -> return p } assert c('bar') == 'bar' assert c() == 'foo' c = { p, q = 'baz' -> '' + p + q } assert c('foo', 'bar') == 'foobar' assert c('foo') == 'foobaz' c = { p, q = p.toString() -> '' + p + q } assert c('foo', 'bar') == 'foobar' assert c('foo') == 'foofoo' } test()
When "c" is assigned a new closure, the parameter metadata is not updated on the original variable. This results in errors for "c('foo','bar')" calls, which are not compatible with the original closure signature.