diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index ccbc750f532..b0595fb0c79 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -15,7 +15,6 @@ import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.cfg.UnreachableCode import org.jetbrains.kotlin.diagnostics.Errors.ACTUAL_WITHOUT_EXPECT import org.jetbrains.kotlin.diagnostics.Errors.NO_ACTUAL_FOR_EXPECT -import org.jetbrains.kotlin.diagnostics.PositioningStrategies.INNER_MODIFIER import org.jetbrains.kotlin.lexer.KtModifierKeywordToken import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.lexer.KtTokens.MODALITY_MODIFIERS @@ -637,10 +636,10 @@ object PositioningStrategies { val SECONDARY_CONSTRUCTOR_DELEGATION_CALL: PositioningStrategy = object : PositioningStrategy() { override fun mark(element: PsiElement): List { - when (element) { + return when (element) { is KtSecondaryConstructor -> { val valueParameterList = element.valueParameterList ?: return markElement(element) - return markRange(element.getConstructorKeyword(), valueParameterList.lastChild) + markRange(element.getConstructorKeyword(), valueParameterList.lastChild) } is KtConstructorDelegationCall -> { if (element.isImplicit) { @@ -650,9 +649,9 @@ object PositioningStrategies { val valueParameterList = constructor.valueParameterList ?: return markElement(constructor) return markRange(constructor.getConstructorKeyword(), valueParameterList.lastChild) } - return markElement(element.calleeExpression ?: element) + markElement(element.calleeExpression ?: element) } - else -> error("unexpected element $element") + else -> markElement(element) } } } diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/FirHighlightingTestGenerated.java b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/FirHighlightingTestGenerated.java index 803d3c63633..bfaf18e579e 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/FirHighlightingTestGenerated.java +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/FirHighlightingTestGenerated.java @@ -71,6 +71,11 @@ public class FirHighlightingTestGenerated extends AbstractFirHighlightingTest { runTest("idea/testData/highlighter/Functions.kt"); } + @TestMetadata("InaccessibleExpression.kt") + public void testInaccessibleExpression() throws Exception { + runTest("idea/testData/highlighter/InaccessibleExpression.kt"); + } + @TestMetadata("InvokeCall.kt") public void testInvokeCall() throws Exception { runTest("idea/testData/highlighter/InvokeCall.kt"); diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/PerformanceHighlightingTestGenerated.java b/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/PerformanceHighlightingTestGenerated.java index eefe4ab340e..c80b12abdac 100644 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/PerformanceHighlightingTestGenerated.java +++ b/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/PerformanceHighlightingTestGenerated.java @@ -69,6 +69,11 @@ public class PerformanceHighlightingTestGenerated extends AbstractPerformanceHig runTest("idea/testData/highlighter/Functions.kt"); } + @TestMetadata("InaccessibleExpression.kt") + public void testInaccessibleExpression() throws Exception { + runTest("idea/testData/highlighter/InaccessibleExpression.kt"); + } + @TestMetadata("InvokeCall.kt") public void testInvokeCall() throws Exception { runTest("idea/testData/highlighter/InvokeCall.kt"); diff --git a/idea/testData/highlighter/InaccessibleExpression.kt b/idea/testData/highlighter/InaccessibleExpression.kt new file mode 100644 index 00000000000..f4a56424d51 --- /dev/null +++ b/idea/testData/highlighter/InaccessibleExpression.kt @@ -0,0 +1,12 @@ +// IGNORE_FIR + +interface Zoo<T> { + inner enum class Var : Zoo<T> +} + +object Outer { + fun bar() = Unit + class Inner { + fun foo() = this@Outer.bar() + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java index 45143d3f8f1..d452527340f 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/highlighter/HighlightingTestGenerated.java @@ -69,6 +69,11 @@ public class HighlightingTestGenerated extends AbstractHighlightingTest { runTest("idea/testData/highlighter/Functions.kt"); } + @TestMetadata("InaccessibleExpression.kt") + public void testInaccessibleExpression() throws Exception { + runTest("idea/testData/highlighter/InaccessibleExpression.kt"); + } + @TestMetadata("InvokeCall.kt") public void testInvokeCall() throws Exception { runTest("idea/testData/highlighter/InvokeCall.kt");