mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] check if code reference immediate parent is a file in GrCodeReferenceElement#getActualParent
Immediate parent is a file when the reference is created from stub, in other cases it might be a child of another tree with another context, so it's incorrect to go to the containing file skipping the tree; for example when inferring parameter types from outer calls the reference will be part of big method tree with the original method as a context. GitOrigin-RevId: 30b1cc4d25b803cfd7291d2f4019acec6c2420f6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8aae2a397e
commit
5c9b0d5489
+4
-1
@@ -231,7 +231,10 @@ private fun GrCodeReferenceElement.canResolveToInnerClassOfCurrentClass(): Boole
|
||||
/**
|
||||
* Reference element may be created from stub. In this case containing file will be dummy, and its context will be reference parent
|
||||
*/
|
||||
private fun GrCodeReferenceElement.getActualParent(): PsiElement? = containingFile.context ?: parent
|
||||
private fun GrCodeReferenceElement.getActualParent(): PsiElement? {
|
||||
val parent = parent
|
||||
return (parent as? PsiFile)?.context ?: parent
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.codehaus.groovy.control.ResolveVisitor.currentClass
|
||||
|
||||
Reference in New Issue
Block a user