diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/extensions/SyntheticResolveExtension.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/extensions/SyntheticResolveExtension.kt index 96727f8616e..05f59d40ab0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/extensions/SyntheticResolveExtension.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/extensions/SyntheticResolveExtension.kt @@ -42,6 +42,9 @@ interface SyntheticResolveExtension { override fun getSyntheticNestedClassNames(thisDescriptor: ClassDescriptor): List = instances.flatMap { it.getSyntheticNestedClassNames(thisDescriptor) } + override fun getSyntheticFunctionNames(thisDescriptor: ClassDescriptor): List = + instances.flatMap { it.getSyntheticFunctionNames(thisDescriptor) } + override fun generateSyntheticClasses(thisDescriptor: ClassDescriptor, name: Name, ctx: LazyClassContext, declarationProvider: ClassMemberDeclarationProvider, result: MutableSet) = @@ -69,6 +72,8 @@ interface SyntheticResolveExtension { fun getSyntheticCompanionObjectNameIfNeeded(thisDescriptor: ClassDescriptor): Name? = null + fun getSyntheticFunctionNames(thisDescriptor: ClassDescriptor): List = emptyList() + fun getSyntheticNestedClassNames(thisDescriptor: ClassDescriptor): List = emptyList() fun addSyntheticSupertypes(thisDescriptor: ClassDescriptor, supertypes: MutableList) {} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt index aaff4c2783b..9e81b4eed20 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt @@ -80,6 +80,7 @@ open class LazyClassMemberScope( } addDataClassMethods(result, location) + addSyntheticFunctions(result, location) addSyntheticCompanionObject(result, location) addSyntheticNestedClasses(result, location) @@ -220,6 +221,10 @@ open class LazyClassMemberScope( result.add(descriptor) } + private fun addSyntheticFunctions(result: MutableCollection, location: LookupLocation) { + result.addAll(c.syntheticResolveExtension.getSyntheticFunctionNames(thisDescriptor).flatMap { getContributedFunctions(it, location) }.toList()) + } + private fun addSyntheticNestedClasses(result: MutableCollection, location: LookupLocation) { result.addAll(c.syntheticResolveExtension.getSyntheticNestedClassNames(thisDescriptor).mapNotNull { getContributedClassifier(it, location) }.toList()) }