[FIR] Accept opt-in annotations on primary ctor params of properties

For backward compatibility with K1.

KT-56177
This commit is contained in:
Kirill Rakhman
2023-02-27 17:09:25 +01:00
committed by Space Team
parent cfc5bb74ef
commit fbc0796ed2
7 changed files with 61 additions and 4 deletions
@@ -120,9 +120,12 @@ fun FirDeclaration.getDanglingTypeConstraintsOrEmpty(): List<DanglingTypeConstra
}
val FirPropertySymbol.correspondingValueParameterFromPrimaryConstructor: FirValueParameterSymbol?
get() = fir.correspondingValueParameterFromPrimaryConstructor
val FirProperty.correspondingValueParameterFromPrimaryConstructor: FirValueParameterSymbol?
get() {
if (!fromPrimaryConstructor) return null
val initializer = resolvedInitializer as? FirPropertyAccessExpression ?: return null
if (fromPrimaryConstructor != true) return null
val initializer = initializer as? FirPropertyAccessExpression ?: return null
val reference = initializer.calleeReference as? FirPropertyFromParameterResolvedNamedReference ?: return null
return reference.resolvedSymbol as? FirValueParameterSymbol
}