KT-6774 Cannot find equals() when comparing with null

#KT-6774 Fixed
This commit is contained in:
Andrey Breslav
2015-02-13 19:41:36 +01:00
parent 99b049af20
commit c61a29d4f5
4 changed files with 52 additions and 3 deletions
@@ -0,0 +1,30 @@
// KT-6774 Cannot find equals() when comparing with null
fun <T: Any> fn(t1: T, t2: T?) {
val x = if (true) t1 else t2
x == null
x?.equals(null)
x?.hashCode()
x.toString()
x!!.hashCode()
val y = t2 ?: t1
y == t1
y.equals(null)
y.hashCode()
y.toString()
y.hashCode()
}
trait Tr {
fun foo()
}
fun <T: Tr> fn(t1: T, t2: T?) {
val x = if (true) t1 else t2
x?.foo()
x!!.foo()
val y = t2 ?: t1
y.foo()
}
@@ -0,0 +1,11 @@
package
internal fun </*0*/ T : Tr> fn(/*0*/ t1: T, /*1*/ t2: T?): kotlin.Unit
internal fun </*0*/ T : kotlin.Any> fn(/*0*/ t1: T, /*1*/ t2: T?): kotlin.Unit
internal trait Tr {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
internal abstract fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}