Don't ruin highlighting if there's no descriptor in resolve session
#EA-61683 Fixed
This commit is contained in:
@@ -34,8 +34,9 @@ import org.jetbrains.annotations.TestOnly
|
|||||||
import com.intellij.codeInsight.daemon.GutterIconNavigationHandler
|
import com.intellij.codeInsight.daemon.GutterIconNavigationHandler
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import com.intellij.util.Function
|
import com.intellij.util.Function
|
||||||
import org.jetbrains.jet.plugin.caches.resolve.getLazyResolveSession
|
|
||||||
import org.jetbrains.jet.lang.psi.JetDeclaration
|
import org.jetbrains.jet.lang.psi.JetDeclaration
|
||||||
|
import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache
|
||||||
|
import org.jetbrains.jet.lang.resolve.BindingContext
|
||||||
|
|
||||||
object SuperDeclarationMarkerTooltip: Function<JetDeclaration, String> {
|
object SuperDeclarationMarkerTooltip: Function<JetDeclaration, String> {
|
||||||
override fun `fun`(jetDeclaration: JetDeclaration?): String? {
|
override fun `fun`(jetDeclaration: JetDeclaration?): String? {
|
||||||
@@ -111,7 +112,8 @@ public data class ResolveWithParentsResult(
|
|||||||
val overriddenDescriptors: Collection<CallableMemberDescriptor>)
|
val overriddenDescriptors: Collection<CallableMemberDescriptor>)
|
||||||
|
|
||||||
public fun resolveDeclarationWithParents(element: JetDeclaration): ResolveWithParentsResult {
|
public fun resolveDeclarationWithParents(element: JetDeclaration): ResolveWithParentsResult {
|
||||||
val descriptor = element.getLazyResolveSession().resolveToDescriptor(element)
|
val bindingContext = AnalyzerFacadeWithCache.getContextForElement(element)
|
||||||
|
val descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element)
|
||||||
|
|
||||||
if (descriptor !is CallableMemberDescriptor) return ResolveWithParentsResult(null, listOf())
|
if (descriptor !is CallableMemberDescriptor) return ResolveWithParentsResult(null, listOf())
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
trait Hi {
|
||||||
|
fun foo(): Int
|
||||||
|
}
|
||||||
|
|
||||||
|
// Closing brace is intentionally missed
|
||||||
|
val id = array("kotlin.FlexibleType"
|
||||||
|
|
||||||
|
private class Some(): Hi {
|
||||||
|
override fun foo() = 1
|
||||||
|
}
|
||||||
@@ -38,6 +38,12 @@ public class LineMarkersTestGenerated extends AbstractLineMarkersTest {
|
|||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/codeInsight/lineMarker"), Pattern.compile("^(.+)\\.kt$"), true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/codeInsight/lineMarker"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("BadCodeNoExceptions.kt")
|
||||||
|
public void testBadCodeNoExceptions() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/codeInsight/lineMarker/BadCodeNoExceptions.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("Class.kt")
|
@TestMetadata("Class.kt")
|
||||||
public void testClass() throws Exception {
|
public void testClass() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/codeInsight/lineMarker/Class.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/codeInsight/lineMarker/Class.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user