[FE, IR] Store PsiElement for mismatched annotation's actual target

There is IDE quick fix which suggests to copy mismatched annotation
from `expect` to `actual` (see KTIJ-26633). It needs to find
`actual` PsiElement where to add annotation. Before previous commit, it
was easy - just get source of `Incompatibility.actualSymbol`.
After previous commit, the problem might be in value parameter, while
`actualSymbol` would contain function symbol. This is solved by adding
new field `Incompatibility.actualAnnotationTargetElement`.

`SourceElementMarker` introduced, because it's needed to be used in
abstract checker. Existing `DeclarationSymbolMarker` doesn't fit
because in next PR for this issue annotations set on types will be reported,
and types are not declarations.

^KT-60671
This commit is contained in:
Roman Efremov
2023-09-07 16:50:34 +02:00
committed by Space Team
parent 5c95f69aef
commit 420dceb7d8
20 changed files with 108 additions and 22 deletions
@@ -214,6 +214,14 @@ internal object FirToKtConversionCreator {
"org.jetbrains.kotlin.psi"
)
),
KtSourceElement::class to HLFunctionCallConversion(
"({0} as? KtPsiSourceElement)?.psi",
PsiElement::class.createType(nullable = true),
importsToAdd = listOf(
"org.jetbrains.kotlin.psi",
"org.jetbrains.kotlin.KtPsiSourceElement"
)
),
)
private val typeMapping: Map<KClass<*>, HLFunctionCallConversion> = mapOf(