From dd392963acdae4d0ff875289206bc243e3f74cdd Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Tue, 6 Dec 2016 13:09:57 +0300 Subject: [PATCH] Minor. Rename SyntheticExtensionFunctions -> SyntheticMemberFunctions --- .../kotlin/synthetic/JavaSyntheticPropertiesScope.kt | 4 ++-- .../kotlin/synthetic/SamAdapterFunctionsScope.kt | 4 ++-- .../kotlin/resolve/calls/tower/TowerLevels.kt | 2 +- .../kotlin/resolve/scopes/SyntheticScopes.kt | 12 ++++++------ .../idea/codeInsight/ReferenceVariantsHelper.kt | 2 +- .../inspections/RedundantSamConstructorInspection.kt | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt index c967b5eeb22..c531dcda8de 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt @@ -259,8 +259,8 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l return Name.identifier("set" + identifier.removePrefix(prefix)) } - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection = emptyList() - override fun getSyntheticExtensionFunctions(receiverTypes: Collection): Collection = emptyList() + override fun getSyntheticMemberFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection = emptyList() + override fun getSyntheticMemberFunctions(receiverTypes: Collection): Collection = emptyList() private data class SyntheticPropertyHolder(val descriptor: PropertyDescriptor?, val lookedNames: List) { companion object { diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt index 372a6d81500..98b79206fc9 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt @@ -55,7 +55,7 @@ class SamAdapterFunctionsScope( return MyFunctionDescriptor.create(function) } - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection { + override fun getSyntheticMemberFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection { var result: SmartList? = null for (type in receiverTypes) { val substitutorForType by lazy { buildMemberScopeSubstitutorForType(type) } @@ -80,7 +80,7 @@ class SamAdapterFunctionsScope( private fun buildMemberScopeSubstitutorForType(type: KotlinType) = TypeConstructorSubstitution.create(type).wrapWithCapturingSubstitution(needApproximation = true).buildSubstitutor() - override fun getSyntheticExtensionFunctions(receiverTypes: Collection): Collection { + override fun getSyntheticMemberFunctions(receiverTypes: Collection): Collection { return receiverTypes.flatMapTo(LinkedHashSet()) { type -> type.memberScope.getContributedDescriptors(DescriptorKindFilter.FUNCTIONS) .filterIsInstance() diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt index 3d0adb2b3bf..2e473f5e9ee 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt @@ -146,7 +146,7 @@ internal class MemberScopeTowerLevel( override fun getFunctions(name: Name, extensionReceiver: ReceiverValueWithSmartCastInfo?): Collection> { return collectMembers { getContributedFunctions(name, location) + it.getInnerConstructors(name, location) + - syntheticScopes.collectSyntheticExtensionFunctions(it.singletonOrEmptyList(), name, location) + syntheticScopes.collectSyntheticMemberFunctions(it.singletonOrEmptyList(), name, location) } } } diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SyntheticScopes.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SyntheticScopes.kt index 6be500bc2b5..adb456006eb 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SyntheticScopes.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SyntheticScopes.kt @@ -25,10 +25,10 @@ import org.jetbrains.kotlin.types.KotlinType interface SyntheticScope { fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: LookupLocation): Collection - fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection + fun getSyntheticMemberFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection - fun getSyntheticExtensionFunctions(receiverTypes: Collection): Collection + fun getSyntheticMemberFunctions(receiverTypes: Collection): Collection } interface SyntheticScopes { @@ -43,11 +43,11 @@ interface SyntheticScopes { fun SyntheticScopes.collectSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: LookupLocation) = scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes, name, location) } -fun SyntheticScopes.collectSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation) - = scopes.flatMap { it.getSyntheticExtensionFunctions(receiverTypes, name, location) } +fun SyntheticScopes.collectSyntheticMemberFunctions(receiverTypes: Collection, name: Name, location: LookupLocation) + = scopes.flatMap { it.getSyntheticMemberFunctions(receiverTypes, name, location) } fun SyntheticScopes.collectSyntheticExtensionProperties(receiverTypes: Collection) = scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes) } -fun SyntheticScopes.collectSyntheticExtensionFunctions(receiverTypes: Collection) - = scopes.flatMap { it.getSyntheticExtensionFunctions(receiverTypes) } \ No newline at end of file +fun SyntheticScopes.collectSyntheticMemberFunctions(receiverTypes: Collection) + = scopes.flatMap { it.getSyntheticMemberFunctions(receiverTypes) } diff --git a/idea/ide-common/src/org/jetbrains/kotlin/idea/codeInsight/ReferenceVariantsHelper.kt b/idea/ide-common/src/org/jetbrains/kotlin/idea/codeInsight/ReferenceVariantsHelper.kt index 841f97fcc57..ac11dec7b66 100644 --- a/idea/ide-common/src/org/jetbrains/kotlin/idea/codeInsight/ReferenceVariantsHelper.kt +++ b/idea/ide-common/src/org/jetbrains/kotlin/idea/codeInsight/ReferenceVariantsHelper.kt @@ -385,7 +385,7 @@ class ReferenceVariantsHelper( } if (kindFilter.acceptsKinds(DescriptorKindFilter.FUNCTIONS_MASK)) { - for (syntheticMember in syntheticScopes.collectSyntheticExtensionFunctions(receiverTypes)) { + for (syntheticMember in syntheticScopes.collectSyntheticMemberFunctions(receiverTypes)) { process(syntheticMember) } } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSamConstructorInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSamConstructorInspection.kt index 0603d0f3027..a198f794fd1 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSamConstructorInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSamConstructorInspection.kt @@ -44,7 +44,7 @@ import org.jetbrains.kotlin.resolve.calls.model.isReallySuccess import org.jetbrains.kotlin.resolve.calls.util.DelegatingCall import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode import org.jetbrains.kotlin.resolve.scopes.SyntheticScopes -import org.jetbrains.kotlin.resolve.scopes.collectSyntheticExtensionFunctions +import org.jetbrains.kotlin.resolve.scopes.collectSyntheticMemberFunctions import org.jetbrains.kotlin.synthetic.SamAdapterExtensionFunctionDescriptor import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.utils.addToStdlib.check @@ -186,7 +186,7 @@ class RedundantSamConstructorInspection : AbstractKotlinInspection() { // SAM adapters for member functions val syntheticScopes = functionCall.getResolutionFacade().getFrontendService(SyntheticScopes::class.java) - val syntheticExtensions = syntheticScopes.collectSyntheticExtensionFunctions( + val syntheticExtensions = syntheticScopes.collectSyntheticMemberFunctions( containingClass.defaultType.singletonList(), functionResolvedCall.resultingDescriptor.name, NoLookupLocation.FROM_IDE) @@ -236,4 +236,4 @@ class RedundantSamConstructorInspection : AbstractKotlinInspection() { return argument.anyDescendantOfType { it.getLabelNameAsName() == samConstructorName } } } -} \ No newline at end of file +}