FIR: Fix implicit return type computation for synthetic property+intersection
This commit is contained in:
+1
-11
@@ -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)
|
||||
|
||||
+10
@@ -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 ->
|
||||
|
||||
Reference in New Issue
Block a user