// TARGET_BACKEND: JVM // WITH_STDLIB // FILE: genericSamProjectedOut.kt import example.SomeJavaClass fun test() { var a: SomeJavaClass = SomeJavaClass() // a::someFunction parameter has type of Nothing // while it's completely safe to pass a lambda for a SAM // since Hello is effectively contravariant by its parameter a.someFunction {} a + {} a[{}] a += {} a[0] = {} } // FILE: example/Hello.java package example; @FunctionalInterface public interface Hello { void invoke(A a); } // FILE: example/SomeJavaClass.java package example; public class SomeJavaClass { public void someFunction(Hello hello) { ((Hello)hello).invoke("OK"); } public SomeJavaClass plus(Hello hello) { ((Hello)hello).invoke("OK"); return this; } public void get(Hello hello) { ((Hello)hello).invoke("OK"); } public void set(int i, Hello hello) { ((Hello)hello).invoke("OK"); } }