Ignore lookups to parent scope for find super members

This commit is contained in:
Zalim Bashorov
2015-08-18 22:11:05 +03:00
parent 2f13c89fd8
commit 024c2761c8
3 changed files with 9 additions and 9 deletions
@@ -303,7 +303,7 @@ public class SignaturesPropagationData {
Name name = method.getName();
JvmMethodSignature autoSignature = SIGNATURE_MAPPER.mapToJvmMethodSignature(autoMethodDescriptor);
for (JetType supertype : containingClass.getTypeConstructor().getSupertypes()) {
Collection<FunctionDescriptor> superFunctionCandidates = supertype.getMemberScope().getFunctions(name, NoLookupLocation.UNSORTED);
Collection<FunctionDescriptor> 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)) {
@@ -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<SimpleFunctionDescriptor> {
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<PropertyDescriptor> {
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()
}
@@ -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
}