Files
kotlin-fork/compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.kt
T
Mikhail Zarechenskiy b7849da19e [NI] Introduce flag to change constraint system for overload resolution
This commit doesn't change behaviour of any inference algorithm, it
 introduces opportunity to switch constraint system that is used for
 overload resolution and fix problematic cases by changing one enum
 entry.

 Due to fundamental changes, there are cases where a new inference
 algorithm reports overload resolution ambiguity errors (#KT-31670,
 #KT-31758), which is correct from its point of view. However, this is
 a breaking change and to really make it, we should be very confident
 and have enough motivation for it, therefore, we don't change behavior
 now in order to collect more examples (if there are any). And if we
 find a lot of erroneous examples, we'll be able to change the behavior
 quite simply
2019-06-07 18:38:00 +03:00

24 lines
382 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: a.kt
package a
fun <T> foo(block: (T?) -> Unit) {}
// FILE: b.kt
package b
fun <K> foo(block: (K) -> Unit) {}
// FILE: test.kt
import a.*
import b.*
fun main() {
<!OI;OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!><String> { }
}