// FIR_IDENTICAL // !CHECK_TYPE // Incorrect "type mismatch" error for generic extension safe call (required not-null, found nullable) // FILE: B.java public class B { public String gav() { return ""; } public static B create() { return new B(); } } // FILE: A.kt class A { fun gav() = "" } fun foo(x: R) = x fun A.bar() = "" fun B.bar() = "" fun foo(l: A?) { // No errors should be here foo(l?.bar()) checkType { _() } foo(l?.gav()) checkType { _() } if (l != null) { foo(l?.bar()) checkType { _() } foo(l?.gav()) checkType { _() } } } fun fooNotNull(l: A) { // No errors should be here foo(l?.bar()) checkType { _() } foo(l?.gav()) checkType { _() } } fun bar() { val l = B.create() foo(l?.bar()) checkType { _() } foo(l?.gav()) checkType { _() } }