Uast: making ULambdaExpression.functionalInterfaceType return non-null values for explicitly typed SAM-s with Java interfaces (KT-28272)
This commit is contained in:
Vendored
+22
-1
@@ -1,3 +1,8 @@
|
||||
import java.lang.Thread
|
||||
import java.lang.Runnable
|
||||
|
||||
import java.util.concurrent.Callable
|
||||
import java.util.function.Supplier
|
||||
|
||||
val notSam = { /* Not SAM */ }
|
||||
var foo: java.lang.Runnable = {/* Variable */}
|
||||
@@ -10,4 +15,20 @@ fun bar(): java.lang.Runnable {
|
||||
|
||||
val baz = java.lang.Runnable { /* SAM */ }
|
||||
|
||||
fun runRunnable(r: java.lang.Runnable) = r()
|
||||
fun runRunnable(r: java.lang.Runnable) = r()
|
||||
|
||||
fun test1() {
|
||||
val thread1 = Thread({ println("hello1") })
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val thread2 = Thread(Runnable { println("hello2") })
|
||||
}
|
||||
|
||||
fun test3() {
|
||||
ambiguousSamAcceptor(Supplier { "Supplier" })
|
||||
ambiguousSamAcceptor(Callable { "Callable" })
|
||||
}
|
||||
|
||||
fun ambiguousSamAcceptor(s: Supplier<String>): String = TODO()
|
||||
fun ambiguousSamAcceptor(s: Callable<String>): String = TODO()
|
||||
Reference in New Issue
Block a user