K2: Minor. Simplify condition at FirDeclarationsResolveTransformer

Just to avoid double negation at !hasNonDefaultAccessors
This commit is contained in:
Denis.Zharkov
2023-02-20 13:07:33 +01:00
committed by Space Team
parent 775da5d3d2
commit bdb1e28912
@@ -29,7 +29,6 @@ import org.jetbrains.kotlin.fir.resolve.*
import org.jetbrains.kotlin.fir.resolve.calls.FirNamedReferenceWithCandidate import org.jetbrains.kotlin.fir.resolve.calls.FirNamedReferenceWithCandidate
import org.jetbrains.kotlin.fir.resolve.calls.candidate import org.jetbrains.kotlin.fir.resolve.calls.candidate
import org.jetbrains.kotlin.fir.resolve.dfa.FirControlFlowGraphReferenceImpl import org.jetbrains.kotlin.fir.resolve.dfa.FirControlFlowGraphReferenceImpl
import org.jetbrains.kotlin.fir.expressions.unwrapSmartcastExpression
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeLocalVariableNoTypeOrInitializer import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeLocalVariableNoTypeOrInitializer
import org.jetbrains.kotlin.fir.resolve.inference.FirStubTypeTransformer import org.jetbrains.kotlin.fir.resolve.inference.FirStubTypeTransformer
import org.jetbrains.kotlin.fir.resolve.inference.ResolvedLambdaAtom import org.jetbrains.kotlin.fir.resolve.inference.ResolvedLambdaAtom
@@ -127,7 +126,6 @@ open class FirDeclarationsResolveTransformer(transformer: FirAbstractBodyResolve
if (bodyResolveState == FirPropertyBodyResolveState.EVERYTHING_RESOLVED) return property if (bodyResolveState == FirPropertyBodyResolveState.EVERYTHING_RESOLVED) return property
val canHaveDeepImplicitTypeRefs = property.hasExplicitBackingField val canHaveDeepImplicitTypeRefs = property.hasExplicitBackingField
if (returnTypeRefBeforeResolve !is FirImplicitTypeRef && implicitTypeOnly && !canHaveDeepImplicitTypeRefs) { if (returnTypeRefBeforeResolve !is FirImplicitTypeRef && implicitTypeOnly && !canHaveDeepImplicitTypeRefs) {
return property return property
} }
@@ -164,9 +162,10 @@ open class FirDeclarationsResolveTransformer(transformer: FirAbstractBodyResolve
} }
property.replaceBodyResolveState(FirPropertyBodyResolveState.EVERYTHING_RESOLVED) property.replaceBodyResolveState(FirPropertyBodyResolveState.EVERYTHING_RESOLVED)
} else { } else {
val hasNonDefaultAccessors = property.getter != null && property.getter !is FirDefaultPropertyAccessor || val hasDefaultAccessors =
property.setter != null && property.setter !is FirDefaultPropertyAccessor (property.getter == null || property.getter is FirDefaultPropertyAccessor) &&
val mayResolveSetter = shouldResolveEverything || !hasNonDefaultAccessors (property.setter == null || property.setter is FirDefaultPropertyAccessor)
val mayResolveSetter = shouldResolveEverything || hasDefaultAccessors
val propertyTypeRefAfterResolve = property.returnTypeRef val propertyTypeRefAfterResolve = property.returnTypeRef
val propertyTypeIsKnown = propertyTypeRefAfterResolve is FirResolvedTypeRef val propertyTypeIsKnown = propertyTypeRefAfterResolve is FirResolvedTypeRef
val mayResolveGetter = mayResolveSetter || !propertyTypeIsKnown val mayResolveGetter = mayResolveSetter || !propertyTypeIsKnown