Eric Milles created GROOVY-11400:
------------------------------------

             Summary: STC: closure parameter metadata after re-assignment of 
variable
                 Key: GROOVY-11400
                 URL: https://issues.apache.org/jira/browse/GROOVY-11400
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
@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()
{code}

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.

GROOVY-10072, GROOVY-11394



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to