FIR IDE: fix local class containing file search
This commit is contained in:
@@ -30,10 +30,10 @@ abstract class FirProvider : FirSymbolProvider() {
|
||||
|
||||
abstract fun getFirClassifierContainerFileIfAny(fqName: ClassId): FirFile?
|
||||
|
||||
fun getFirClassifierContainerFile(symbol: FirClassLikeSymbol<*>): FirFile =
|
||||
open fun getFirClassifierContainerFile(symbol: FirClassLikeSymbol<*>): FirFile =
|
||||
getFirClassifierContainerFile(symbol.classId)
|
||||
|
||||
fun getFirClassifierContainerFileIfAny(symbol: FirClassLikeSymbol<*>): FirFile? =
|
||||
open fun getFirClassifierContainerFileIfAny(symbol: FirClassLikeSymbol<*>): FirFile? =
|
||||
getFirClassifierContainerFileIfAny(symbol.classId)
|
||||
|
||||
abstract fun getFirCallableContainerFile(symbol: FirCallableSymbol<*>): FirFile?
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
object A {
|
||||
val x : Int = 0
|
||||
}
|
||||
|
||||
open class Foo {
|
||||
fun foo() : Int = 1
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.x
|
||||
val b = object : Foo() {
|
||||
}
|
||||
b.foo()
|
||||
|
||||
object B {
|
||||
fun foo() {}
|
||||
}
|
||||
B.foo()
|
||||
}
|
||||
|
||||
val bb = <!UNRESOLVED_REFERENCE!>B<!>.<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||
@@ -0,0 +1,44 @@
|
||||
FILE: localObjects.kt
|
||||
public final object A : R|kotlin/Any| {
|
||||
private constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|kotlin/Int| = Int(0)
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
}
|
||||
public open class Foo : R|kotlin/Any| {
|
||||
public constructor(): R|Foo| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Int| {
|
||||
^foo Int(1)
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
Q|A|.R|/A.x|
|
||||
lval b: R|anonymous| = object : R|Foo| {
|
||||
private constructor(): R|Foo| {
|
||||
super<R|Foo|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
R|<local>/b|.R|/Foo.foo|()
|
||||
local final object B : R|kotlin/Any| {
|
||||
private constructor(): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Q|B|.R|/B.foo|()
|
||||
}
|
||||
public final val bb: <ERROR TYPE REF: Unresolved name: foo> = <Unresolved name: B>#.<Unresolved name: foo>#()
|
||||
public get(): <ERROR TYPE REF: Unresolved name: foo>
|
||||
+5
@@ -489,6 +489,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/resolve/testData/resolve/expresssions/localInnerClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localObjects.kt")
|
||||
public void testLocalObjects() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/expresssions/localObjects.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localScopes.kt")
|
||||
public void testLocalScopes() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/expresssions/localScopes.kt");
|
||||
|
||||
Reference in New Issue
Block a user