diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt index fedef6d6801..6aec79ee8ba 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -49,6 +49,10 @@ class JavaClassUseSiteMemberScope( return declaredMemberScope.getCallableNames() + superTypesScope.getCallableNames() } + override fun getClassifierNames(): Set { + return declaredMemberScope.getClassifierNames() + superTypesScope.getClassifierNames() + } + private fun generateAccessorSymbol( functionSymbol: FirFunctionSymbol<*>, syntheticPropertyName: Name, diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassDeclaredMemberScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassDeclaredMemberScope.kt index c9e57661b13..6a2f6438a92 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassDeclaredMemberScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassDeclaredMemberScope.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -80,6 +80,10 @@ class FirClassDeclaredMemberScope( override fun getCallableNames(): Set { return callablesIndex.keys } + + override fun getClassifierNames(): Set { + return nestedClassifierScope?.getClassifierNames().orEmpty() + } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirLazyNestedClassifierScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirLazyNestedClassifierScope.kt index 7129f78e972..22c9a3c2cfc 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirLazyNestedClassifierScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirLazyNestedClassifierScope.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -32,4 +32,8 @@ class FirLazyNestedClassifierScope( processor(symbol, ConeSubstitutor.Empty) } + + override fun getClassifierNames(): Set { + return existingNames.toSet() + } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirNestedClassifierScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirNestedClassifierScope.kt index f3eed3ef56a..ff40c5d44ac 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirNestedClassifierScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirNestedClassifierScope.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -43,6 +43,10 @@ class FirNestedClassifierScope(val klass: FirClass<*>) : FirScope() { } fun getClassifierByName(name: Name): FirRegularClassSymbol? = classIndex[name] + + override fun getClassifierNames(): Set { + return classIndex.keys + } } fun FirTypeParameterRef.toConeType(): ConeKotlinType = ConeTypeParameterTypeImpl(ConeTypeParameterLookupTag(symbol), isNullable = false) \ No newline at end of file diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt index 2242d6381aa..d3c5685f95d 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt @@ -1,6 +1,6 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.fir.scopes.impl @@ -345,6 +345,10 @@ class FirTypeIntersectionScope private constructor( return scopes.flatMapTo(mutableSetOf()) { it.getCallableNames() } } + override fun getClassifierNames(): Set { + return scopes.flatMapTo(hashSetOf()) { it.getClassifierNames() } + } + companion object { fun prepareIntersectionScope( session: FirSession, diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirCompositeScope.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirCompositeScope.kt index e35b4e02cf8..1c1ccff1b07 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirCompositeScope.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirCompositeScope.kt @@ -48,4 +48,8 @@ class FirCompositeScope(private val scopes: Iterable) : FirScope() { override fun getCallableNames(): Set { return scopes.flatMapTo(mutableSetOf()) { it.getCallableNames() } } + + override fun getClassifierNames(): Set { + return scopes.flatMapTo(hashSetOf()) { it.getClassifierNames() } + } } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt index 651af6b1150..994bf9ff1c4 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -35,6 +35,8 @@ abstract class FirScope { open fun mayContainName(name: Name) = true open fun getCallableNames(): Set = emptySet() + + open fun getClassifierNames(): Set = emptySet() } fun FirTypeScope.processOverriddenFunctionsAndSelf(