From 932892243ca8dbd36ab6e35bd7d7bc4fad562e08 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Wed, 22 Jun 2016 17:15:17 +0300 Subject: [PATCH] Line Markers: Filter out irrelevant declarations before resolving in KotlinTestRunLineMarkerContributor #KT-12647 Fixed (cherry picked from commit cceeaeb) --- ChangeLog.md | 1 + .../idea/highlighter/KotlinTestRunLineMarkerContributor.kt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 4115d18d3fc..bee50a86def 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -399,6 +399,7 @@ - [`KT-11778`](https://youtrack.jetbrains.com/issue/KT-11778) Exception in Lombok plugin: Rewrite at slice FUNCTION - [`KT-11708`](https://youtrack.jetbrains.com/issue/KT-11708) "Go to declaration" doesn't work on a call to function with SAM conversion on a derived type - [`KT-12381`](https://youtrack.jetbrains.com/issue/KT-12381) Prefer not-nullable return type when overriding Java method without nullability annotation +- [`KT-12647`](https://youtrack.jetbrains.com/issue/KT-12647) Performance improvement for test-related line markers ### Reflection diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinTestRunLineMarkerContributor.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinTestRunLineMarkerContributor.kt index 77ef3d43ae2..86936309504 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinTestRunLineMarkerContributor.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinTestRunLineMarkerContributor.kt @@ -53,6 +53,8 @@ class KotlinTestRunLineMarkerContributor : RunLineMarkerContributor() { val declaration = element.getStrictParentOfType() ?: return null if (declaration.nameIdentifier != element) return null + if (declaration !is KtClassOrObject && declaration !is KtNamedFunction) return null + // To prevent IDEA failing on red code if (declaration.resolveToDescriptorIfAny() == null) return null