[FIR2IR] Automatically store IR declaration in its parent upon creation

Previously, creating a declaration with Fir2IrCallableDeclarationsGenerator/
  Fir2IrClassifiersGenerator didn't guarantee that this declaration will
  be actually added to the list of parent class/file declarations, which
  lead to situations when FIR2IR created some declarations in the air
  (mostly fake-overrides)
This commit is contained in:
Dmitriy Novozhilov
2023-10-05 12:39:13 +03:00
committed by Space Team
parent 22f55b3dc4
commit 3d6ec0ec75
96 changed files with 417 additions and 2062 deletions
@@ -1,97 +0,0 @@
FILE fqName:<root> fileName:/integerCoercionToT.kt
TYPEALIAS name:CInt32Var visibility:public expandedType:<root>.CInt32VarX<kotlin.Int>
CLASS INTERFACE name:CPointed modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CPointed
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:reinterpret visibility:public modality:FINAL <T> ($receiver:<root>.CPointed) returnType:T of <root>.reinterpret [inline]
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.CPointed] reified:true
$receiver: VALUE_PARAMETER name:<this> type:<root>.CPointed
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun reinterpret <T> (): T of <root>.reinterpret declared in <root>'
CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null
CLASS CLASS name:CInt32VarX modality:FINAL visibility:public superTypes:[<root>.CPointed]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CInt32VarX<T of <root>.CInt32VarX>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
CONSTRUCTOR visibility:public <> () returnType:<root>.CInt32VarX<T of <root>.CInt32VarX> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:CInt32VarX modality:FINAL visibility:public superTypes:[<root>.CPointed]'
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.CPointed
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in <root>.CPointed
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in <root>.CPointed
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
PROPERTY name:value visibility:public modality:FINAL [var]
FUN name:<get-value> visibility:public modality:FINAL <T_INT> ($receiver:<root>.CInt32VarX<T_INT of <root>.<get-value>>) returnType:T_INT of <root>.<get-value>
correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [var]
TYPE_PARAMETER name:T_INT index:0 variance: superTypes:[kotlin.Int] reified:false
$receiver: VALUE_PARAMETER name:<this> type:<root>.CInt32VarX<T_INT of <root>.<get-value>>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-value> <T_INT> (): T_INT of <root>.<get-value> declared in <root>'
CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null
FUN name:<set-value> visibility:public modality:FINAL <T_INT> ($receiver:<root>.CInt32VarX<T_INT of <root>.<set-value>>, value:T_INT of <root>.<set-value>) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [var]
TYPE_PARAMETER name:T_INT index:0 variance: superTypes:[kotlin.Int] reified:false
$receiver: VALUE_PARAMETER name:<this> type:<root>.CInt32VarX<T_INT of <root>.<set-value>>
VALUE_PARAMETER name:value index:0 type:T_INT of <root>.<set-value>
BLOCK_BODY
CLASS CLASS name:IdType modality:FINAL visibility:public superTypes:[<root>.CPointed]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IdType
CONSTRUCTOR visibility:public <> (value:kotlin.Int) returnType:<root>.IdType [primary]
VALUE_PARAMETER name:value index:0 type:kotlin.Int
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:IdType modality:FINAL visibility:public superTypes:[<root>.CPointed]'
PROPERTY name:value visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Int visibility:private [final]
EXPRESSION_BODY
GET_VAR 'value: kotlin.Int declared in <root>.IdType.<init>' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-value> visibility:public modality:FINAL <> ($this:<root>.IdType) returnType:kotlin.Int
correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.IdType
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-value> (): kotlin.Int declared in <root>.IdType'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.IdType declared in <root>.IdType.<get-value>' type=<root>.IdType origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.CPointed
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in <root>.CPointed
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in <root>.CPointed
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:foo visibility:public modality:FINAL <> (value:<root>.IdType, cv:<root>.CInt32VarX<kotlin.Int>) returnType:kotlin.Unit
VALUE_PARAMETER name:value index:0 type:<root>.IdType
VALUE_PARAMETER name:cv index:1 type:<root>.CInt32VarX<kotlin.Int>
BLOCK_BODY
CALL 'public final fun <set-value> <T_INT> (value: T_INT of <root>.<set-value>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=EQ
<T_INT>: kotlin.Int
$receiver: GET_VAR 'cv: <root>.CInt32VarX<kotlin.Int> declared in <root>.foo' type=<root>.CInt32VarX<kotlin.Int> origin=null
value: CALL 'public final fun <get-value> (): kotlin.Int declared in <root>.IdType' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'value: <root>.IdType declared in <root>.foo' type=<root>.IdType origin=null
@@ -1,41 +0,0 @@
typealias CInt32Var = CInt32VarX<Int>
interface CPointed {
}
inline fun <reified T : CPointed> CPointed.reinterpret(): T {
return TODO()
}
class CInt32VarX<T : Any?> : CPointed {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
var <T_INT : Int> CInt32VarX<T_INT>.value: T_INT
get(): T_INT {
return TODO()
}
set(value: T_INT) {
}
class IdType : CPointed {
constructor(value: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
val value: Int
field = value
get
}
fun foo(value: IdType, cv: CInt32VarX<Int>) {
cv.<set-value><Int>(value = value.<get-value>())
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface CPointed
inline fun <reified T : CPointed> CPointed.reinterpret(): T = TODO()
@@ -1,47 +0,0 @@
FILE fqName:<root> fileName:/typeAliasCtorForGenericClass.kt
TYPEALIAS name:B visibility:public expandedType:<root>.A<X of <root>.B>
TYPE_PARAMETER name:X index:0 variance: superTypes:[kotlin.Any?] reified:false
TYPEALIAS name:B2 visibility:public expandedType:<root>.A<<root>.A<T of <root>.B2>>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A<Q of <root>.A>
TYPE_PARAMETER name:Q index:0 variance: superTypes:[kotlin.Any?] reified:false
CONSTRUCTOR visibility:public <> (q:Q of <root>.A) returnType:<root>.A<Q of <root>.A> [primary]
VALUE_PARAMETER name:q index:0 type:Q of <root>.A
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:q visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:q type:Q of <root>.A visibility:private [final]
EXPRESSION_BODY
GET_VAR 'q: Q of <root>.A declared in <root>.A.<init>' type=Q of <root>.A origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-q> visibility:public modality:FINAL <> ($this:<root>.A<Q of <root>.A>) returnType:Q of <root>.A
correspondingProperty: PROPERTY name:q visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.A<Q of <root>.A>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-q> (): Q of <root>.A declared in <root>.A'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:q type:Q of <root>.A visibility:private [final]' type=Q of <root>.A origin=null
receiver: GET_VAR '<this>: <root>.A<Q of <root>.A> declared in <root>.A.<get-q>' type=<root>.A<Q of <root>.A> origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:bar visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
VAR name:b type:<root>.A<kotlin.Int> [val]
CONSTRUCTOR_CALL 'public constructor <init> (q: Q of <root>.A) declared in <root>.A' type=<root>.A<kotlin.Int> origin=null
<class: Q>: kotlin.Int
q: CONST Int type=kotlin.Int value=2
VAR name:b2 type:<root>.A<<root>.A<kotlin.Int>> [val]
CONSTRUCTOR_CALL 'public constructor <init> (q: Q of <root>.A) declared in <root>.A' type=<root>.A<<root>.A<kotlin.Int>> origin=null
<class: Q>: <root>.A<kotlin.Int>
q: GET_VAR 'val b: <root>.A<kotlin.Int> declared in <root>.bar' type=<root>.A<kotlin.Int> origin=null
@@ -1,19 +0,0 @@
typealias B<X : Any?> = A<X>
typealias B2<T : Any?> = A<A<T>>
class A<Q : Any?> {
constructor(q: Q) /* primary */ {
super/*Any*/()
/* <init>() */
}
val q: Q
field = q
get
}
fun bar() {
val b: A<Int> = A<Int>(q = 2)
val b2: A<A<Int>> = A<A<Int>>(q = b)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A<Q>(val q: Q)
typealias B<X> = A<X>