Files
kotlin-fork/compiler/testData/diagnostics/tests/samConversions/samPriorityVsGenericCompatibilityEnabled.kt
T
Mikhail Glukhikh 087edc026d K2: discriminate particular SAMs in the first place in ConeOverloadConflictResolver
Before this commit, we discriminated particular candidates with SAM
during resolution stages. More precisely, candidates from Kotlin
which used Java SAM types, were discriminated allowing go up the tower
for better candidates. After disabling compatibility mode for new
inference, it's not so, but now we discriminate similar candidates
in ConeOverloadConflictResolver. This does not allow going up the tower,
but allows to select better candidate at similar tower level.

Related to KT-63558, KT-64306
2023-12-21 07:43:38 +00:00

15 lines
366 B
Kotlin
Vendored

// FIR_IDENTICAL
// !LANGUAGE: -DisableCompatibilityModeForNewInference
// SKIP_TXT
// FULL_JDK
fun <T> bar(action: () -> T): T = action()
fun bar(action: java.lang.Runnable) { }
fun foo(): String = ""
fun main() {
val x = bar() { foo() } // OK with default current 1.5/1.6, Error with DisableCompatibilityModeForNewInference enabled, Ok in K2
x.length
}