// !CHECK_TYPE // FILE: A.java public class A { public int foo(Runnable r) { return 0; } public String foo(Object r) { return null;} public int bar(Runnable r) { return 1; } public String bar(CharSequence r) { return null; } } // FILE: 1.kt fun fn() {} fun x(a: A, r: Runnable) { a.foo(::fn) checkType { _() } a.foo {} checkType { _() } a.foo(null) checkType { _() } a.foo(Runnable { }) checkType { _() } a.foo(r) checkType { _() } a.foo(123) checkType { _() } a.foo("") checkType { _() } a.bar(::fn) checkType { _() } a.bar {} checkType { _() } a.bar(r) checkType { _() } a.bar(null) a.bar(null as Runnable?) checkType { _() } a.bar(null as CharSequence?) checkType { _() } a.bar("") checkType { _() } a.bar(123) }