[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:
committed by
Space Team
parent
5c95f69aef
commit
420dceb7d8
+6
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.calls.mpp.ExpectActualCollectionArgumentsCompatibilityCheckStrategy
|
||||
import org.jetbrains.kotlin.resolve.calls.mpp.ExpectActualMatchingContext
|
||||
import org.jetbrains.kotlin.resolve.calls.mpp.ExpectActualMatchingContext.AnnotationCallInfo
|
||||
import org.jetbrains.kotlin.mpp.SourceElementMarker
|
||||
import org.jetbrains.kotlin.resolve.checkers.OptInNames
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility
|
||||
import org.jetbrains.kotlin.types.AbstractTypeChecker
|
||||
@@ -523,4 +524,9 @@ internal abstract class IrExpectActualMatchingContext(
|
||||
actualMember: DeclarationSymbolMarker,
|
||||
checkClassScopesCompatibility: Boolean,
|
||||
): Map<out DeclarationSymbolMarker, ExpectActualCompatibility<*>> = error("Should not be called")
|
||||
|
||||
// It's a stub, because not needed anywhere
|
||||
private object IrSourceElementStub : SourceElementMarker
|
||||
|
||||
override fun DeclarationSymbolMarker.getSourceElement(): SourceElementMarker = IrSourceElementStub
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user