FIR2IR: support backing field symbols from FIR, fix test data
This commit is contained in:
@@ -106,6 +106,7 @@ fun FirNamedReference.toSymbol(declarationStorage: Fir2IrDeclarationStorage): Ir
|
||||
when (val callableSymbol = this.coneSymbol) {
|
||||
is FirFunctionSymbol -> return callableSymbol.toFunctionSymbol(declarationStorage)
|
||||
is FirPropertySymbol -> return callableSymbol.toPropertyOrFieldSymbol(declarationStorage)
|
||||
is FirBackingFieldSymbol -> return callableSymbol.toPropertyOrFieldSymbol(declarationStorage)
|
||||
is FirVariableSymbol -> return callableSymbol.toValueSymbol(declarationStorage)
|
||||
}
|
||||
}
|
||||
@@ -124,7 +125,7 @@ fun FirFunctionSymbol.toFunctionSymbol(declarationStorage: Fir2IrDeclarationStor
|
||||
return declarationStorage.getIrFunctionSymbol(this)
|
||||
}
|
||||
|
||||
fun FirPropertySymbol.toPropertyOrFieldSymbol(declarationStorage: Fir2IrDeclarationStorage): IrSymbol {
|
||||
fun FirVariableSymbol.toPropertyOrFieldSymbol(declarationStorage: Fir2IrDeclarationStorage): IrSymbol {
|
||||
return declarationStorage.getIrPropertyOrFieldSymbol(this)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -499,8 +499,8 @@ class Fir2IrDeclarationStorage(
|
||||
}
|
||||
}
|
||||
|
||||
fun getIrPropertyOrFieldSymbol(firPropertySymbol: FirPropertySymbol): IrSymbol {
|
||||
return when (val fir = firPropertySymbol.fir) {
|
||||
fun getIrPropertyOrFieldSymbol(firVariableSymbol: FirVariableSymbol): IrSymbol {
|
||||
return when (val fir = firVariableSymbol.fir) {
|
||||
is FirProperty -> {
|
||||
val irProperty = getIrProperty(fir).apply {
|
||||
setAndModifyParent(findIrParent(fir))
|
||||
|
||||
+6
-3
@@ -138,7 +138,8 @@ FILE fqName:<root> fileName:/initVar.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.TestInitVarWithCustomSetter
|
||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: field>#' type=IrErrorType
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public ' type=kotlin.Int origin=null
|
||||
value: GET_VAR 'value: kotlin.Int declared in <root>.TestInitVarWithCustomSetter.<set-x>' type=kotlin.Int origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
|
||||
@@ -168,7 +169,8 @@ FILE fqName:<root> fileName:/initVar.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.TestInitVarWithCustomSetterWithExplicitCtor
|
||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: field>#' type=IrErrorType
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public ' type=kotlin.Int origin=null
|
||||
value: GET_VAR 'value: kotlin.Int declared in <root>.TestInitVarWithCustomSetterWithExplicitCtor.<set-x>' type=kotlin.Int origin=null
|
||||
ANONYMOUS_INITIALIZER isStatic=false
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public ' type=kotlin.Int origin=null
|
||||
@@ -206,7 +208,8 @@ FILE fqName:<root> fileName:/initVar.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.TestInitVarWithCustomSetterInCtor
|
||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: field>#' type=IrErrorType
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public ' type=kotlin.Int origin=null
|
||||
value: GET_VAR 'value: kotlin.Int declared in <root>.TestInitVarWithCustomSetterInCtor.<set-x>' type=kotlin.Int origin=null
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.TestInitVarWithCustomSetterInCtor
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public ' type=kotlin.Int origin=null
|
||||
|
||||
@@ -58,7 +58,8 @@ FILE fqName:<root> fileName:/classLevelProperties.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: field>#' type=IrErrorType
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.Int visibility:public ' type=kotlin.Int origin=null
|
||||
value: GET_VAR 'value: kotlin.Int declared in <root>.C.<set-test4>' type=kotlin.Int origin=null
|
||||
PROPERTY name:test5 visibility:public modality:FINAL [var]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test5 type:kotlin.Int visibility:public
|
||||
EXPRESSION_BODY
|
||||
|
||||
@@ -42,7 +42,8 @@ FILE fqName:<root> fileName:/packageLevelProperties.kt
|
||||
correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [var]
|
||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: field>#' type=IrErrorType
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.Int visibility:public [static] ' type=kotlin.Int origin=null
|
||||
value: GET_VAR 'value: kotlin.Int declared in <root>.<set-test4>' type=kotlin.Int origin=null
|
||||
PROPERTY name:test5 visibility:public modality:FINAL [var]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test5 type:kotlin.Int visibility:public [static]
|
||||
EXPRESSION_BODY
|
||||
|
||||
+4
-3
@@ -12,7 +12,8 @@ FILE fqName:<root> fileName:/field.kt
|
||||
correspondingProperty: PROPERTY name:testSimple visibility:public modality:FINAL [var]
|
||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: field>#' type=IrErrorType
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testSimple type:kotlin.Int visibility:public [static] ' type=kotlin.Int origin=null
|
||||
value: GET_VAR 'value: kotlin.Int declared in <root>.<set-testSimple>' type=kotlin.Int origin=null
|
||||
PROPERTY name:testAugmented visibility:public modality:FINAL [var]
|
||||
FIELD PROPERTY_BACKING_FIELD name:testAugmented type:kotlin.Int visibility:public [static]
|
||||
EXPRESSION_BODY
|
||||
@@ -26,5 +27,5 @@ FILE fqName:<root> fileName:/field.kt
|
||||
correspondingProperty: PROPERTY name:testAugmented visibility:public modality:FINAL [var]
|
||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: field>#' type=IrErrorType
|
||||
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testAugmented type:kotlin.Int visibility:public [static] ' type=kotlin.Int origin=null
|
||||
value: GET_VAR 'value: kotlin.Int declared in <root>.<set-testAugmented>' type=kotlin.Int origin=null
|
||||
|
||||
@@ -130,12 +130,13 @@ FILE fqName:<root> fileName:/propertyReferences.kt
|
||||
correspondingProperty: PROPERTY name:varWithBackingFieldAndAccessors visibility:public modality:FINAL [var]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-varWithBackingFieldAndAccessors> (): kotlin.Int declared in <root>'
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: field>#' type=IrErrorType
|
||||
ERROR_CALL 'No getter found for F|/varWithBackingFieldAndAccessors|' type=kotlin.Int
|
||||
FUN name:<set-varWithBackingFieldAndAccessors> visibility:public modality:FINAL <> (value:kotlin.Int) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:varWithBackingFieldAndAccessors visibility:public modality:FINAL [var]
|
||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: <Unresolved name: field>#' type=IrErrorType
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:varWithBackingFieldAndAccessors type:kotlin.Int visibility:public [static] ' type=kotlin.Int origin=null
|
||||
value: GET_VAR 'value: kotlin.Int declared in <root>.<set-varWithBackingFieldAndAccessors>' type=kotlin.Int origin=null
|
||||
PROPERTY name:test_varWithBackingFieldAndAccessors visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test_varWithBackingFieldAndAccessors type:kotlin.Int visibility:public [final,static]
|
||||
EXPRESSION_BODY
|
||||
@@ -146,39 +147,39 @@ FILE fqName:<root> fileName:/propertyReferences.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test_varWithBackingFieldAndAccessors> (): kotlin.Int declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test_varWithBackingFieldAndAccessors type:kotlin.Int visibility:public [final,static] ' type=kotlin.Int origin=null
|
||||
PROPERTY name:valWithAccessors visibility:public modality:FINAL [val]
|
||||
FUN name:<get-valWithAccessors> visibility:public modality:FINAL <> () returnType:IrErrorType
|
||||
FUN name:<get-valWithAccessors> visibility:public modality:FINAL <> () returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:valWithAccessors visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-valWithAccessors> (): IrErrorType declared in <root>'
|
||||
CONST Int type=IrErrorType value=1
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-valWithAccessors> (): kotlin.Int declared in <root>'
|
||||
CONST Int type=kotlin.Int value=1
|
||||
PROPERTY name:test_valWithAccessors visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test_valWithAccessors type:IrErrorType visibility:public [final,static]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test_valWithAccessors type:kotlin.Int visibility:public [final,static]
|
||||
EXPRESSION_BODY
|
||||
CALL 'public final fun <get-valWithAccessors> (): IrErrorType declared in <root>' type=IrErrorType origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test_valWithAccessors> visibility:public modality:FINAL <> () returnType:IrErrorType
|
||||
CALL 'public final fun <get-valWithAccessors> (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test_valWithAccessors> visibility:public modality:FINAL <> () returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:test_valWithAccessors visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test_valWithAccessors> (): IrErrorType declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test_valWithAccessors type:IrErrorType visibility:public [final,static] ' type=IrErrorType origin=null
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test_valWithAccessors> (): kotlin.Int declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test_valWithAccessors type:kotlin.Int visibility:public [final,static] ' type=kotlin.Int origin=null
|
||||
PROPERTY name:varWithAccessors visibility:public modality:FINAL [var]
|
||||
FUN name:<get-varWithAccessors> visibility:public modality:FINAL <> () returnType:IrErrorType
|
||||
FUN name:<get-varWithAccessors> visibility:public modality:FINAL <> () returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:varWithAccessors visibility:public modality:FINAL [var]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-varWithAccessors> (): IrErrorType declared in <root>'
|
||||
CONST Int type=IrErrorType value=1
|
||||
FUN name:<set-varWithAccessors> visibility:public modality:FINAL <> (value:IrErrorType) returnType:kotlin.Unit
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-varWithAccessors> (): kotlin.Int declared in <root>'
|
||||
CONST Int type=kotlin.Int value=1
|
||||
FUN name:<set-varWithAccessors> visibility:public modality:FINAL <> (value:kotlin.Int) returnType:kotlin.Unit
|
||||
correspondingProperty: PROPERTY name:varWithAccessors visibility:public modality:FINAL [var]
|
||||
VALUE_PARAMETER name:value index:0 type:IrErrorType
|
||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
PROPERTY name:test_varWithAccessors visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test_varWithAccessors type:IrErrorType visibility:public [final,static]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test_varWithAccessors type:kotlin.Int visibility:public [final,static]
|
||||
EXPRESSION_BODY
|
||||
CALL 'public final fun <get-varWithAccessors> (): IrErrorType declared in <root>' type=IrErrorType origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test_varWithAccessors> visibility:public modality:FINAL <> () returnType:IrErrorType
|
||||
CALL 'public final fun <get-varWithAccessors> (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test_varWithAccessors> visibility:public modality:FINAL <> () returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:test_varWithAccessors visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test_varWithAccessors> (): IrErrorType declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test_varWithAccessors type:IrErrorType visibility:public [final,static] ' type=IrErrorType origin=null
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test_varWithAccessors> (): kotlin.Int declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test_varWithAccessors type:kotlin.Int visibility:public [final,static] ' type=kotlin.Int origin=null
|
||||
PROPERTY name:delegatedVal visibility:public modality:FINAL [delegated,val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:delegatedVal type:IrErrorType visibility:public [final,static]
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-delegatedVal> visibility:public modality:FINAL <> () returnType:IrErrorType
|
||||
|
||||
Reference in New Issue
Block a user