FIR IDE: fix finding fir in container which have conflicting duplicate by name
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// FIR_COMPARISON
|
||||
|
||||
class A {
|
||||
fun f() : A
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// FIR_COMPARISON
|
||||
|
||||
object A {
|
||||
fun f() : S
|
||||
}
|
||||
|
||||
+5
-1
@@ -91,8 +91,12 @@ private fun KtDeclaration.findSourceNonLocalFirDeclarationByProvider(
|
||||
firFile.declarations
|
||||
}
|
||||
val original = originalDeclaration
|
||||
|
||||
/*
|
||||
It is possible that we will not be able to find needed declaration here when the code is invalid,
|
||||
e.g, we have two conflicting declarations with the same name and we are searching in the wrong one
|
||||
*/
|
||||
declarations?.firstOrNull { it.psi == this || it.psi == original }
|
||||
?: error("Cannot find corresponding fir for\n${this.getElementTextInContext()}")
|
||||
}
|
||||
this is KtConstructor<*> -> {
|
||||
val containingClass = containingClassOrObject
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_FIR
|
||||
package test
|
||||
|
||||
class A
|
||||
|
||||
Reference in New Issue
Block a user