You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/06/06 18:53:00 UTC
[jira] [Updated] (GROOVY-11083) STC: closure param's default not type-checked (method target)
[ https://issues.apache.org/jira/browse/GROOVY-11083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-11083:
---------------------------------
Summary: STC: closure param's default not type-checked (method target) (was: STC: closure param default not type-checked)
> STC: closure param's default not type-checked (method target)
> -------------------------------------------------------------
>
> Key: GROOVY-11083
> URL: https://issues.apache.org/jira/browse/GROOVY-11083
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Minor
>
> Consider the following:
> {code:groovy}
> void setFoo(java.util.function.Consumer<Number> c) {}
> @groovy.transform.TypeChecked
> void test(Date d) {
> foo = { n = d -> }
> }
> {code}
> The default value expression "d" is not compatible with the Number parameter "n". There is no type-checking error for the call case. Direct assignment is checked: "java.util.function.Consumer<Number> c = \{ n = new Date() -> \}" and "def bar = \{ Number n = d -> \}"
--
This message was sent by Atlassian Jira
(v8.20.10#820010)