[ 
https://issues.apache.org/jira/browse/GROOVY-10622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10622:
---------------------------------
    Fix Version/s:     (was: 5.0.0-alpha-1)

> Wrong type is inferred when involving a bounded type parameter in a 
> parameterized method call
> ---------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10622
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10622
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.3
>
>
> I have the following program
> {code}
> class A<T> {
>   T m() {
>     return null;
>   }
> }
> class B {
>   B(byte x) {}
> }
> class C<T> {
>   T x;
>   C(T x) {
>     this.x = x;
>   }
> }
> class Test {
>   <T extends A<Byte>> void test() {
>     C<T> a = new C<T>(null);
>     T x = a.x;
>     new B(x.m()); // should type check
>   }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 23: [Static type checking] - Cannot find matching method 
> B#<init>(java.lang.Object). Please check if the declared type is correct and 
> if the method exists.
>  @ line 23, column 5.
>        new B(x.m());
>        ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> Tested against master (commit: ee12bb52381e8f0583c61fc25d43de1f55b80a87)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to