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 {
|
class A {
|
||||||
fun f() : A
|
fun f() : A
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// FIR_COMPARISON
|
||||||
|
|
||||||
object A {
|
object A {
|
||||||
fun f() : S
|
fun f() : S
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -91,8 +91,12 @@ private fun KtDeclaration.findSourceNonLocalFirDeclarationByProvider(
|
|||||||
firFile.declarations
|
firFile.declarations
|
||||||
}
|
}
|
||||||
val original = originalDeclaration
|
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 }
|
declarations?.firstOrNull { it.psi == this || it.psi == original }
|
||||||
?: error("Cannot find corresponding fir for\n${this.getElementTextInContext()}")
|
|
||||||
}
|
}
|
||||||
this is KtConstructor<*> -> {
|
this is KtConstructor<*> -> {
|
||||||
val containingClass = containingClassOrObject
|
val containingClass = containingClassOrObject
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_FIR
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
class A
|
class A
|
||||||
|
|||||||
Reference in New Issue
Block a user