Do not allow compareTo() to return Int?

This commit is contained in:
Andrey Breslav
2014-11-26 20:14:44 +03:00
parent 304d22553c
commit 4adf74b46f
4 changed files with 30 additions and 3 deletions
@@ -0,0 +1,12 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class C {
fun compareTo(c: C): Int? = null
}
fun test(c: C) {
c <!COMPARE_TO_TYPE_MISMATCH!><<!> c
c <!COMPARE_TO_TYPE_MISMATCH!><=<!> c
c <!COMPARE_TO_TYPE_MISMATCH!>>=<!> c
c <!COMPARE_TO_TYPE_MISMATCH!>><!> c
}
@@ -0,0 +1,11 @@
package
internal fun test(/*0*/ c: C): kotlin.Unit
internal final class C {
public constructor C()
internal final fun compareTo(/*0*/ c: C): kotlin.Int?
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}