FIR: Fix implicit return type computation for synthetic property+intersection

This commit is contained in:
Denis Zharkov
2020-09-29 20:06:06 +03:00
parent 754e17a28f
commit de3df799bc
2 changed files with 11 additions and 11 deletions
@@ -99,17 +99,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
}
override fun transformProperty(property: FirProperty, data: ResolutionMode): CompositeTransformResult<FirProperty> {
if (property is FirSyntheticProperty) {
val delegate = property.getter.delegate
if (delegate.origin == FirDeclarationOrigin.IntersectionOverride) {
val unwrapped = delegate.symbol.overriddenSymbol!!.fir
transformSimpleFunction(unwrapped, data)
delegate.replaceReturnTypeRef(unwrapped.returnTypeRef)
} else {
transformSimpleFunction(delegate, data)
}
return property.compose()
}
require(property !is FirSyntheticProperty) { "Synthetic properties should not be processed by body transfromers" }
if (property.isLocal) {
prepareSignatureForBodyResolve(property)
@@ -188,6 +188,16 @@ private class ReturnTypeCalculatorWithJump(
require(declaration is FirCallableMemberDeclaration<*>) { "${declaration::class}: ${declaration.render()}" }
if (declaration is FirSyntheticProperty) {
return tryCalculateReturnType(declaration.getter.delegate)
}
if (declaration.origin == FirDeclarationOrigin.IntersectionOverride) {
val result = tryCalculateReturnType(declaration.symbol.overriddenSymbol!!.fir)
declaration.replaceReturnTypeRef(result)
return result
}
return when (val status = implicitBodyResolveComputationSession.getStatus(declaration.symbol)) {
is ImplicitBodyResolveComputationStatus.Computed -> status.resolvedTypeRef
is ImplicitBodyResolveComputationStatus.Computing ->