You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/02/03 22:33:01 UTC
[jira] [Closed] (GROOVY-10228) STC fails to substitute type variable in the presence of the diamond operator and a function call
[ https://issues.apache.org/jira/browse/GROOVY-10228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-10228.
------------------------------
> STC fails to substitute type variable in the presence of the diamond operator and a function call
> -------------------------------------------------------------------------------------------------
>
> Key: GROOVY-10228
> URL: https://issues.apache.org/jira/browse/GROOVY-10228
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-beta-2
>
>
> I think this bug is related to GROOVY-9963.
>
> I have the following program
> {code:java}
> class A<T> {
> T x; A(T x) {
> this.x = x;
> }
> T getX() {
> return x;
> }
> }
> class B {}
> class Main {
> public static void m1() {
> def x = new B();
> m2(new A<>(x).getX());
> } public static void m2(B x) {}
> }
> {code}
> h3. Actual behaviour
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 18: [Static type checking] - Cannot find matching method Main#m2(T). Please check if the declared type is correct and if the method exists.
> @ line 18, column 5.
> m2(new A<>(x).getX());
> ^1 error
> {code}
> h3. Expected behaviour
> Compile successfully
>
> Tested against master.
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)