[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:
committed by
Space Team
parent
22f55b3dc4
commit
3d6ec0ec75
+3
-3
@@ -1,7 +1,4 @@
|
||||
FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
|
||||
TYPEALIAS name:KR visibility:public expandedType:<root>.KRunnable
|
||||
TYPEALIAS name:KSS visibility:public expandedType:<root>.KSupplier<kotlin.String>
|
||||
TYPEALIAS name:KCS visibility:public expandedType:<root>.KConsumer<kotlin.String>
|
||||
CLASS INTERFACE name:KRunnable modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KRunnable
|
||||
FUN name:run visibility:public modality:ABSTRACT <> ($this:<root>.KRunnable) returnType:kotlin.Unit
|
||||
@@ -19,6 +16,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
TYPEALIAS name:KR visibility:public expandedType:<root>.KRunnable
|
||||
CLASS INTERFACE name:KSupplier modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KSupplier<T of <root>.KSupplier>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
@@ -37,6 +35,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
TYPEALIAS name:KSS visibility:public expandedType:<root>.KSupplier<kotlin.String>
|
||||
CLASS INTERFACE name:KConsumer modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KConsumer<T of <root>.KConsumer>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
@@ -56,6 +55,7 @@ FILE fqName:<root> fileName:/funInterfaceConstructorReference.kt
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
TYPEALIAS name:KCS visibility:public expandedType:<root>.KConsumer<kotlin.String>
|
||||
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction1<kotlin.Function0<kotlin.Unit>, <root>.KRunnable>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test1 (): kotlin.reflect.KFunction1<kotlin.Function0<kotlin.Unit>, <root>.KRunnable> declared in <root>'
|
||||
|
||||
+3
-3
@@ -1,21 +1,21 @@
|
||||
typealias KR = KRunnable
|
||||
typealias KSS = KSupplier<String>
|
||||
typealias KCS = KConsumer<String>
|
||||
fun interface KRunnable {
|
||||
abstract fun run()
|
||||
|
||||
}
|
||||
|
||||
typealias KR = KRunnable
|
||||
fun interface KSupplier<T : Any?> {
|
||||
abstract fun get(): T
|
||||
|
||||
}
|
||||
|
||||
typealias KSS = KSupplier<String>
|
||||
fun interface KConsumer<T : Any?> {
|
||||
abstract fun accept(x: T)
|
||||
|
||||
}
|
||||
|
||||
typealias KCS = KConsumer<String>
|
||||
fun test1(): KFunction1<Function0<Unit>, KRunnable> {
|
||||
return { // BLOCK
|
||||
local fun KRunnable(function: Function0<Unit>): KRunnable {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
FILE fqName:<root> fileName:/kt16905.kt
|
||||
TYPEALIAS name:OI visibility:public expandedType:<root>.Outer.Inner
|
||||
CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Outer
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Outer [primary]
|
||||
@@ -81,6 +80,7 @@ FILE fqName:<root> fileName:/kt16905.kt
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
TYPEALIAS name:OI visibility:public expandedType:<root>.Outer.Inner
|
||||
FUN name:test visibility:public modality:FINAL <> () returnType:<root>.Outer.Inner
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test (): <root>.Outer.Inner declared in <root>'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
typealias OI = Inner
|
||||
class Outer {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
@@ -35,6 +34,7 @@ class Outer {
|
||||
|
||||
}
|
||||
|
||||
typealias OI = Inner
|
||||
fun test(): Inner {
|
||||
return Outer().Inner()
|
||||
}
|
||||
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
FILE fqName:<root> fileName:/specializedTypeAliasConstructorCall.kt
|
||||
TYPEALIAS name:IntAlias visibility:public expandedType:<root>.Cell<kotlin.Int>
|
||||
CLASS CLASS name:Cell modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Cell<T of <root>.Cell>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
CONSTRUCTOR visibility:public <> (value:T of <root>.Cell) returnType:<root>.Cell<T of <root>.Cell> [primary]
|
||||
VALUE_PARAMETER name:value index:0 type:T of <root>.Cell
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Cell modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:value visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:value type:T of <root>.Cell visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'value: T of <root>.Cell declared in <root>.Cell.<init>' type=T of <root>.Cell origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-value> visibility:public modality:FINAL <> ($this:<root>.Cell<T of <root>.Cell>) returnType:T of <root>.Cell
|
||||
correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Cell<T of <root>.Cell>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-value> (): T of <root>.Cell declared in <root>.Cell'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of <root>.Cell visibility:private [final]' type=T of <root>.Cell origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Cell<T of <root>.Cell> declared in <root>.Cell.<get-value>' type=<root>.Cell<T of <root>.Cell> 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:test visibility:public modality:FINAL <> () returnType:<root>.Cell<kotlin.Int>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test (): <root>.Cell<kotlin.Int> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (value: T of <root>.Cell) declared in <root>.Cell' type=<root>.Cell<kotlin.Int> origin=null
|
||||
<class: T>: kotlin.Int
|
||||
value: CONST Int type=kotlin.Int value=42
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
typealias IntAlias = Cell<Int>
|
||||
class Cell<T : Any?> {
|
||||
constructor(value: T) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val value: T
|
||||
field = value
|
||||
get
|
||||
|
||||
}
|
||||
|
||||
fun test(): Cell<Int> {
|
||||
return Cell<Int>(value = 42)
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class Cell<T>(val value: T)
|
||||
|
||||
typealias IntAlias = Cell<Int>
|
||||
|
||||
+2
-2
@@ -1,6 +1,4 @@
|
||||
FILE fqName:<root> fileName:/typeAliasConstructorReference.kt
|
||||
TYPEALIAS name:CA visibility:public expandedType:<root>.C
|
||||
TYPEALIAS name:NA visibility:public expandedType:<root>.Host.Nested
|
||||
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
|
||||
CONSTRUCTOR visibility:public <> (x:kotlin.Int) returnType:<root>.C [primary]
|
||||
@@ -21,6 +19,7 @@ FILE fqName:<root> fileName:/typeAliasConstructorReference.kt
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
TYPEALIAS name:CA visibility:public expandedType:<root>.C
|
||||
CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Host
|
||||
CONSTRUCTOR visibility:private <> () returnType:<root>.Host [primary]
|
||||
@@ -60,6 +59,7 @@ FILE fqName:<root> fileName:/typeAliasConstructorReference.kt
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
TYPEALIAS name:NA visibility:public expandedType:<root>.Host.Nested
|
||||
PROPERTY name:test1 visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.Function1<kotlin.Int, <root>.C> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
|
||||
+2
-2
@@ -1,5 +1,3 @@
|
||||
typealias CA = C
|
||||
typealias NA = Nested
|
||||
class C {
|
||||
constructor(x: Int) /* primary */ {
|
||||
super/*Any*/()
|
||||
@@ -9,6 +7,7 @@ class C {
|
||||
|
||||
}
|
||||
|
||||
typealias CA = C
|
||||
object Host {
|
||||
private constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
@@ -27,6 +26,7 @@ object Host {
|
||||
|
||||
}
|
||||
|
||||
typealias NA = Nested
|
||||
val test1: Function1<Int, C>
|
||||
field = C::<init>
|
||||
get
|
||||
|
||||
Reference in New Issue
Block a user