// !LANGUAGE: -NewInference // WITH_RUNTIME // FILE: genericSamProjectedOut.kt import example.SomeJavaClass fun test(a: 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[{}] } // 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 void plus(Hello hello) { ((Hello)hello).invoke("OK"); } public void get(Hello hello) { ((Hello)hello).invoke("OK"); } }