581db19544
Now test is correct as it was previously, see https://github.com/JetBrains/kotlin/commit/76b3964e96b7a13479e9df95d5927be70eeea712#diff-03626fd0c49fefdea63cff24d50ea9eaL10
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
|
|
}
|
|
}
|