You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Mezentsev Denis Ivanovich (JIRA)" <ji...@apache.org> on 2018/02/12 18:33:00 UTC
[jira] [Created] (GROOVY-8476) Static type checking doesn't
inference argument's type when it's explicitly declared
Mezentsev Denis Ivanovich created GROOVY-8476:
-------------------------------------------------
Summary: Static type checking doesn't inference argument's type when it's explicitly declared
Key: GROOVY-8476
URL: https://issues.apache.org/jira/browse/GROOVY-8476
Project: Groovy
Issue Type: Bug
Components: Static compilation
Affects Versions: 2.4.13, 2.4.3
Environment: Linux workstation 4.14.17-1-lts
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
Groovy compiler version 2.4.13
Reporter: Mezentsev Denis Ivanovich
Attachments: ArgumentTypeCheck.groovy
I can't compile closure without argument's type declaration with or without indy flag:
{code:java}
@groovy.transform.CompileStatic
class ArgumentTypeCheck {
void implicitArgument() { [foo: 1].entrySet().stream().map({ it.value }) }
void explicitArgument() { [foo: 1].entrySet().stream().map({ it -> it.value }) }
}
{code}
implicitArguments is compiled, but often I want to use outer `it` in second level closure, for instance in flatMap and don't want declare argument type.
Why is implicitArgument method compiled successfully?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)