FIR checker: fix position strategy for UNRESOLVED_LABEL
This commit is contained in:
committed by
Ivan Kochurkin
parent
45d31fdba2
commit
bcf6202863
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
fun x() {}
|
||||
|
||||
operator fun Int.invoke(): Foo = <!UNRESOLVED_LABEL!>this@Foo<!>
|
||||
operator fun Int.invoke(): Foo = this<!UNRESOLVED_LABEL!>@Foo<!>
|
||||
|
||||
class Foo {
|
||||
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") {
|
||||
val UNRESOLVED_REFERENCE by error<PsiElement>(PositioningStrategy.REFERENCED_NAME_BY_QUALIFIED) {
|
||||
parameter<String>("reference")
|
||||
}
|
||||
val UNRESOLVED_LABEL by error<PsiElement>()
|
||||
val UNRESOLVED_LABEL by error<PsiElement>(PositioningStrategy.LABEL)
|
||||
val DESERIALIZATION_ERROR by error<PsiElement>()
|
||||
val ERROR_FROM_JAVA_RESOLUTION by error<PsiElement>()
|
||||
val MISSING_STDLIB_CLASS by error<PsiElement>()
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ enum class PositioningStrategy(private val strategy: String? = null) {
|
||||
UNREACHABLE_CODE,
|
||||
INLINE_PARAMETER_MODIFIER,
|
||||
ABSTRACT_MODIFIER,
|
||||
|
||||
LABEL,
|
||||
;
|
||||
|
||||
val expressionToCreate get() = "SourceElementPositioningStrategies.${strategy ?: name}"
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ object FirErrors {
|
||||
// Unresolved
|
||||
val INVISIBLE_REFERENCE by error1<PsiElement, FirBasedSymbol<*>>(SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED)
|
||||
val UNRESOLVED_REFERENCE by error1<PsiElement, String>(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED)
|
||||
val UNRESOLVED_LABEL by error0<PsiElement>()
|
||||
val UNRESOLVED_LABEL by error0<PsiElement>(SourceElementPositioningStrategies.LABEL)
|
||||
val DESERIALIZATION_ERROR by error0<PsiElement>()
|
||||
val ERROR_FROM_JAVA_RESOLUTION by error0<PsiElement>()
|
||||
val MISSING_STDLIB_CLASS by error0<PsiElement>()
|
||||
|
||||
+12
@@ -898,6 +898,18 @@ object LightTreePositioningStrategies {
|
||||
return markElement(nodeToMark ?: node, startOffset, endOffset, tree, node)
|
||||
}
|
||||
}
|
||||
|
||||
val LABEL: LightTreePositioningStrategy = object : LightTreePositioningStrategy() {
|
||||
override fun mark(
|
||||
node: LighterASTNode,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
tree: FlyweightCapableTreeStructure<LighterASTNode>
|
||||
): List<TextRange> {
|
||||
val nodeToMark = tree.findChildByType(node, KtNodeTypes.LABEL_QUALIFIER) ?: node
|
||||
return markElement(nodeToMark, startOffset, endOffset, tree, node)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun FirSourceElement.hasValOrVar(): Boolean =
|
||||
|
||||
+5
@@ -283,6 +283,11 @@ object SourceElementPositioningStrategies {
|
||||
PositioningStrategies.ACTUAL_DECLARATION_NAME
|
||||
)
|
||||
|
||||
val LABEL = SourceElementPositioningStrategy(
|
||||
LightTreePositioningStrategies.LABEL,
|
||||
PositioningStrategies.LABEL
|
||||
)
|
||||
|
||||
// TODO
|
||||
val INCOMPATIBLE_DECLARATION = DEFAULT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user