3a98c84105
Fix completion of anonymous functions with expression body without expected type. Premature completion led to losing type info from outer calls. Also report type mismatches on empty lambda expressions. KT-34729 In progress
20 lines
431 B
Kotlin
Vendored
20 lines
431 B
Kotlin
Vendored
// !WITH_NEW_INFERENCE
|
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
// !LANGUAGE: +NewInference
|
|
|
|
interface ILength {
|
|
val length: Int
|
|
}
|
|
|
|
class Impl(override val length: Int) : ILength
|
|
|
|
fun <T> foo(a: (Int) -> T) = 0
|
|
fun <T : ILength> bar(a: (Int) -> T) {
|
|
a(42).length
|
|
}
|
|
|
|
fun test() {
|
|
foo<String> <!NI;TYPE_MISMATCH!>{ <!OI;TYPE_MISMATCH!><!>}<!>
|
|
bar<Impl> <!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>{ <!OI;TYPE_MISMATCH!><!>}<!>
|
|
}
|