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 2022/05/17 00:09:00 UTC
[jira] [Resolved] (GROOVY-10364) STC does not type check method call when using bounded type parameter as a type argument
[ https://issues.apache.org/jira/browse/GROOVY-10364?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-10364.
----------------------------------
Fix Version/s: 5.0.0-alpha-1
Resolution: Fixed
https://github.com/apache/groovy/commit/8b44c0af6f167892a239804d99149a5f6323d984
> STC does not type check method call when using bounded type parameter as a type argument
> ----------------------------------------------------------------------------------------
>
> Key: GROOVY-10364
> URL: https://issues.apache.org/jira/browse/GROOVY-10364
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-alpha-1
>
>
> I have the following program
> {code:java}
> class A<T> {
> void m(B<T> x, T y) {}
> }
> class B<T> {}
> class Test<X, Y extends X> {
> void m() {
> A<Y> x = new A<Y>();
> x.m(new B<Y>(), (Y) null);
> }
> }
> {code}
> h3. Actual behaviour
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 11: [Static type checking] - Cannot call A#m(B<Y extends X>, Y) with arguments [B<Y>, Y]
> @ line 11, column 5.
> x.m(new B<Y>(), (Y) null);
> ^
> 1 error
> {code}
> h3. Expected behaviour
> Compile successfully
> Tested against master.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)