NI: do type checking for anonymous functions not inside a call
^KT-38890 Fixed ^KT-38439 Fixed
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun take(fn: () -> List<String>) {}
|
||||
fun <L> inferFromLambda(fn: () -> L): L = TODO()
|
||||
fun <L> inferFromLambda2(fn: (Int) -> L): L = TODO()
|
||||
|
||||
fun <T> materialize(): T = TODO()
|
||||
fun <I> id(arg: I) = arg
|
||||
|
||||
fun testFunctions() {
|
||||
take { materialize() }
|
||||
take(fun() = materialize())
|
||||
take(fun(): List<String> = materialize())
|
||||
take(fun(): List<String> {
|
||||
return materialize()
|
||||
})
|
||||
}
|
||||
|
||||
fun testNestedCalls() {
|
||||
id<String>(inferFromLambda { materialize() })
|
||||
id<String>(inferFromLambda(fun() = materialize()))
|
||||
id<String>(inferFromLambda2(fun() = materialize()))
|
||||
}
|
||||
Reference in New Issue
Block a user