// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER // FILE: GenericRunnable.java public interface GenericRunnable { T invoke(); } // FILE: OurFuture.java public class OurFuture { static OurFuture createOurFuture(T result) { return null; } public OurFuture compose(GenericRunnable> mapper) { return null; } } // FILE: test.kt open class Either { class Left(val a: L) : Either() } fun f1(future: OurFuture, e: Either.Left) { future.compose> { val x = when { true -> OurFuture.createOurFuture(e) else -> throw Exception() } x } } fun f2(future: OurFuture, e: Either.Left) { future.compose> { when { true -> OurFuture.createOurFuture(e) else -> throw Exception() } } }