Stefanos Chaliasos created GROOVY-9984: ------------------------------------------
Summary: Wrong type inference when passing null Key: GROOVY-9984 URL: https://issues.apache.org/jira/browse/GROOVY-9984 Project: Groovy Issue Type: Bug Reporter: Stefanos Chaliasos I have the following Groovy program. {code:groovy} @groovy.transform.CompileStatic public class Main { public static void main(String[] args) { final A<Integer> x = new A<>(null); baz(x); } public static void baz(A<Integer> x) {} } class A<T> { T f; public A(T f) { this.f = f; } } {code} h2. Actual Behavior The program does not compile, and I get the following error. {code:java} org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Test.groovy: 4: [Static type checking] - Incompatible generic argument types. Cannot assign A <java.lang.Object> to: A <Integer> @ line 4, column 26. final A<Integer> x = new A<>(null); ^ Test.groovy: 5: [Static type checking] - Cannot call Main#baz(A <java.lang.Integer>) with arguments [A <java.lang.Object>] @ line 5, column 5. baz(x); ^ 2 errors {code} h2. Expected Behavior Compile successfully. h2. Comment This should be a regression bug because it compiles with the 4.0.0-alpha-2 compiler. h2. Affected Version This programs fails when compiled with the compiler from the master (commit: f0eea862549529ef4e93fafe337f86dd4ac98751). -- This message was sent by Atlassian Jira (v8.3.4#803005)