Stefanos Chaliasos created GROOVY-9931: ------------------------------------------
Summary: !instanceof inference does not work Key: GROOVY-9931 URL: https://issues.apache.org/jira/browse/GROOVY-9931 Project: Groovy Issue Type: Bug Components: Static Type Checker Affects Versions: 3.0.7 Reporter: Stefanos Chaliasos I have the following Groovy program {code:groovy} @groovy.transform.CompileStatic class Main { static Integer bar(Object o) { if (o !instanceof Integer) { return 0 } else { return o } } } {code} h2. Actual Behavior The program does not compile, and I get the following error. {code:java} org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Main.groovy: 7: [Static type checking] - Cannot return value of type java.lang.Object on method returning type java.lang.Integer @ line 7, column 9. o ^ 1 error {code} h2. Expected Behavior Compile successfully. -- This message was sent by Atlassian Jira (v8.3.4#803005)