From 024c2761c87272148776135ae9816aa306c965ee Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 18 Aug 2015 22:11:05 +0300 Subject: [PATCH] Ignore lookups to parent scope for find super members --- .../kotlinSignature/SignaturesPropagationData.java | 2 +- .../lazy/descriptors/LazyJavaClassMemberScope.kt | 13 ++++++------- .../kotlin/incremental/components/LookupLocation.kt | 3 ++- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/kotlinSignature/SignaturesPropagationData.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/kotlinSignature/SignaturesPropagationData.java index 31aac10630d..2d237af8478 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/kotlinSignature/SignaturesPropagationData.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/kotlinSignature/SignaturesPropagationData.java @@ -303,7 +303,7 @@ public class SignaturesPropagationData { Name name = method.getName(); JvmMethodSignature autoSignature = SIGNATURE_MAPPER.mapToJvmMethodSignature(autoMethodDescriptor); for (JetType supertype : containingClass.getTypeConstructor().getSupertypes()) { - Collection superFunctionCandidates = supertype.getMemberScope().getFunctions(name, NoLookupLocation.UNSORTED); + Collection superFunctionCandidates = supertype.getMemberScope().getFunctions(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS); for (FunctionDescriptor candidate : superFunctionCandidates) { JvmMethodSignature candidateSignature = SIGNATURE_MAPPER.mapToJvmMethodSignature(candidate); if (JvmSignaturePackage.erasedSignaturesEqualIgnoringReturnTypes(autoSignature, candidateSignature)) { diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassMemberScope.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassMemberScope.kt index 814a71d9eaa..eef27f819bf 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassMemberScope.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassMemberScope.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.descriptors.impl.ConstructorDescriptorImpl import org.jetbrains.kotlin.descriptors.impl.EnumEntrySyntheticClassDescriptor import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl import org.jetbrains.kotlin.incremental.components.LookupLocation +import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.load.java.JavaVisibilities import org.jetbrains.kotlin.load.java.JvmAnnotationNames import org.jetbrains.kotlin.load.java.components.DescriptorResolverUtils @@ -44,9 +45,7 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.utils.* -import java.util.ArrayList -import java.util.Collections -import java.util.LinkedHashSet +import java.util.* public class LazyJavaClassMemberScope( c: LazyJavaResolverContext, @@ -82,8 +81,8 @@ public class LazyJavaClassMemberScope( } private fun getFunctionsFromSupertypes(name: Name, descriptor: ClassDescriptor): Set { - return descriptor.getTypeConstructor().getSupertypes().flatMap { - it.getMemberScope().getFunctions(name).map { f -> f as SimpleFunctionDescriptor } + return descriptor.typeConstructor.supertypes.flatMap { + it.memberScope.getFunctions(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS).map { f -> f as SimpleFunctionDescriptor } }.toSet() } @@ -119,8 +118,8 @@ public class LazyJavaClassMemberScope( } private fun getPropertiesFromSupertypes(name: Name, descriptor: ClassDescriptor): Set { - return descriptor.getTypeConstructor().getSupertypes().flatMap { - it.getMemberScope().getProperties(name).map { p -> p as PropertyDescriptor } + return descriptor.typeConstructor.supertypes.flatMap { + it.memberScope.getProperties(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS).map { p -> p as PropertyDescriptor } }.toSet() } diff --git a/core/descriptors/src/org/jetbrains/kotlin/incremental/components/LookupLocation.kt b/core/descriptors/src/org/jetbrains/kotlin/incremental/components/LookupLocation.kt index 349ba4117ff..c884f696816 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/incremental/components/LookupLocation.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/incremental/components/LookupLocation.kt @@ -34,5 +34,6 @@ public enum class NoLookupLocation : LookupLocation { FOR_ALREADY_TRACKED, // TODO replace with real location (e.g. FROM_IDE) where it possible WHEN_GET_ALL_DESCRIPTORS, - WHEN_TYPING + WHEN_TYPING, + WHEN_GET_SUPER_MEMBERS }