[FIR] do not transform annotations on delegated property accessors during implicit type phase
^KT-62874 Fixed
This commit is contained in:
committed by
Space Team
parent
1b636bf450
commit
3941b05909
+13
-5
@@ -186,7 +186,7 @@ open class FirDeclarationsResolveTransformer(
|
||||
|
||||
property.transformAccessors(SetterResolutionMode.FULLY_RESOLVE, shouldResolveEverything = true)
|
||||
} else {
|
||||
transformPropertyAccessorsWithDelegate(property, delegate)
|
||||
transformPropertyAccessorsWithDelegate(property, delegate, shouldResolveEverything)
|
||||
if (property.delegateFieldSymbol != null) {
|
||||
replacePropertyReferenceTypeInDelegateAccessors(property)
|
||||
}
|
||||
@@ -298,7 +298,11 @@ open class FirDeclarationsResolveTransformer(
|
||||
(property.delegate as? FirFunctionCall)?.replacePropertyReferenceTypeInDelegateAccessors(property)
|
||||
}
|
||||
|
||||
private fun transformPropertyAccessorsWithDelegate(property: FirProperty, delegate: FirExpression) {
|
||||
private fun transformPropertyAccessorsWithDelegate(
|
||||
property: FirProperty,
|
||||
delegate: FirExpression,
|
||||
shouldResolveEverything: Boolean,
|
||||
) {
|
||||
val isImplicitTypedProperty = property.returnTypeRef is FirImplicitTypeRef
|
||||
|
||||
context.forPropertyDelegateAccessors(property, resolutionContext, callCompleter) {
|
||||
@@ -317,7 +321,11 @@ open class FirDeclarationsResolveTransformer(
|
||||
// It's necessary because we need to supply the property type as the 3rd argument for `setValue` and there might be uninferred
|
||||
// variables from `getValue`.
|
||||
// The same logic was used at K1 (see org.jetbrains.kotlin.resolve.DelegatedPropertyResolver.inferDelegateTypeFromGetSetValueMethods)
|
||||
property.transformAccessors(if (isImplicitTypedProperty) SetterResolutionMode.SKIP else SetterResolutionMode.FULLY_RESOLVE)
|
||||
property.transformAccessors(
|
||||
if (isImplicitTypedProperty) SetterResolutionMode.SKIP else SetterResolutionMode.FULLY_RESOLVE,
|
||||
shouldResolveEverything,
|
||||
)
|
||||
|
||||
val completedCalls = completeCandidates()
|
||||
|
||||
val finalSubstitutor = createFinalSubstitutor()
|
||||
@@ -346,7 +354,7 @@ open class FirDeclarationsResolveTransformer(
|
||||
|
||||
// `isImplicitTypedProperty` means we haven't run setter resolution yet (see its second usage)
|
||||
if (isImplicitTypedProperty) {
|
||||
property.resolveSetter(mayResolveSetterBody = true, shouldResolveEverything = true)
|
||||
property.resolveSetter(mayResolveSetterBody = true, shouldResolveEverything = shouldResolveEverything)
|
||||
}
|
||||
|
||||
dataFlowAnalyzer.exitDelegateExpression(delegate)
|
||||
@@ -498,7 +506,7 @@ open class FirDeclarationsResolveTransformer(
|
||||
val hadExplicitType = variable.returnTypeRef !is FirImplicitTypeRef
|
||||
|
||||
if (delegate != null) {
|
||||
transformPropertyAccessorsWithDelegate(variable, delegate)
|
||||
transformPropertyAccessorsWithDelegate(variable, delegate, shouldResolveEverything = true)
|
||||
if (variable.delegateFieldSymbol != null) {
|
||||
replacePropertyReferenceTypeInDelegateAccessors(variable)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user