[FIR2IR] Generate property extension receiver references properly
This commit is contained in:
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.fir.symbols.AccessorSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.IrProperty
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstKind
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
@@ -92,7 +93,8 @@ fun FirClassifierSymbol<*>.toSymbol(
|
||||
fun FirReference.toSymbol(
|
||||
session: FirSession,
|
||||
classifierStorage: Fir2IrClassifierStorage,
|
||||
declarationStorage: Fir2IrDeclarationStorage
|
||||
declarationStorage: Fir2IrDeclarationStorage,
|
||||
conversionScope: Fir2IrConversionScope
|
||||
): IrSymbol? {
|
||||
return when (this) {
|
||||
is FirResolvedNamedReference -> {
|
||||
@@ -114,6 +116,10 @@ fun FirReference.toSymbol(
|
||||
when (val boundSymbol = boundSymbol) {
|
||||
is FirClassSymbol<*> -> classifierStorage.getIrClassSymbol(boundSymbol).owner.thisReceiver?.symbol
|
||||
is FirFunctionSymbol -> declarationStorage.getIrFunctionSymbol(boundSymbol).owner.extensionReceiverParameter?.symbol
|
||||
is FirPropertySymbol -> {
|
||||
val property = declarationStorage.getIrPropertyOrFieldSymbol(boundSymbol).owner as? IrProperty
|
||||
property?.let { conversionScope.parentAccessorOfPropertyFromStack(it) }?.symbol
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,16 @@ class Fir2IrConversionScope {
|
||||
|
||||
fun parentFromStack(): IrDeclarationParent = parentStack.last()
|
||||
|
||||
fun parentAccessorOfPropertyFromStack(property: IrProperty): IrSimpleFunction? {
|
||||
for (parent in parentStack.asReversed()) {
|
||||
when (parent) {
|
||||
property.getter -> return property.getter
|
||||
property.setter -> return property.setter
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
fun <T : IrDeclaration> applyParentFromStackTo(declaration: T): T {
|
||||
declaration.parent = parentStack.last()
|
||||
return declaration
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.fir.resolve.isIteratorNext
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.IntegerLiteralTypeApproximationTransformer
|
||||
import org.jetbrains.kotlin.fir.scopes.impl.FirIntegerOperator
|
||||
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||
@@ -32,10 +33,7 @@ import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.builders.*
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
@@ -286,22 +284,32 @@ class Fir2IrVisitor(
|
||||
override fun visitThisReceiverExpression(thisReceiverExpression: FirThisReceiverExpression, data: Any?): IrElement {
|
||||
val calleeReference = thisReceiverExpression.calleeReference
|
||||
val boundSymbol = calleeReference.boundSymbol
|
||||
if (calleeReference.labelName == null && boundSymbol is FirClassSymbol) {
|
||||
// Object case
|
||||
val firClass = boundSymbol.fir as FirClass
|
||||
val irClass = classifierStorage.getCachedIrClass(firClass)!!
|
||||
if (firClass is FirAnonymousObject || firClass is FirRegularClass && firClass.classKind == ClassKind.OBJECT) {
|
||||
if (irClass != conversionScope.lastClass()) {
|
||||
return thisReceiverExpression.convertWithOffsets { startOffset, endOffset ->
|
||||
IrGetObjectValueImpl(startOffset, endOffset, irClass.defaultType, irClass.symbol)
|
||||
if (calleeReference.labelName == null) {
|
||||
if (boundSymbol is FirClassSymbol) {
|
||||
// Object case
|
||||
val firClass = boundSymbol.fir as FirClass
|
||||
val irClass = classifierStorage.getCachedIrClass(firClass)!!
|
||||
if (firClass is FirAnonymousObject || firClass is FirRegularClass && firClass.classKind == ClassKind.OBJECT) {
|
||||
if (irClass != conversionScope.lastClass()) {
|
||||
return thisReceiverExpression.convertWithOffsets { startOffset, endOffset ->
|
||||
IrGetObjectValueImpl(startOffset, endOffset, irClass.defaultType, irClass.symbol)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val dispatchReceiver = conversionScope.dispatchReceiverParameter(irClass)
|
||||
if (dispatchReceiver != null) {
|
||||
return thisReceiverExpression.convertWithOffsets { startOffset, endOffset ->
|
||||
IrGetValueImpl(startOffset, endOffset, dispatchReceiver.type, dispatchReceiver.symbol)
|
||||
val dispatchReceiver = conversionScope.dispatchReceiverParameter(irClass)
|
||||
if (dispatchReceiver != null) {
|
||||
return thisReceiverExpression.convertWithOffsets { startOffset, endOffset ->
|
||||
IrGetValueImpl(startOffset, endOffset, dispatchReceiver.type, dispatchReceiver.symbol)
|
||||
}
|
||||
}
|
||||
} else if (boundSymbol is FirCallableSymbol) {
|
||||
val receiverSymbol = calleeReference.toSymbol(session, classifierStorage, declarationStorage, conversionScope)
|
||||
val receiver = (receiverSymbol?.owner as? IrSimpleFunction)?.extensionReceiverParameter
|
||||
if (receiver != null) {
|
||||
return thisReceiverExpression.convertWithOffsets { startOffset, endOffset ->
|
||||
IrGetValueImpl(startOffset, endOffset, receiver.type, receiver.symbol)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -51,7 +51,7 @@ internal class CallAndReferenceGenerator(
|
||||
private fun ConeKotlinType.toIrType(): IrType = with(typeConverter) { toIrType() }
|
||||
|
||||
fun convertToIrCallableReference(callableReferenceAccess: FirCallableReferenceAccess): IrExpression {
|
||||
val symbol = callableReferenceAccess.calleeReference.toSymbol(session, classifierStorage, declarationStorage)
|
||||
val symbol = callableReferenceAccess.calleeReference.toSymbol(session, classifierStorage, declarationStorage, conversionScope)
|
||||
val type = callableReferenceAccess.typeRef.toIrType()
|
||||
return callableReferenceAccess.convertWithOffsets { startOffset, endOffset ->
|
||||
when (symbol) {
|
||||
@@ -147,7 +147,8 @@ internal class CallAndReferenceGenerator(
|
||||
val symbol = qualifiedAccess.calleeReference.toSymbol(
|
||||
session,
|
||||
classifierStorage,
|
||||
declarationStorage
|
||||
declarationStorage,
|
||||
conversionScope
|
||||
)
|
||||
return typeRef.convertWithOffsets { startOffset, endOffset ->
|
||||
if (qualifiedAccess.calleeReference is FirSuperReference) {
|
||||
@@ -192,7 +193,7 @@ internal class CallAndReferenceGenerator(
|
||||
fun convertToIrSetCall(variableAssignment: FirVariableAssignment): IrExpression {
|
||||
val type = irBuiltIns.unitType
|
||||
val calleeReference = variableAssignment.calleeReference
|
||||
val symbol = calleeReference.toSymbol(session, classifierStorage, declarationStorage)
|
||||
val symbol = calleeReference.toSymbol(session, classifierStorage, declarationStorage, conversionScope)
|
||||
val origin = IrStatementOrigin.EQ
|
||||
return variableAssignment.convertWithOffsets { startOffset, endOffset ->
|
||||
val assignedValue = visitor.convertToIrExpression(variableAssignment.rValue)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
val <T> Array<T>.length : Int get() = this.size
|
||||
|
||||
fun box() = if(arrayOfNulls<Int>(10).length == 10) "OK" else "fail"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
class A(var v: Int) {
|
||||
fun f(x: Int) = x * v
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
val Array<String>.firstElement: String get() = get(0)
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
//For KT-6020
|
||||
import kotlin.reflect.KProperty1
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
var state = ""
|
||||
|
||||
var topLevel: Int
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
var recivier : Any? = "fail"
|
||||
var value2 : Any? = "fail2"
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
val String.id: String
|
||||
get() = this
|
||||
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
var storage = 0
|
||||
|
||||
var Int.foo: Int
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class Delegate {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
open class C
|
||||
|
||||
object O : C()
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
class A(val o: String)
|
||||
|
||||
interface I {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
var log = ""
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
|
||||
fun box() : String {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
val <T> T.valProp: T
|
||||
get() = this
|
||||
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
var <T> T.varProp: T
|
||||
get() = this
|
||||
set(value: T) {}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
public open class TestDelegate<T: Any>(private val initializer: () -> T) {
|
||||
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class Anno
|
||||
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
inline class UInt(private val value: Int) {
|
||||
operator fun plus(other: UInt): UInt = UInt(value + other.asValue())
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
inline class Z(val x: Int)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
inline class InlineLong(val value: Long)
|
||||
inline val Number.toInlineLong get() = InlineLong(this.toLong())
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
//For KT-6020
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: A.kt
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
class A {
|
||||
|
||||
var result: Int = 0;
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
annotation class Anno
|
||||
|
||||
@Anno val Int.foo: Int
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
class Test {
|
||||
val Long.foo: Long
|
||||
get() = this + 1
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
package whats.the.difference
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ FILE fqName:<root> fileName:/kt35550.kt
|
||||
$receiver: VALUE_PARAMETER name:<this> type:T of <root>.I.<get-id>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public open fun <get-id> <T> (): T of <root>.I.<get-id> declared in <root>.I'
|
||||
ERROR_CALL 'Unresolved reference: this@R|/I.id|' type=T of <root>.I.<get-id>
|
||||
GET_VAR '<this>: T of <root>.I.<get-id> declared in <root>.I.<get-id>' type=T of <root>.I.<get-id> 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 [operator] declared in kotlin.Any
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
FILE fqName:<root> fileName:/castToTypeParameter.kt
|
||||
FUN name:castFun visibility:public modality:FINAL <T> (x:kotlin.Any) returnType:T of <root>.castFun
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun castFun <T> (x: kotlin.Any): T of <root>.castFun declared in <root>'
|
||||
TYPE_OP type=T of <root>.castFun origin=CAST typeOperand=T of <root>.castFun
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.castFun' type=kotlin.Any origin=null
|
||||
FUN name:castExtFun visibility:public modality:FINAL <T> ($receiver:kotlin.Any) returnType:T of <root>.castExtFun
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun castExtFun <T> (): T of <root>.castExtFun declared in <root>'
|
||||
TYPE_OP type=T of <root>.castExtFun origin=CAST typeOperand=T of <root>.castExtFun
|
||||
GET_VAR '<this>: kotlin.Any declared in <root>.castExtFun' type=kotlin.Any origin=null
|
||||
PROPERTY name:castExtVal visibility:public modality:FINAL [val]
|
||||
FUN name:<get-castExtVal> visibility:public modality:FINAL <T> ($receiver:T of <root>.<get-castExtVal>) returnType:T of <root>.<get-castExtVal>
|
||||
correspondingProperty: PROPERTY name:castExtVal visibility:public modality:FINAL [val]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:T of <root>.<get-castExtVal>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-castExtVal> <T> (): T of <root>.<get-castExtVal> declared in <root>'
|
||||
TYPE_OP type=T of <root>.<get-castExtVal> origin=CAST typeOperand=T of <root>.<get-castExtVal>
|
||||
ERROR_CALL 'Unresolved reference: this@R|/castExtVal|' type=T of <root>.<get-castExtVal>
|
||||
CLASS CLASS name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Host<T of <root>.Host>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Host<T of <root>.Host> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:castMemberFun visibility:public modality:FINAL <> ($this:<root>.Host<T of <root>.Host>, x:kotlin.Any) returnType:T of <root>.Host
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Host<T of <root>.Host>
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun castMemberFun (x: kotlin.Any): T of <root>.Host declared in <root>.Host'
|
||||
TYPE_OP type=T of <root>.Host origin=CAST typeOperand=T of <root>.Host
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.Host.castMemberFun' type=kotlin.Any origin=null
|
||||
FUN name:castGenericMemberFun visibility:public modality:FINAL <TF> ($this:<root>.Host<T of <root>.Host>, x:kotlin.Any) returnType:TF of <root>.Host.castGenericMemberFun
|
||||
TYPE_PARAMETER name:TF index:0 variance: superTypes:[kotlin.Any?]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Host<T of <root>.Host>
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun castGenericMemberFun <TF> (x: kotlin.Any): TF of <root>.Host.castGenericMemberFun declared in <root>.Host'
|
||||
TYPE_OP type=TF of <root>.Host.castGenericMemberFun origin=CAST typeOperand=TF of <root>.Host.castGenericMemberFun
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.Host.castGenericMemberFun' type=kotlin.Any origin=null
|
||||
FUN name:castMemberExtFun visibility:public modality:FINAL <> ($this:<root>.Host<T of <root>.Host>, $receiver:kotlin.Any) returnType:T of <root>.Host
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Host<T of <root>.Host>
|
||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun castMemberExtFun (): T of <root>.Host declared in <root>.Host'
|
||||
TYPE_OP type=T of <root>.Host origin=CAST typeOperand=T of <root>.Host
|
||||
GET_VAR '<this>: kotlin.Any declared in <root>.Host.castMemberExtFun' type=kotlin.Any origin=null
|
||||
FUN name:castGenericMemberExtFun visibility:public modality:FINAL <TF> ($this:<root>.Host<T of <root>.Host>, $receiver:kotlin.Any) returnType:TF of <root>.Host.castGenericMemberExtFun
|
||||
TYPE_PARAMETER name:TF index:0 variance: superTypes:[kotlin.Any?]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Host<T of <root>.Host>
|
||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun castGenericMemberExtFun <TF> (): TF of <root>.Host.castGenericMemberExtFun declared in <root>.Host'
|
||||
TYPE_OP type=TF of <root>.Host.castGenericMemberExtFun origin=CAST typeOperand=TF of <root>.Host.castGenericMemberExtFun
|
||||
GET_VAR '<this>: kotlin.Any declared in <root>.Host.castGenericMemberExtFun' type=kotlin.Any origin=null
|
||||
PROPERTY name:castMemberExtVal visibility:public modality:FINAL [val]
|
||||
FUN name:<get-castMemberExtVal> visibility:public modality:FINAL <> ($this:<root>.Host<T of <root>.Host>, $receiver:kotlin.Any) returnType:T of <root>.Host
|
||||
correspondingProperty: PROPERTY name:castMemberExtVal visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Host<T of <root>.Host>
|
||||
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-castMemberExtVal> (): T of <root>.Host declared in <root>.Host'
|
||||
TYPE_OP type=T of <root>.Host origin=CAST typeOperand=T of <root>.Host
|
||||
ERROR_CALL 'Unresolved reference: this@R|/Host.castMemberExtVal|' type=kotlin.Any
|
||||
PROPERTY name:castGenericMemberExtVal visibility:public modality:FINAL [val]
|
||||
FUN name:<get-castGenericMemberExtVal> visibility:public modality:FINAL <TV> ($this:<root>.Host<T of <root>.Host>, $receiver:TV of <root>.Host.<get-castGenericMemberExtVal>) returnType:TV of <root>.Host.<get-castGenericMemberExtVal>
|
||||
correspondingProperty: PROPERTY name:castGenericMemberExtVal visibility:public modality:FINAL [val]
|
||||
TYPE_PARAMETER name:TV index:0 variance: superTypes:[kotlin.Any?]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Host<T of <root>.Host>
|
||||
$receiver: VALUE_PARAMETER name:<this> type:TV of <root>.Host.<get-castGenericMemberExtVal>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-castGenericMemberExtVal> <TV> (): TV of <root>.Host.<get-castGenericMemberExtVal> declared in <root>.Host'
|
||||
TYPE_OP type=TV of <root>.Host.<get-castGenericMemberExtVal> origin=CAST typeOperand=TV of <root>.Host.<get-castGenericMemberExtVal>
|
||||
ERROR_CALL 'Unresolved reference: this@R|/Host.castGenericMemberExtVal|' type=TV of <root>.Host.<get-castGenericMemberExtVal>
|
||||
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 [operator] 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
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun <T> castFun(x: Any) = x as T
|
||||
|
||||
fun <T> Any.castExtFun() = this as T
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
FILE fqName:<root> fileName:/genericPropertyCall.kt
|
||||
PROPERTY name:id visibility:public modality:FINAL [val]
|
||||
FUN name:<get-id> visibility:public modality:FINAL <T> ($receiver:T of <root>.<get-id>) returnType:T of <root>.<get-id>
|
||||
correspondingProperty: PROPERTY name:id visibility:public modality:FINAL [val]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:T of <root>.<get-id>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-id> <T> (): T of <root>.<get-id> declared in <root>'
|
||||
ERROR_CALL 'Unresolved reference: this@R|/id|' type=T of <root>.<get-id>
|
||||
PROPERTY name:test visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test type:kotlin.String visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
CALL 'public final fun <get-id> <T> (): T of <root>.<get-id> declared in <root>' type=kotlin.String origin=GET_PROPERTY
|
||||
<T>: kotlin.String
|
||||
$receiver: CONST String type=kotlin.String value="abc"
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test> visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||
correspondingProperty: PROPERTY name:test visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test> (): kotlin.String declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test type:kotlin.String visibility:private [final,static]' type=kotlin.String origin=null
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
val <T> T.id get() = this
|
||||
|
||||
val test = "abc".id
|
||||
@@ -77,7 +77,7 @@ FILE fqName:<root> fileName:/genericPropertyRef.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-additionalText> <T> (): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun getValue (t: kotlin.Any?, p: kotlin.Any): kotlin.Int [operator] declared in <root>.DVal' type=kotlin.Int origin=null
|
||||
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:additionalText$delegate type:<root>.DVal visibility:private [final,static]' type=<root>.DVal origin=null
|
||||
t: ERROR_CALL 'Unresolved reference: this@R|/additionalText|' type=<root>.Value<T of <root>.<get-additionalText>>
|
||||
t: GET_VAR '<this>: <root>.Value<T of <root>.<get-additionalText>> declared in <root>.<get-additionalText>' type=<root>.Value<T of <root>.<get-additionalText>> origin=null
|
||||
p: PROPERTY_REFERENCE 'public final additionalText: kotlin.Int [delegated,val]' field=null getter='public final fun <get-additionalText> <T> (): kotlin.Int declared in <root>' setter=null type=kotlin.reflect.KProperty1<<root>.Value<T of <root>.<get-additionalText>>, kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
<1>: <none>
|
||||
PROPERTY name:additionalValue visibility:public modality:FINAL [delegated,val]
|
||||
@@ -93,7 +93,7 @@ FILE fqName:<root> fileName:/genericPropertyRef.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-additionalValue> <T> (): kotlin.Int declared in <root>'
|
||||
CALL 'public final fun getValue (t: kotlin.Any?, p: kotlin.Any): kotlin.Int [operator] declared in <root>.DVal' type=kotlin.Int origin=null
|
||||
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:additionalValue$delegate type:<root>.DVal visibility:private [final,static]' type=<root>.DVal origin=null
|
||||
t: ERROR_CALL 'Unresolved reference: this@R|/additionalValue|' type=<root>.Value<T of <root>.<get-additionalValue>>
|
||||
t: GET_VAR '<this>: <root>.Value<T of <root>.<get-additionalValue>> declared in <root>.<get-additionalValue>' type=<root>.Value<T of <root>.<get-additionalValue>> origin=null
|
||||
p: PROPERTY_REFERENCE 'public final additionalValue: kotlin.Int [delegated,val]' field=null getter='public final fun <get-additionalValue> <T> (): kotlin.Int declared in <root>' setter=null type=kotlin.reflect.KProperty1<<root>.Value<T of <root>.<get-additionalValue>>, kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
<1>: <none>
|
||||
CLASS CLASS name:DVal modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
@@ -171,7 +171,7 @@ FILE fqName:<root> fileName:/genericPropertyRef.kt
|
||||
$receiver: VALUE_PARAMETER name:<this> type:T of <root>.<get-bar>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-bar> <T> (): T of <root>.<get-bar> declared in <root>'
|
||||
ERROR_CALL 'Unresolved reference: this@R|/bar|' type=T of <root>.<get-bar>
|
||||
GET_VAR '<this>: T of <root>.<get-bar> declared in <root>.<get-bar>' type=T of <root>.<get-bar> origin=null
|
||||
FUN name:<set-bar> visibility:public modality:FINAL <T> ($receiver:T of <root>.<set-bar>, value:T of <root>.<get-bar>) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:bar visibility:public modality:FINAL [var]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
@@ -179,7 +179,7 @@ FILE fqName:<root> fileName:/genericPropertyRef.kt
|
||||
VALUE_PARAMETER name:value index:0 type:T of <root>.<get-bar>
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun <set-recivier> (<set-?>: kotlin.Any?): kotlin.Unit declared in <root>' type=kotlin.Unit origin=EQ
|
||||
<set-?>: ERROR_CALL 'Unresolved reference: this@R|/bar|' type=T of <root>.<get-bar>
|
||||
<set-?>: GET_VAR '<this>: T of <root>.<set-bar> declared in <root>.<set-bar>' type=T of <root>.<set-bar> origin=null
|
||||
CALL 'public final fun <set-value2> (<set-?>: kotlin.Any?): kotlin.Unit declared in <root>' type=kotlin.Unit origin=EQ
|
||||
<set-?>: GET_VAR 'value: T of <root>.<get-bar> declared in <root>.<set-bar>' type=T of <root>.<get-bar> origin=null
|
||||
PROPERTY name:barRef visibility:public modality:FINAL [val]
|
||||
|
||||
+3
-2
@@ -38,8 +38,9 @@ FILE fqName:<root> fileName:/implicitCastToTypeParameter.kt
|
||||
WHEN type=T of <root>.<get-asT>? origin=IF
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of <root>.<get-asT>
|
||||
ERROR_CALL 'Unresolved reference: this@R|/asT|' type=<root>.Foo<T of <root>.<get-asT>>
|
||||
then: ERROR_CALL 'Unresolved reference: this@R|/asT|' type=T of <root>.<get-asT>
|
||||
GET_VAR '<this>: <root>.Foo<T of <root>.<get-asT>> declared in <root>.<get-asT>' type=<root>.Foo<T of <root>.<get-asT>> origin=null
|
||||
then: TYPE_OP type=T of <root>.<get-asT> origin=IMPLICIT_CAST typeOperand=T of <root>.<get-asT>
|
||||
GET_VAR '<this>: <root>.Foo<T of <root>.<get-asT>> declared in <root>.<get-asT>' type=<root>.Foo<T of <root>.<get-asT>> origin=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CONST Null type=kotlin.Nothing? value=null
|
||||
|
||||
@@ -42,7 +42,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
|
||||
$receiver: VALUE_PARAMETER name:<this> type:T of <root>.BaseClass.<get-fromClass>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-fromClass> <T> (): T of <root>.BaseClass.<get-fromClass> declared in <root>.BaseClass'
|
||||
ERROR_CALL 'Unresolved reference: this@R|/BaseClass.fromClass|' type=T of <root>.BaseClass.<get-fromClass>
|
||||
GET_VAR '<this>: T of <root>.BaseClass.<get-fromClass> declared in <root>.BaseClass.<get-fromClass>' type=T of <root>.BaseClass.<get-fromClass> 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 [operator] declared in kotlin.Any
|
||||
@@ -122,7 +122,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
|
||||
$receiver: VALUE_PARAMETER name:<this> type:T of <root>.C.<get-g2>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-g2> <T> (): T of <root>.C.<get-g2> declared in <root>.C'
|
||||
ERROR_CALL 'Unresolved reference: this@R|/C.g2|' type=T of <root>.C.<get-g2>
|
||||
GET_VAR '<this>: T of <root>.C.<get-g2> declared in <root>.C.<get-g2>' type=T of <root>.C.<get-g2> origin=null
|
||||
PROPERTY FAKE_OVERRIDE name:fromClass visibility:public modality:FINAL [fake_override,val]
|
||||
FUN FAKE_OVERRIDE name:<get-fromClass> visibility:public modality:FINAL <> ($this:<root>.C) returnType:T of <root>.BaseClass.<get-fromClass> [fake_override]
|
||||
correspondingProperty: PROPERTY FAKE_OVERRIDE name:fromClass visibility:public modality:FINAL [fake_override,val]
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ FILE fqName:<root> fileName:/variableAsFunctionCallWithGenerics.kt
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:T of <root>.<get-gk>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): T of <root>.<get-gk> declared in <root>.<get-gk>'
|
||||
ERROR_CALL 'Unresolved reference: this@R|/gk|' type=T of <root>.<get-gk>
|
||||
GET_VAR '<this>: T of <root>.<get-gk> declared in <root>.<get-gk>' type=T of <root>.<get-gk> origin=null
|
||||
FUN name:testGeneric1 visibility:public modality:FINAL <> (x:kotlin.String) returnType:T of <root>.<get-gk>
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
@@ -30,7 +30,7 @@ FILE fqName:<root> fileName:/variableAsFunctionCallWithGenerics.kt
|
||||
FUN name:<no name provided> visibility:local modality:FINAL <> () returnType:T of <root>.<get-kt26531Val>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <no name provided> (): T of <root>.<get-kt26531Val> declared in <root>.<get-kt26531Val>'
|
||||
ERROR_CALL 'Unresolved reference: this@R|/kt26531Val|' type=T of <root>.<get-kt26531Val>
|
||||
GET_VAR '<this>: T of <root>.<get-kt26531Val> declared in <root>.<get-kt26531Val>' type=T of <root>.<get-kt26531Val> origin=null
|
||||
FUN name:kt26531 visibility:public modality:FINAL <> () returnType:T of <root>.<get-kt26531Val>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun kt26531 (): T of <root>.<get-kt26531Val> declared in <root>'
|
||||
|
||||
@@ -6,4 +6,4 @@ FILE fqName:<root> fileName:/jdkClassSyntheticProperty.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test> (): kotlin.Array<out java.lang.reflect.Field?>? declared in <root>'
|
||||
CALL 'public open fun <get-declaredFields> (): kotlin.Array<out java.lang.reflect.Field?>? declared in java.lang.Class' type=kotlin.Array<out java.lang.reflect.Field?>? origin=GET_PROPERTY
|
||||
$this: ERROR_CALL 'Unresolved reference: this@R|/test|' type=java.lang.Class<*>
|
||||
$this: GET_VAR '<this>: java.lang.Class<*> declared in <root>.<get-test>' type=java.lang.Class<*> origin=null
|
||||
|
||||
@@ -320,6 +320,6 @@ FILE fqName:<root> fileName:/genericDelegatedDeepProperty.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-additionalText> <T> (): <root>.P<T of <root>.<get-additionalText>, T of <root>.<get-additionalText>> declared in <root>'
|
||||
CALL 'public final fun getValue (t: <root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, p: kotlin.reflect.KProperty<*>): <root>.P<T of <root>.<get-additionalText>, T of <root>.<get-additionalText>> declared in <root>.additionalText$delegate.<no name provided>' type=<root>.P<T of <root>.<get-additionalText>, T of <root>.<get-additionalText>> origin=null
|
||||
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:additionalText$delegate type:<root>.additionalText$delegate.<no name provided> visibility:private [final,static]' type=<root>.additionalText$delegate.<no name provided> origin=null
|
||||
t: ERROR_CALL 'Unresolved reference: this@R|/additionalText|' type=<root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>
|
||||
t: GET_VAR '<this>: <root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>> declared in <root>.<get-additionalText>' type=<root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>> origin=null
|
||||
p: PROPERTY_REFERENCE 'public final additionalText: <root>.P<T of <root>.<get-additionalText>, T of <root>.<get-additionalText>> [delegated,val]' field=null getter='public final fun <get-additionalText> <T> (): <root>.P<T of <root>.<get-additionalText>, T of <root>.<get-additionalText>> declared in <root>' setter=null type=kotlin.reflect.KProperty1<<root>.Value<T of <root>.<get-additionalText>, <root>.CR<T of <root>.<get-additionalText>>>, <root>.P<T of <root>.<get-additionalText>, T of <root>.<get-additionalText>>> origin=PROPERTY_REFERENCE_FOR_DELEGATE
|
||||
<1>: <none>
|
||||
|
||||
@@ -47,7 +47,7 @@ FILE fqName:<root> fileName:/genericPropertyReferenceType.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-y> <T> (): T of <root>.<get-y> declared in <root>'
|
||||
CALL 'public final fun <get-x> (): T of <root>.C declared in <root>.C' type=T of <root>.<get-y> origin=GET_PROPERTY
|
||||
$this: ERROR_CALL 'Unresolved reference: this@R|/y|' type=<root>.C<T of <root>.<get-y>>
|
||||
$this: GET_VAR '<this>: <root>.C<T of <root>.<get-y>> declared in <root>.<get-y>' type=<root>.C<T of <root>.<get-y>> origin=null
|
||||
FUN name:<set-y> visibility:public modality:FINAL <T> ($receiver:<root>.C<T of <root>.<get-y>>, v:T of <root>.<get-y>) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [var]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
@@ -55,7 +55,7 @@ FILE fqName:<root> fileName:/genericPropertyReferenceType.kt
|
||||
VALUE_PARAMETER name:v index:0 type:T of <root>.<get-y>
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun <set-x> (<set-?>: T of <root>.C): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=EQ
|
||||
$this: ERROR_CALL 'Unresolved reference: this@R|/y|' type=<root>.C<T of <root>.<get-y>>
|
||||
$this: GET_VAR '<this>: <root>.C<T of <root>.<get-y>> declared in <root>.<set-y>' type=<root>.C<T of <root>.<get-y>> origin=null
|
||||
<set-?>: GET_VAR 'v: T of <root>.<get-y> declared in <root>.<set-y>' type=T of <root>.<get-y> origin=null
|
||||
FUN name:use visibility:public modality:FINAL <> (p:kotlin.reflect.KMutableProperty<kotlin.String>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:p index:0 type:kotlin.reflect.KMutableProperty<kotlin.String>
|
||||
|
||||
Reference in New Issue
Block a user