Fix problem of getting reference and parameter in functional literal inside other parameter (EA-48757)
This commit is contained in:
@@ -102,6 +102,12 @@ public class ResolveElementCache {
|
|||||||
return additionalResolveCache.getValue().fun(elementOfAdditionalResolve);
|
return additionalResolveCache.getValue().fun(elementOfAdditionalResolve);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JetParameter parameter = PsiTreeUtil.getTopmostParentOfType(jetElement, JetParameter.class);
|
||||||
|
if (parameter != null) {
|
||||||
|
// Parameters for function literal could be met inside other parameters. We can't make resolveToDescriptors for internal elements.
|
||||||
|
jetElement = parameter;
|
||||||
|
}
|
||||||
|
|
||||||
JetDeclaration declaration = PsiTreeUtil.getParentOfType(jetElement, JetDeclaration.class, false);
|
JetDeclaration declaration = PsiTreeUtil.getParentOfType(jetElement, JetDeclaration.class, false);
|
||||||
if (declaration != null) {
|
if (declaration != null) {
|
||||||
// Activate descriptor resolution
|
// Activate descriptor resolution
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package testing
|
||||||
|
|
||||||
|
class TestClass(val test: (<caret>String) -> Int)
|
||||||
|
|
||||||
|
// REF: (jet).String
|
||||||
@@ -166,4 +166,9 @@ public class ReferenceResolveTestGenerated extends AbstractResolveBaseTest {
|
|||||||
doTest("idea/testData/resolve/references/SeveralOverrides.kt");
|
doTest("idea/testData/resolve/references/SeveralOverrides.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("TypeParameterInFunctionLiteral.kt")
|
||||||
|
public void testTypeParameterInFunctionLiteral() throws Exception {
|
||||||
|
doTest("idea/testData/resolve/references/TypeParameterInFunctionLiteral.kt");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user