[JS IR] Fix KClass equals for Nothing type
This commit is contained in:
committed by
Space Team
parent
90498593f3
commit
ad3583ac38
@@ -15,7 +15,14 @@ internal abstract class KClassImpl<T : Any>(
|
||||
get() = TODO()
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return other is KClassImpl<*> && jClass == other.jClass
|
||||
return when (other) {
|
||||
// NothingKClassImpl and ErrorKClass don't provide the jClass property; therefore, process them separately.
|
||||
// This can't be neither NothingKClassImpl nor ErrorKClass because they overload equals.
|
||||
is NothingKClassImpl -> false
|
||||
is ErrorKClass -> false
|
||||
is KClassImpl<*> -> jClass == other.jClass
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: use FQN
|
||||
@@ -74,4 +81,4 @@ internal class ErrorKClass : KClass<Nothing> {
|
||||
override fun equals(other: Any?): Boolean = other === this
|
||||
|
||||
override fun hashCode(): Int = 0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user