Uast: making ULambdaExpression.functionalInterfaceType return non-null values for explicitly typed SAM-s with Java interfaces (KT-28272)

This commit is contained in:
Nicolay Mitropolsky
2019-02-18 17:24:40 +03:00
parent a326ba60a3
commit d7584df01b
4 changed files with 148 additions and 48 deletions
+22 -1
View File
@@ -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()