FIR2IR: set superQualifierSymbol for super call
This commit is contained in:
committed by
Mikhail Glukhikh
parent
57fe01c375
commit
ef09850df8
+17
-3
@@ -175,9 +175,23 @@ internal class CallAndReferenceGenerator(
|
|||||||
}
|
}
|
||||||
when (symbol) {
|
when (symbol) {
|
||||||
is IrConstructorSymbol -> IrConstructorCallImpl.fromSymbolOwner(startOffset, endOffset, type, symbol)
|
is IrConstructorSymbol -> IrConstructorCallImpl.fromSymbolOwner(startOffset, endOffset, type, symbol)
|
||||||
is IrSimpleFunctionSymbol -> IrCallImpl(
|
is IrSimpleFunctionSymbol -> {
|
||||||
startOffset, endOffset, type, symbol, origin = qualifiedAccess.calleeReference.statementOrigin()
|
var superQualifierSymbol: IrClassSymbol? = null
|
||||||
)
|
if (qualifiedAccess.dispatchReceiver is FirQualifiedAccess) {
|
||||||
|
val dispatchReceiverReference = (qualifiedAccess.dispatchReceiver as FirQualifiedAccess).calleeReference
|
||||||
|
if (dispatchReceiverReference is FirSuperReference) {
|
||||||
|
val coneSuperType = dispatchReceiverReference.superTypeRef.coneTypeSafe<ConeClassLikeType>()
|
||||||
|
(coneSuperType?.lookupTag?.toSymbol(session) as? FirClassSymbol<*>)?.let {
|
||||||
|
superQualifierSymbol = classifierStorage.getIrClassSymbol(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IrCallImpl(
|
||||||
|
startOffset, endOffset, type, symbol,
|
||||||
|
origin = qualifiedAccess.calleeReference.statementOrigin(),
|
||||||
|
superQualifierSymbol = superQualifierSymbol
|
||||||
|
)
|
||||||
|
}
|
||||||
is IrPropertySymbol -> {
|
is IrPropertySymbol -> {
|
||||||
val getter = symbol.owner.getter
|
val getter = symbol.owner.getter
|
||||||
val backingField = symbol.owner.backingField
|
val backingField = symbol.owner.backingField
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
interface A {
|
interface A {
|
||||||
fun foo(): Any?
|
fun foo(): Any?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class A {
|
open class A {
|
||||||
open fun foo() = "OK"
|
open fun foo() = "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
// COMMON_COROUTINES_TEST
|
// COMMON_COROUTINES_TEST
|
||||||
|
|||||||
Vendored
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
// COMMON_COROUTINES_TEST
|
// COMMON_COROUTINES_TEST
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
// COMMON_COROUTINES_TEST
|
// COMMON_COROUTINES_TEST
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
// COMMON_COROUTINES_TEST
|
// COMMON_COROUTINES_TEST
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
fun box() = E.E1.f() + E.E2.f()
|
fun box() = E.E1.f() + E.E2.f()
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box() =
|
fun box() =
|
||||||
B().method()
|
B().method()
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +InlineClasses
|
// !LANGUAGE: +InlineClasses
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
interface A {
|
interface A {
|
||||||
fun f(x: String) = x
|
fun f(x: String) = x
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val three = 3
|
val three = 3
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
open class A : Cloneable {
|
open class A : Cloneable {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !JVM_DEFAULT_MODE: enable
|
// !JVM_DEFAULT_MODE: enable
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// JVM_TARGET: 1.8
|
// JVM_TARGET: 1.8
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !JVM_DEFAULT_MODE: enable
|
// !JVM_DEFAULT_MODE: enable
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// JVM_TARGET: 1.8
|
// JVM_TARGET: 1.8
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !JVM_DEFAULT_MODE: enable
|
// !JVM_DEFAULT_MODE: enable
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// JVM_TARGET: 1.8
|
// JVM_TARGET: 1.8
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// JVM_TARGET: 1.8
|
// JVM_TARGET: 1.8
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// JVM_TARGET: 1.8
|
// JVM_TARGET: 1.8
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class A {
|
open class A {
|
||||||
internal open val field = "F"
|
internal open val field = "F"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class A {
|
open class A {
|
||||||
internal open val field = "F"
|
internal open val field = "F"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class A (val s: Int) {
|
open class A (val s: Int) {
|
||||||
open fun foo(): Int {
|
open fun foo(): Int {
|
||||||
return s
|
return s
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class A {
|
open class A {
|
||||||
open fun foo(): Int {
|
open fun foo(): Int {
|
||||||
return 2
|
return 2
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class A {
|
open class A {
|
||||||
open fun foo(): Int {
|
open fun foo(): Int {
|
||||||
return 2
|
return 2
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
enum class A1(val prop1: String) {
|
enum class A1(val prop1: String) {
|
||||||
X("asd"),
|
X("asd"),
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
interface Tr {
|
interface Tr {
|
||||||
fun extra() : String = "_"
|
fun extra() : String = "_"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
interface I
|
interface I
|
||||||
class C : I { fun foo() = super<I>.hashCode() }
|
class C : I { fun foo() = super<I>.hashCode() }
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface Z<T> {
|
interface Z<T> {
|
||||||
fun test(p: T): T {
|
fun test(p: T): T {
|
||||||
return p
|
return p
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface Z<T> {
|
interface Z<T> {
|
||||||
fun test(p: T): T {
|
fun test(p: T): T {
|
||||||
return p
|
return p
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface T1 {
|
interface T1 {
|
||||||
fun foo() = "O"
|
fun foo() = "O"
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
interface A {
|
interface A {
|
||||||
fun foo(o: String): String = o + "K"
|
fun foo(o: String): String = o + "K"
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
open class A {
|
open class A {
|
||||||
open fun test(s: String) = s
|
open fun test(s: String) = s
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
var result = "Fail"
|
var result = "Fail"
|
||||||
|
|
||||||
interface MyTrait
|
interface MyTrait
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface MyTrait
|
interface MyTrait
|
||||||
{
|
{
|
||||||
var property : String
|
var property : String
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface A {
|
interface A {
|
||||||
fun foo(): String {
|
fun foo(): String {
|
||||||
return "OK"
|
return "OK"
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface A {
|
interface A {
|
||||||
fun foo(): Number {
|
fun foo(): Number {
|
||||||
return 42
|
return 42
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface A<T, U : Number, V : Any> {
|
interface A<T, U : Number, V : Any> {
|
||||||
fun foo(t: T, u: U): V? {
|
fun foo(t: T, u: U): V? {
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ FILE fqName:<root> fileName:/enumWithMultipleCtors.kt
|
|||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun f (): kotlin.String declared in <root>.A.Y'
|
RETURN type=kotlin.Nothing from='public final fun f (): kotlin.String declared in <root>.A.Y'
|
||||||
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS
|
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS
|
||||||
$this: CALL 'public open fun f (): kotlin.String declared in <root>.A' type=kotlin.String origin=null
|
$this: CALL 'public open fun f (): kotlin.String declared in <root>.A' superQualifier='CLASS ENUM_CLASS name:A modality:OPEN visibility:public superTypes:[kotlin.Enum<<root>.A>]' type=kotlin.String origin=null
|
||||||
$this: GET_VAR '<this>: <root>.A.Y declared in <root>.A.Y.f' type=<root>.A.Y origin=null
|
$this: GET_VAR '<this>: <root>.A.Y declared in <root>.A.Y.f' type=<root>.A.Y origin=null
|
||||||
other: CONST String type=kotlin.String value="#Y"
|
other: CONST String type=kotlin.String value="#Y"
|
||||||
PROPERTY FAKE_OVERRIDE name:prop1 visibility:public modality:FINAL [fake_override,val]
|
PROPERTY FAKE_OVERRIDE name:prop1 visibility:public modality:FINAL [fake_override,val]
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ FILE fqName:<root> fileName:/implicitNotNullOnDelegatedImplementation.kt
|
|||||||
$this: VALUE_PARAMETER name:<this> type:<root>.K2
|
$this: VALUE_PARAMETER name:<this> type:<root>.K2
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in <root>.K2'
|
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in <root>.K2'
|
||||||
CALL 'public open fun foo (): kotlin.String declared in <root>.JFoo' type=kotlin.String origin=null
|
CALL 'public open fun foo (): kotlin.String declared in <root>.JFoo' superQualifier='CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:JFoo modality:OPEN visibility:public superTypes:[kotlin.Any; <root>.IFoo]' type=kotlin.String origin=null
|
||||||
$this: GET_VAR '<this>: <root>.K2 declared in <root>.K2.foo' type=<root>.K2 origin=null
|
$this: GET_VAR '<this>: <root>.K2 declared in <root>.K2.foo' type=<root>.K2 origin=null
|
||||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
overridden:
|
overridden:
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ FILE fqName:<root> fileName:/qualifiedSuperCalls.kt
|
|||||||
public open fun foo (): kotlin.Unit declared in <root>.IRight
|
public open fun foo (): kotlin.Unit declared in <root>.IRight
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.CBoth
|
$this: VALUE_PARAMETER name:<this> type:<root>.CBoth
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
CALL 'public open fun foo (): kotlin.Unit declared in <root>.ILeft' type=kotlin.Unit origin=null
|
CALL 'public open fun foo (): kotlin.Unit declared in <root>.ILeft' superQualifier='CLASS INTERFACE name:ILeft modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit origin=null
|
||||||
$this: GET_VAR '<this>: <root>.CBoth declared in <root>.CBoth.foo' type=<root>.CBoth origin=null
|
$this: GET_VAR '<this>: <root>.CBoth declared in <root>.CBoth.foo' type=<root>.CBoth origin=null
|
||||||
CALL 'public open fun foo (): kotlin.Unit declared in <root>.IRight' type=kotlin.Unit origin=null
|
CALL 'public open fun foo (): kotlin.Unit declared in <root>.IRight' superQualifier='CLASS INTERFACE name:IRight modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit origin=null
|
||||||
$this: GET_VAR '<this>: <root>.CBoth declared in <root>.CBoth.foo' type=<root>.CBoth origin=null
|
$this: GET_VAR '<this>: <root>.CBoth declared in <root>.CBoth.foo' type=<root>.CBoth origin=null
|
||||||
PROPERTY name:bar visibility:public modality:FINAL [val]
|
PROPERTY name:bar visibility:public modality:FINAL [val]
|
||||||
FUN name:<get-bar> visibility:public modality:FINAL <> ($this:<root>.CBoth) returnType:kotlin.Int
|
FUN name:<get-bar> visibility:public modality:FINAL <> ($this:<root>.CBoth) returnType:kotlin.Int
|
||||||
|
|||||||
+2
-2
@@ -23,7 +23,7 @@ FILE fqName:<root> fileName:/superCalls.kt
|
|||||||
$this: VALUE_PARAMETER name:<this> type:<root>.Base
|
$this: VALUE_PARAMETER name:<this> type:<root>.Base
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in <root>.Base'
|
RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in <root>.Base'
|
||||||
CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null
|
CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' superQualifier='CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Any modality:OPEN visibility:public superTypes:[]' type=kotlin.Int origin=null
|
||||||
$this: GET_VAR '<this>: <root>.Base declared in <root>.Base.hashCode' type=<root>.Base origin=null
|
$this: GET_VAR '<this>: <root>.Base declared in <root>.Base.hashCode' type=<root>.Base origin=null
|
||||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
overridden:
|
overridden:
|
||||||
@@ -45,7 +45,7 @@ FILE fqName:<root> fileName:/superCalls.kt
|
|||||||
public open fun foo (): kotlin.Unit declared in <root>.Base
|
public open fun foo (): kotlin.Unit declared in <root>.Base
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.Derived
|
$this: VALUE_PARAMETER name:<this> type:<root>.Derived
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
CALL 'public open fun foo (): kotlin.Unit declared in <root>.Base' type=kotlin.Unit origin=null
|
CALL 'public open fun foo (): kotlin.Unit declared in <root>.Base' superQualifier='CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit origin=null
|
||||||
$this: GET_VAR '<this>: <root>.Derived declared in <root>.Derived.foo' type=<root>.Derived origin=null
|
$this: GET_VAR '<this>: <root>.Derived declared in <root>.Derived.foo' type=<root>.Derived origin=null
|
||||||
PROPERTY name:bar visibility:public modality:FINAL [val]
|
PROPERTY name:bar visibility:public modality:FINAL [val]
|
||||||
FUN name:<get-bar> visibility:public modality:FINAL <> ($this:<root>.Derived) returnType:kotlin.String
|
FUN name:<get-bar> visibility:public modality:FINAL <> ($this:<root>.Derived) returnType:kotlin.String
|
||||||
|
|||||||
Reference in New Issue
Block a user