c2cf4aa2b5
If new inference is enabled only for IDE analysis, then this feature will be disabled to reduce difference between new and old inference, but if new inference is enabled in the compiler, then this feature will be enabled too to preserve behavior of new inference for compilation #KT-32175 Fixed #KT-32143 Fixed #KT-32123 Fixed #KT-32230 Fixed
25 lines
784 B
Kotlin
Vendored
25 lines
784 B
Kotlin
Vendored
object ForceSam : java.util.Comparator<Runnable> {
|
|
override fun compare(o1: Runnable, o2: Runnable): Int = 0
|
|
}
|
|
|
|
fun test(r: Runnable) {
|
|
ForceSam.compare(r, r)
|
|
ForceSam.compare({}, {})
|
|
|
|
ForceSam.compare(r, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is () -> Unit but Runnable was expected">{}</error>)
|
|
ForceSam.compare(<error descr="[TYPE_MISMATCH] Type mismatch: inferred type is () -> Unit but Runnable was expected">{}</error>, r)
|
|
}
|
|
|
|
// Check that new inference is enabled
|
|
object Scope {
|
|
interface A
|
|
interface B<T>
|
|
class C<T>
|
|
|
|
fun <T, K> foo(<warning descr="[UNUSED_PARAMETER] Parameter 'c' is never used">c</warning>: C<T>) where K : A, K : B<T> {}
|
|
|
|
fun usage(c: C<Any>) {
|
|
foo(c) // should compile only in NI
|
|
}
|
|
}
|