NI: do type checking for anonymous functions not inside a call

^KT-38890 Fixed
^KT-38439 Fixed
This commit is contained in:
Victor Petukhov
2020-05-19 11:31:15 +03:00
parent 425ce8c3ab
commit eff5f3a242
18 changed files with 174 additions and 25 deletions
@@ -1,9 +1,9 @@
// FIR_IDENTICAL
// !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
@@ -20,4 +20,5 @@ fun testFunctions() {
fun testNestedCalls() {
id<String>(inferFromLambda { materialize() })
id<String>(inferFromLambda(fun() = materialize()))
id<String>(inferFromLambda2(<!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>fun<!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>()<!> = materialize()<!>))
}