mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
navigate from var in lambda parameter
This commit is contained in:
@@ -163,6 +163,11 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
|
||||
if (iteratedValue != null) {
|
||||
return JavaGenericsUtil.getCollectionItemType(iteratedValue);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (declarationScope instanceof PsiLambdaExpression) {
|
||||
return ((PsiParameter)parent).getType();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import java.util.function.Function;
|
||||
|
||||
class Main {
|
||||
public static void main(String[] args) {
|
||||
Function<String, String> f = (final v<caret>ar a) -> a;
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.java.codeInsight.daemon;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.codeInsight.navigation.actions.GotoDeclarationAction;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.CommonClassNames;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
|
||||
public class LightAdvHighlightingJdk11Test extends LightDaemonAnalyzerTestCase {
|
||||
private static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/advHighlighting11";
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
setLanguageLevel(LanguageLevel.JDK_X);
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_10, getModule(), getTestRootDisposable());//todo
|
||||
}
|
||||
|
||||
public void testGotoDeclarationOnLambdaVarParameter() {
|
||||
configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
|
||||
final int offset = getEditor().getCaretModel().getOffset();
|
||||
final PsiElement[] elements =
|
||||
GotoDeclarationAction.findAllTargetElements(getProject(), getEditor(), offset);
|
||||
assertSize(1, elements);
|
||||
PsiElement element = elements[0];
|
||||
assertInstanceOf(element, PsiClass.class);
|
||||
assertEquals(CommonClassNames.JAVA_LANG_STRING, ((PsiClass)element).getQualifiedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return IdeaTestUtil.getMockJdk9();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user