Support smart cast for nullability in LHS of class literal

#KT-16291 Fixed
This commit is contained in:
Alexander Udalov
2017-02-15 13:43:46 +03:00
parent bae955aafd
commit ba84338862
9 changed files with 97 additions and 7 deletions
@@ -0,0 +1,11 @@
// KT-16291 Smart cast doesn't work when getting class of instance
class Foo(val s: String) {
override fun equals(other: Any?): Boolean {
return other != null && other::class == this::class && s == (other as Foo).s
}
}
fun box(): String {
return if (Foo("a") == Foo("a")) "OK" else "Fail"
}