Support smart cast for nullability in LHS of class literal
#KT-16291 Fixed
This commit is contained in:
@@ -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"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private final @org.jetbrains.annotations.NotNull field s: java.lang.String
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
|
||||
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class SmartCastKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
Reference in New Issue
Block a user