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 2021/12/30 19:32:00 UTC
[jira] [Created] (GROOVY-10436) STC: closure parameter type-checking: declared vs inferred
Eric Milles created GROOVY-10436:
------------------------------------
Summary: STC: closure parameter type-checking: declared vs inferred
Key: GROOVY-10436
URL: https://issues.apache.org/jira/browse/GROOVY-10436
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Reporter: Eric Milles
Consider the following:
{code:groovy}
import java.util.function.Consumer
def <T> T m(Consumer<? super T> c) {
// ...
}
@groovy.transform.TypeChecked
void test() {
this.m { Number n ->
def big = n.toBigInteger()
}
}
{code}
Recent fixes for closure param STC (GROOVY-8917, GROOVY-10049, GROOVY-10053, etc.) are producing an error for the param "expected Object actual Number" and an error for the call expression "cannot find method Object#toBigInteger()".
{{StaticTypeCheckingVisitor#inferClosureParamterTypes}} does not use closure expressions to determine placeholder types and there are no other type witnesses.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)