diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/impl/FirProviderImpl.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/impl/FirProviderImpl.kt index cc26927d3e7..cef3fc9b545 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/impl/FirProviderImpl.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/impl/FirProviderImpl.kt @@ -57,13 +57,14 @@ class FirProviderImpl(val session: FirSession) : FirProvider { } override fun visitCallableMemberDeclaration(callableMemberDeclaration: FirCallableMemberDeclaration) { - val callableId = when (containerFqName) { - FqName.ROOT -> CallableId(packageName, callableMemberDeclaration.name) - else -> CallableId(packageName, containerFqName, callableMemberDeclaration.name) - } + val callableId = (callableMemberDeclaration.symbol as ConeCallableSymbol).callableId callableMap.merge(callableId, listOf(callableMemberDeclaration)) { a, b -> a + b } } + override fun visitConstructor(constructor: FirConstructor) { + visitCallableMemberDeclaration(constructor) + } + override fun visitNamedFunction(namedFunction: FirNamedFunction) { visitCallableMemberDeclaration(namedFunction) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTopLevelDeclaredMemberScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTopLevelDeclaredMemberScope.kt index 3199e1d2a40..3fcdc8ec402 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTopLevelDeclaredMemberScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTopLevelDeclaredMemberScope.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.symbols.CallableId import org.jetbrains.kotlin.fir.symbols.ConeFunctionSymbol import org.jetbrains.kotlin.fir.symbols.ConePropertySymbol import org.jetbrains.kotlin.fir.symbols.ConeVariableSymbol +import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name class FirTopLevelDeclaredMemberScope( @@ -24,6 +25,12 @@ class FirTopLevelDeclaredMemberScope( private val packageFqName = file.packageFqName override fun processFunctionsByName(name: Name, processor: (ConeFunctionSymbol) -> ProcessorAction): ProcessorAction { + val constructors = provider.getCallableSymbols(CallableId(packageFqName, FqName.topLevel(name), name)) + for (symbol in constructors) { + if (symbol is ConeFunctionSymbol && !processor(symbol)) { + return STOP + } + } val symbols = provider.getCallableSymbols(CallableId(packageFqName, name)) for (symbol in symbols) { if (symbol is ConeFunctionSymbol && !processor(symbol)) { diff --git a/compiler/fir/resolve/testData/resolve/derivedClass.txt b/compiler/fir/resolve/testData/resolve/derivedClass.txt index 316e6713f64..d609c1939a7 100644 --- a/compiler/fir/resolve/testData/resolve/derivedClass.txt +++ b/compiler/fir/resolve/testData/resolve/derivedClass.txt @@ -11,5 +11,5 @@ FILE: derivedClass.kt } public final function create(x: R|T|): R|Derived| { - return@@@create #(R|/x|) + return@@@create R|/Derived.Derived|(R|/x|) } diff --git a/compiler/fir/resolve/testData/resolve/expresssions/invoke/explicitReceiver.txt b/compiler/fir/resolve/testData/resolve/expresssions/invoke/explicitReceiver.txt index 4c0d0fb1b92..777f74db961 100644 --- a/compiler/fir/resolve/testData/resolve/expresssions/invoke/explicitReceiver.txt +++ b/compiler/fir/resolve/testData/resolve/expresssions/invoke/explicitReceiver.txt @@ -4,7 +4,7 @@ FILE: explicitReceiver.kt public final class Foo { public constructor(): super() - public final property x(val): R|Foo| = #() + public final property x(val): R|Foo| = R|/Foo.Foo|() public get(): R|Foo| public final operator function invoke(): R|Foo| { diff --git a/compiler/fir/resolve/testData/resolve/expresssions/invoke/explicitReceiver2.txt b/compiler/fir/resolve/testData/resolve/expresssions/invoke/explicitReceiver2.txt index 0d5587e821b..7e4cf4127c1 100644 --- a/compiler/fir/resolve/testData/resolve/expresssions/invoke/explicitReceiver2.txt +++ b/compiler/fir/resolve/testData/resolve/expresssions/invoke/explicitReceiver2.txt @@ -16,7 +16,7 @@ FILE: explicitReceiver2.kt return@@@invoke this# } - public final property x(val): R|Bar| = #() + public final property x(val): R|Bar| = R|/Bar.Bar|() public get(): R|Bar| public final function bar(): R|Foo| { diff --git a/compiler/fir/resolve/testData/resolve/overrides/simpleFakeOverride.txt b/compiler/fir/resolve/testData/resolve/overrides/simpleFakeOverride.txt index f09c8e4a09c..897024092bc 100644 --- a/compiler/fir/resolve/testData/resolve/overrides/simpleFakeOverride.txt +++ b/compiler/fir/resolve/testData/resolve/overrides/simpleFakeOverride.txt @@ -15,7 +15,7 @@ FILE: simpleFakeOverride.kt public constructor(): super|>() public final function test(): R|kotlin/Unit| { - R|FakeOverride|(#()) + R|FakeOverride|(R|/Some.Some|()) } }