FIR2IR: fix f/o & delegate overridden symbol generation #KT-52745 Fixed
This commit is contained in:
+4
-9
@@ -194,6 +194,10 @@ class DelegatedMemberGenerator(
|
|||||||
declaration.overriddenSymbols = basePropertySymbols[declaration]?.flatMap {
|
declaration.overriddenSymbols = basePropertySymbols[declaration]?.flatMap {
|
||||||
fakeOverrideGenerator.getOverriddenSymbolsInSupertypes(it, superClasses)
|
fakeOverrideGenerator.getOverriddenSymbolsInSupertypes(it, superClasses)
|
||||||
}?.filter { it.owner != declaration }.orEmpty()
|
}?.filter { it.owner != declaration }.orEmpty()
|
||||||
|
declaration.getter!!.overriddenSymbols = declaration.overriddenSymbols.mapNotNull { it.owner.getter?.symbol }
|
||||||
|
if (declaration.isVar) {
|
||||||
|
declaration.setter!!.overriddenSymbols = declaration.overriddenSymbols.mapNotNull { it.owner.setter?.symbol }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else -> continue
|
else -> continue
|
||||||
}
|
}
|
||||||
@@ -301,18 +305,9 @@ class DelegatedMemberGenerator(
|
|||||||
annotationGenerator.generate(delegateProperty, firDelegateProperty)
|
annotationGenerator.generate(delegateProperty, firDelegateProperty)
|
||||||
|
|
||||||
val getter = delegateProperty.getter!!
|
val getter = delegateProperty.getter!!
|
||||||
getter.overriddenSymbols =
|
|
||||||
firDelegateProperty.generateOverriddenAccessorSymbols(
|
|
||||||
firSubClass,
|
|
||||||
isGetter = true
|
|
||||||
)
|
|
||||||
annotationGenerator.generate(getter, firDelegateProperty)
|
annotationGenerator.generate(getter, firDelegateProperty)
|
||||||
if (delegateProperty.isVar) {
|
if (delegateProperty.isVar) {
|
||||||
val setter = delegateProperty.setter!!
|
val setter = delegateProperty.setter!!
|
||||||
setter.overriddenSymbols =
|
|
||||||
firDelegateProperty.generateOverriddenAccessorSymbols(
|
|
||||||
firSubClass, isGetter = false
|
|
||||||
)
|
|
||||||
annotationGenerator.generate(setter, firDelegateProperty)
|
annotationGenerator.generate(setter, firDelegateProperty)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -391,13 +391,13 @@ class FakeOverrideGenerator(
|
|||||||
declarationStorage.classifierStorage.getIrClassSymbol(overriddenContainingClass.symbol).owner as? IrClass
|
declarationStorage.classifierStorage.getIrClassSymbol(overriddenContainingClass.symbol).owner as? IrClass
|
||||||
?: return emptyList()
|
?: return emptyList()
|
||||||
|
|
||||||
return if (overriddenContainingIrClass in superClasses) {
|
return superClasses.mapNotNull { superClass ->
|
||||||
// `overridden` was a FIR declaration in some of the supertypes
|
if (superClass == overriddenContainingIrClass) {
|
||||||
listOf(irProducer(overridden))
|
// `overridden` was a FIR declaration in some of the supertypes
|
||||||
} else {
|
irProducer(overridden)
|
||||||
// There were no FIR declaration in supertypes, but we know that we have fake overrides in some of them
|
} else {
|
||||||
superClasses.mapNotNull {
|
// There were no FIR declaration in supertypes, but we know that we have fake overrides in some of them
|
||||||
declarationStorage.getFakeOverrideInClass(it, overridden.fir)?.let { fakeOverrideInClass ->
|
declarationStorage.getFakeOverrideInClass(superClass, overridden.fir)?.let { fakeOverrideInClass ->
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
irProducer(fakeOverrideInClass.symbol as F)
|
irProducer(fakeOverrideInClass.symbol as F)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// TARGET_BACKEND: JVM_IR
|
// TARGET_BACKEND: JVM_IR
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
sealed class A : CharSequence {
|
sealed class A : CharSequence {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ FILE fqName:<root> fileName:/delegationInSealed.kt
|
|||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public [data] superTypes:[<root>.A; kotlin.CharSequence]'
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public [data] superTypes:[<root>.A; kotlin.CharSequence]'
|
||||||
FUN DELEGATED_MEMBER name:get visibility:public modality:OPEN <> ($this:<root>.A.B, index:kotlin.Int) returnType:kotlin.Char [operator]
|
FUN DELEGATED_MEMBER name:get visibility:public modality:OPEN <> ($this:<root>.A.B, index:kotlin.Int) returnType:kotlin.Char [operator]
|
||||||
overridden:
|
overridden:
|
||||||
|
public abstract fun get (index: kotlin.Int): kotlin.Char [fake_override,operator] declared in <root>.A
|
||||||
public abstract fun get (index: kotlin.Int): kotlin.Char [operator] declared in kotlin.CharSequence
|
public abstract fun get (index: kotlin.Int): kotlin.Char [operator] declared in kotlin.CharSequence
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
|
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
|
||||||
VALUE_PARAMETER name:index index:0 type:kotlin.Int
|
VALUE_PARAMETER name:index index:0 type:kotlin.Int
|
||||||
@@ -27,6 +28,7 @@ FILE fqName:<root> fileName:/delegationInSealed.kt
|
|||||||
index: GET_VAR 'index: kotlin.Int declared in <root>.A.B.get' type=kotlin.Int origin=null
|
index: GET_VAR 'index: kotlin.Int declared in <root>.A.B.get' type=kotlin.Int origin=null
|
||||||
FUN DELEGATED_MEMBER name:subSequence visibility:public modality:OPEN <> ($this:<root>.A.B, startIndex:kotlin.Int, endIndex:kotlin.Int) returnType:kotlin.CharSequence
|
FUN DELEGATED_MEMBER name:subSequence visibility:public modality:OPEN <> ($this:<root>.A.B, startIndex:kotlin.Int, endIndex:kotlin.Int) returnType:kotlin.CharSequence
|
||||||
overridden:
|
overridden:
|
||||||
|
public abstract fun subSequence (startIndex: kotlin.Int, endIndex: kotlin.Int): kotlin.CharSequence [fake_override] declared in <root>.A
|
||||||
public abstract fun subSequence (startIndex: kotlin.Int, endIndex: kotlin.Int): kotlin.CharSequence declared in kotlin.CharSequence
|
public abstract fun subSequence (startIndex: kotlin.Int, endIndex: kotlin.Int): kotlin.CharSequence declared in kotlin.CharSequence
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
|
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
|
||||||
VALUE_PARAMETER name:startIndex index:0 type:kotlin.Int
|
VALUE_PARAMETER name:startIndex index:0 type:kotlin.Int
|
||||||
@@ -40,10 +42,12 @@ FILE fqName:<root> fileName:/delegationInSealed.kt
|
|||||||
endIndex: GET_VAR 'endIndex: kotlin.Int declared in <root>.A.B.subSequence' type=kotlin.Int origin=null
|
endIndex: GET_VAR 'endIndex: kotlin.Int declared in <root>.A.B.subSequence' type=kotlin.Int origin=null
|
||||||
PROPERTY DELEGATED_MEMBER name:length visibility:public modality:OPEN [val]
|
PROPERTY DELEGATED_MEMBER name:length visibility:public modality:OPEN [val]
|
||||||
overridden:
|
overridden:
|
||||||
|
public abstract length: kotlin.Int [fake_override,val]
|
||||||
public abstract length: kotlin.Int [val]
|
public abstract length: kotlin.Int [val]
|
||||||
FUN DELEGATED_MEMBER name:<get-length> visibility:public modality:OPEN <> ($this:<root>.A.B) returnType:kotlin.Int
|
FUN DELEGATED_MEMBER name:<get-length> visibility:public modality:OPEN <> ($this:<root>.A.B) returnType:kotlin.Int
|
||||||
correspondingProperty: PROPERTY DELEGATED_MEMBER name:length visibility:public modality:OPEN [val]
|
correspondingProperty: PROPERTY DELEGATED_MEMBER name:length visibility:public modality:OPEN [val]
|
||||||
overridden:
|
overridden:
|
||||||
|
public abstract fun <get-length> (): kotlin.Int [fake_override] declared in <root>.A
|
||||||
public abstract fun <get-length> (): kotlin.Int declared in kotlin.CharSequence
|
public abstract fun <get-length> (): kotlin.Int declared in kotlin.CharSequence
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
|
$this: VALUE_PARAMETER name:<this> type:<root>.A.B
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ FILE fqName:<root> fileName:/SignatureClash.kt
|
|||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:DataClass modality:FINAL visibility:public [data] superTypes:[<root>.Derived; <root>.Delegate]'
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:DataClass modality:FINAL visibility:public [data] superTypes:[<root>.Derived; <root>.Delegate]'
|
||||||
FUN DELEGATED_MEMBER name:bar visibility:public modality:OPEN <> ($this:<root>.DataClass) returnType:kotlin.Unit
|
FUN DELEGATED_MEMBER name:bar visibility:public modality:OPEN <> ($this:<root>.DataClass) returnType:kotlin.Unit
|
||||||
overridden:
|
overridden:
|
||||||
|
public abstract fun bar (): kotlin.Unit [fake_override] declared in <root>.Derived
|
||||||
public abstract fun bar (): kotlin.Unit declared in <root>.Delegate
|
public abstract fun bar (): kotlin.Unit declared in <root>.Delegate
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.DataClass
|
$this: VALUE_PARAMETER name:<this> type:<root>.DataClass
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
|
|||||||
Reference in New Issue
Block a user