Skip to content

Commit

Permalink
FIR: Add workaround for combination of intersection + delegated members
Browse files Browse the repository at this point in the history
See org.jetbrains.kotlin.fir.Fir2IrTextTestGenerated.FirProblems#testDelegationAndInheritanceFromJava
  • Loading branch information
dzharkov committed Nov 6, 2020
1 parent 41f878e commit a11b488
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.jetbrains.kotlin.fir.resolve.calls.SyntheticPropertySymbol
import org.jetbrains.kotlin.fir.resolve.calls.originalConstructorIfTypeAlias
import org.jetbrains.kotlin.fir.resolve.providers.FirProvider
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
import org.jetbrains.kotlin.fir.scopes.impl.delegatedWrapperData
import org.jetbrains.kotlin.fir.scopes.processDirectlyOverriddenFunctions
import org.jetbrains.kotlin.fir.scopes.processDirectlyOverriddenProperties
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
Expand Down Expand Up @@ -274,7 +275,11 @@ internal fun FirProperty.generateOverriddenAccessorSymbols(
if (it is FirAccessorSymbol || it.fir.visibility == Visibilities.Private) {
return@processDirectlyOverriddenProperties ProcessorAction.NEXT
}
val overriddenProperty = declarationStorage.getIrPropertySymbol(it.unwrapFakeOverrides()) as IrPropertySymbol

val unwrapped =
it.fir.delegatedWrapperData?.takeIf { it.containingClass == containingClass.symbol.toLookupTag() }?.wrapped?.symbol ?: it

val overriddenProperty = declarationStorage.getIrPropertySymbol(unwrapped.unwrapFakeOverrides()) as IrPropertySymbol
val overriddenAccessor = if (isGetter) overriddenProperty.owner.getter?.symbol else overriddenProperty.owner.setter?.symbol
if (overriddenAccessor != null) {
overriddenSet += overriddenAccessor
Expand Down

0 comments on commit a11b488

Please sign in to comment.