[JS IR] Fix KClass equals for Nothing type

This commit is contained in:
Alexander Korepanov
2023-07-20 17:23:23 +02:00
committed by Space Team
parent 90498593f3
commit ad3583ac38
3 changed files with 98 additions and 2 deletions
@@ -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
}
}