Thodoris Sotiropoulos created GROOVY-11035:
----------------------------------------------

             Summary: Inferred type is Object when having a complex inheritance 
chain interfaces
                 Key: GROOVY-11035
                 URL: https://issues.apache.org/jira/browse/GROOVY-11035
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


This seems related to GROOVY-11012.

I have the following program

{code}
import org.apache.commons.collections4.iterators.*;

class Main {
  static final void test() {
    EmptyListIterator<Number> tmp = null;
    Number x = tmp.next();
  }
}
{code}

h3. Actual behavior


{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 6: [Static type checking] - Cannot assign value of type 
java.lang.Object to variable of type java.lang.Number
 @ line 6, column 16.
       Number x = tmp.next();
                  ^

1 error
{code}

h3. Expected behavior 

Compile successfully

h3. Notes

Tested against master (commit: ed4b33c8d5ac71ee4963d6bb391850593c59e5b1)



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

Reply via email to