[Raw FIR] don't add an implicit Any super reference to kotlin/Any itself

KTIJ-27966
This commit is contained in:
Pavel Kirpichenkov
2023-11-29 20:47:57 +02:00
committed by Space Team
parent d7190af72d
commit c4fe7e4453
16 changed files with 232 additions and 8 deletions
@@ -0,0 +1,33 @@
package kotlin
/**
* The root of the Kotlin class hierarchy. Every Kotlin class has [Any] as a superclass.
*/
public open class Any {
/**
* Indicates whether some other object is "equal to" this one. Implementations must fulfil the following
* requirements:
*
* * Reflexive: for any non-null value `x`, `x.equals(x)` should return true.
* * Symmetric: for any non-null values `x` and `y`, `x.equals(y)` should return true if and only if `y.equals(x)` returns true.
* * Transitive: for any non-null values `x`, `y`, and `z`, if `x.equals(y)` returns true and `y.equals(z)` returns true, then `x.equals(z)` should return true.
* * Consistent: for any non-null values `x` and `y`, multiple invocations of `x.equals(y)` consistently return true or consistently return false, provided no information used in `equals` comparisons on the objects is modified.
* * Never equal to null: for any non-null value `x`, `x.equals(null)` should return false.
*
* Read more about [equality](https://kotlinlang.org/docs/reference/equality.html) in Kotlin.
*/
public open operator fun equals(other: Any?): Boolean
/**
* Returns a hash code value for the object. The general contract of `hashCode` is:
*
* * Whenever it is invoked on the same object more than once, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified.
* * If two objects are equal according to the `equals()` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
*/
public open fun hashCode(): Int
/**
* Returns a string representation of the object.
*/
public open fun toString(): String
}
@@ -0,0 +1,11 @@
FILE: kotlinAny.kt
public open class Any {
public? constructor(): R|kotlin/Any|
public open operator fun equals(other: Any?): Boolean
public open fun hashCode(): Int
public open fun toString(): String
}
@@ -0,0 +1,11 @@
FILE: kotlinAny.kt
public open class Any {
public? [ContainingClassKey=Any] constructor(): R|kotlin/Any|
public open operator fun equals(other: Any?): Boolean
public open fun hashCode(): Int
public open fun toString(): String
}
@@ -0,0 +1,9 @@
package kotlin
class Owner {
class Any /* kotlin.Any should be a supertype */
}
fun foo() {
class Any /* kotlin.Any should be a supertype */
}
@@ -0,0 +1,15 @@
FILE: kotlinAnyNonTopLevel.kt
public? final? class Owner : R|kotlin/Any| {
public? constructor(): R|kotlin/Owner| {
LAZY_super<R|kotlin/Any|>
}
public? final? class Any : R|kotlin/Any| {
public? constructor(): R|kotlin/Owner.Any| {
LAZY_super<R|kotlin/Any|>
}
}
}
public? final? fun foo(): R|kotlin/Unit| { LAZY_BLOCK }
@@ -0,0 +1,23 @@
FILE: kotlinAnyNonTopLevel.kt
public? final? class Owner : R|kotlin/Any| {
public? [ContainingClassKey=Owner] constructor(): R|kotlin/Owner| {
super<R|kotlin/Any|>()
}
public? final? class Any : R|kotlin/Any| {
public? [ContainingClassKey=Any] constructor(): R|kotlin/Owner.Any| {
super<R|kotlin/Any|>()
}
}
}
public? final? fun foo(): R|kotlin/Unit| {
local final? class Any : R|kotlin/Any| {
public? [ContainingClassKey=Any] constructor(): R|<local>/Any| {
super<R|kotlin/Any|>()
}
}
}
@@ -0,0 +1,3 @@
package user
public open class Any
@@ -0,0 +1,7 @@
FILE: userAny.kt
public open class Any : R|kotlin/Any| {
public? constructor(): R|user/Any| {
LAZY_super<R|kotlin/Any|>
}
}
@@ -0,0 +1,7 @@
FILE: userAny.kt
public open class Any : R|kotlin/Any| {
public? [ContainingClassKey=Any] constructor(): R|user/Any| {
super<R|kotlin/Any|>()
}
}