Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/factoryPattern/referenceWithTheSameNameAsContainingProperty.kt
T
Mikhail Zarechenskiy 93e9d3e57d Delay check for possibly deferred return type for reference candidate
This issue appeared after recently added new overload for flatMapTo.
 Before that, we picked candidate returning List<T> and completed
 inference, now we also check one more flatMapTo, which is here is
 incorrect and as a result we go into outer scope. Outer scope contains
 one property with deferred type, which introduced error about
 "typechecker has run into recursive problem" even it isn't applicable
 by receiver.

 So, the fix is to check receiver first and only then check return
 type of a candidate.

 #KT-39470 Fixed
2020-06-09 17:36:58 +03:00

22 lines
430 B
Kotlin
Vendored

// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface Foo
// isolated example when we have two canidates where one of them has DeferredType
fun Foo.bar(): Int = 0
fun call(f: Any) {}
val String.bar
get() = call(Foo::bar)
// test from KT-39470
interface Bar {
val serializationWhitelists: List<Foo>
}
val List<Bar>.serializationWhitelists
get() = flatMapTo(LinkedHashSet(), Bar::serializationWhitelists)