diff --git a/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.java b/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.java index 41f9378c67f..167c2d86665 100644 --- a/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.java +++ b/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.java @@ -31,7 +31,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils; import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage; import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilPackage; import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.types.JetType; import org.jetbrains.kotlin.types.TypeUtils; import org.jetbrains.kotlin.types.checker.JetTypeChecker; @@ -60,7 +60,7 @@ public class CodegenUtil { @NotNull ClassifierDescriptor returnedClassifier, @NotNull ClassifierDescriptor... valueParameterClassifiers ) { - Collection functions = owner.getDefaultType().getMemberScope().getFunctions(name, UsageLocation.NO_LOCATION); + Collection functions = owner.getDefaultType().getMemberScope().getFunctions(name, LookupLocation.NO_LOCATION); for (FunctionDescriptor function : functions) { if (!CallResolverUtilPackage.isOrOverridesSynthesized(function) && function.getTypeParameters().isEmpty() diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java index cdc138d3386..3115fca9faa 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java @@ -36,7 +36,7 @@ import org.jetbrains.kotlin.load.kotlin.PackageClassUtils; import org.jetbrains.kotlin.psi.JetElement; import org.jetbrains.kotlin.resolve.BindingContext; import org.jetbrains.kotlin.resolve.DescriptorUtils; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.types.JetType; import org.jetbrains.kotlin.types.expressions.OperatorConventions; import org.jetbrains.kotlin.utils.UtilsPackage; @@ -453,6 +453,6 @@ public class ClosureCodegen extends MemberCodegen { ClassDescriptor elementClass = elementDescriptor.getExtensionReceiverParameter() == null ? getBuiltIns(elementDescriptor).getFunction(arity) : getBuiltIns(elementDescriptor).getExtensionFunction(arity); - return elementClass.getDefaultType().getMemberScope().getFunctions(OperatorConventions.INVOKE, UsageLocation.NO_LOCATION).iterator().next(); + return elementClass.getDefaultType().getMemberScope().getFunctions(OperatorConventions.INVOKE, LookupLocation.NO_LOCATION).iterator().next(); } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index 347a59ea3f9..c724278a7bf 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -74,7 +74,7 @@ import org.jetbrains.kotlin.resolve.inline.InlineUtil; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.resolve.scopes.receivers.*; import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor; import org.jetbrains.kotlin.types.JetType; @@ -1075,7 +1075,7 @@ public class ExpressionCodegen extends JetVisitor implem Type asmLoopRangeType = asmType(loopRangeType); Collection incrementProp = - loopRangeType.getMemberScope().getProperties(Name.identifier("increment"), UsageLocation.NO_LOCATION); + loopRangeType.getMemberScope().getProperties(Name.identifier("increment"), LookupLocation.NO_LOCATION); assert incrementProp.size() == 1 : loopRangeType + " " + incrementProp.size(); incrementType = asmType(incrementProp.iterator().next().getType()); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java index 11c5dad9b9d..db3a72016fc 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java @@ -62,7 +62,7 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmClassSignature; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver; import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue; import org.jetbrains.kotlin.resolve.scopes.receivers.ThisReceiver; @@ -403,7 +403,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { private boolean isGenericToArrayPresent() { Collection functions = - descriptor.getDefaultType().getMemberScope().getFunctions(Name.identifier("toArray"), UsageLocation.NO_LOCATION); + descriptor.getDefaultType().getMemberScope().getFunctions(Name.identifier("toArray"), LookupLocation.NO_LOCATION); for (FunctionDescriptor function : functions) { if (CallResolverUtilPackage.isOrOverridesSynthesized(function)) { continue; @@ -817,7 +817,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { Type type = typeMapper.mapType(getBuiltIns(descriptor).getArrayType(INVARIANT, descriptor.getDefaultType())); FunctionDescriptor valuesFunction = - KotlinPackage.single(descriptor.getStaticScope().getFunctions(ENUM_VALUES, UsageLocation.NO_LOCATION), new Function1() { + KotlinPackage.single(descriptor.getStaticScope().getFunctions(ENUM_VALUES, LookupLocation.NO_LOCATION), new Function1() { @Override public Boolean invoke(FunctionDescriptor descriptor) { return CodegenUtil.isEnumValuesMethod(descriptor); @@ -837,7 +837,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { private void generateEnumValueOfMethod() { FunctionDescriptor valueOfFunction = - KotlinPackage.single(descriptor.getStaticScope().getFunctions(ENUM_VALUE_OF, UsageLocation.NO_LOCATION), new Function1() { + KotlinPackage.single(descriptor.getStaticScope().getFunctions(ENUM_VALUE_OF, LookupLocation.NO_LOCATION), new Function1() { @Override public Boolean invoke(FunctionDescriptor descriptor) { return CodegenUtil.isEnumValueOfMethod(descriptor); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/SamWrapperCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/SamWrapperCodegen.java index b3a1c00a842..21cf332fbf4 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/SamWrapperCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/SamWrapperCodegen.java @@ -30,7 +30,7 @@ import org.jetbrains.kotlin.name.FqName; import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.psi.JetFile; import org.jetbrains.kotlin.resolve.DescriptorUtils; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.types.JetType; import org.jetbrains.kotlin.types.expressions.OperatorConventions; import org.jetbrains.org.objectweb.asm.MethodVisitor; @@ -149,7 +149,7 @@ public class SamWrapperCodegen { (ClassDescriptor) erasedInterfaceFunction.getContainingDeclaration(), OwnerKind.IMPLEMENTATION, state), cv, state, parentCodegen); FunctionDescriptor invokeFunction = - functionJetType.getMemberScope().getFunctions(OperatorConventions.INVOKE, UsageLocation.NO_LOCATION).iterator().next().getOriginal(); + functionJetType.getMemberScope().getFunctions(OperatorConventions.INVOKE, LookupLocation.NO_LOCATION).iterator().next().getOriginal(); StackValue functionField = StackValue.field(functionType, ownerType, FUNCTION_FIELD_NAME, false, StackValue.none()); codegen.genDelegate(erasedInterfaceFunction, invokeFunction, functionField); 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 3ed82d56375..ae8de12ef13 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 @@ -44,7 +44,7 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmSignaturePackage; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.KotlinToJvmSignatureMapper; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.types.*; import java.util.*; @@ -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, UsageLocation.NO_LOCATION); + Collection superFunctionCandidates = supertype.getMemberScope().getFunctions(name, LookupLocation.NO_LOCATION); for (FunctionDescriptor candidate : superFunctionCandidates) { JvmMethodSignature candidateSignature = SIGNATURE_MAPPER.mapToJvmMethodSignature(candidate); if (JvmSignaturePackage.erasedSignaturesEqualIgnoringReturnTypes(autoSignature, candidateSignature)) { 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 48fff2c6b7c..5c3a66c69d6 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/JavaSyntheticPropertiesScope.kt @@ -24,10 +24,7 @@ import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.DescriptorUtils -import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter -import org.jetbrains.kotlin.resolve.scopes.JetScope -import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.* import org.jetbrains.kotlin.storage.StorageManager import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.typeUtil.isBoolean @@ -145,7 +142,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager) : JetScopeImp return null } - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: LookupLocation): Collection { //TODO: use location parameter! var result: SmartList? = null @@ -301,4 +298,4 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager) : JetScopeImp initialize(getter, setter) } } -} \ No newline at end of file +} 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 0bbbe1a187b..bba41d53b6d 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/synthetic/SamAdapterFunctionsScope.kt @@ -27,7 +27,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.descriptorUtil.parentsWithSelf import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScope -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.storage.StorageManager import org.jetbrains.kotlin.types.DescriptorSubstitutor import org.jetbrains.kotlin.types.JetType @@ -55,7 +55,7 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : JetScope by Jet return MyFunctionDescriptor(enhancedFunction) } - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection { var result: SmartList? = null for (type in receiverTypes) { for (function in type.memberScope.getFunctions(name, location)) { @@ -119,4 +119,4 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : JetScope by Jet override fun hasStableParameterNames() = originalFunction.hasStableParameterNames() override fun hasSynthesizedParameterNames() = originalFunction.hasSynthesizedParameterNames() } -} \ No newline at end of file +} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AllUnderImportsScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AllUnderImportsScope.kt index 8bbb7348466..bdb6a544c67 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AllUnderImportsScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AllUnderImportsScope.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScope -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.utils.Printer import java.util.ArrayList @@ -42,23 +42,23 @@ class AllUnderImportsScope : JetScope { return scopes.flatMap { it.getDescriptors(kindFilter, nameFilter) } } - override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? { + override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? { return scopes.asSequence().map { it.getClassifier(name, location) }.filterNotNull().singleOrNull() } - override fun getProperties(name: Name, location: UsageLocation): Collection { + override fun getProperties(name: Name, location: LookupLocation): Collection { return scopes.flatMap { it.getProperties(name, location) } } - override fun getFunctions(name: Name, location: UsageLocation): Collection { + override fun getFunctions(name: Name, location: LookupLocation): Collection { return scopes.flatMap { it.getFunctions(name, location) } } - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: LookupLocation): Collection { return scopes.flatMap { it.getSyntheticExtensionProperties(receiverTypes, name, location) } } - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection { return scopes.flatMap { it.getSyntheticExtensionFunctions(receiverTypes, name, location) } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java index d948ddb3379..ebb843c3643 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java @@ -519,7 +519,7 @@ public class DescriptorResolver { Name name = nameExpression.getReferencedNameAsName(); - ClassifierDescriptor classifier = scope.getClassifier(name, UsageLocation.NO_LOCATION); + ClassifierDescriptor classifier = scope.getClassifier(name, LookupLocation.NO_LOCATION); if (classifier instanceof TypeParameterDescriptor && classifier.getContainingDeclaration() == descriptor) continue; if (classifier != null) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/OverrideResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/OverrideResolver.java index eec6cf2efa9..31294ed497b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/OverrideResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/OverrideResolver.java @@ -38,7 +38,7 @@ import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.psi.*; import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilPackage; import org.jetbrains.kotlin.resolve.dataClassUtils.DataClassUtilsPackage; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue; import org.jetbrains.kotlin.types.*; import org.jetbrains.kotlin.types.checker.JetTypeChecker; @@ -730,9 +730,9 @@ public class OverrideResolver { ) { for (JetType supertype : declaringClass.getTypeConstructor().getSupertypes()) { Set all = Sets.newLinkedHashSet(); - all.addAll(supertype.getMemberScope().getFunctions(declared.getName(), UsageLocation.NO_LOCATION)); + all.addAll(supertype.getMemberScope().getFunctions(declared.getName(), LookupLocation.NO_LOCATION)); //noinspection unchecked - all.addAll((Collection) supertype.getMemberScope().getProperties(declared.getName(), UsageLocation.NO_LOCATION)); + all.addAll((Collection) supertype.getMemberScope().getProperties(declared.getName(), LookupLocation.NO_LOCATION)); for (CallableMemberDescriptor fromSuper : all) { if (OverridingUtil.DEFAULT.isOverridableBy(fromSuper, declared).getResult() == OVERRIDABLE) { if (Visibilities.isVisible(ReceiverValue.IRRELEVANT_RECEIVER, fromSuper, declared)) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.java index bac3d3f5c75..f41237a72c4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.java @@ -30,7 +30,7 @@ import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.psi.*; import org.jetbrains.kotlin.resolve.scopes.AbstractScopeAdapter; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue; import org.jetbrains.kotlin.resolve.validation.SymbolUsageValidator; @@ -229,14 +229,14 @@ public class QualifiedExpressionResolver { descriptors.add(packageDescriptor); } - ClassifierDescriptor classifierDescriptor = outerScope.getClassifier(referencedName, UsageLocation.NO_LOCATION); + ClassifierDescriptor classifierDescriptor = outerScope.getClassifier(referencedName, LookupLocation.NO_LOCATION); if (classifierDescriptor != null) { descriptors.add(classifierDescriptor); } if (lookupMode == LookupMode.EVERYTHING) { - descriptors.addAll(outerScope.getFunctions(referencedName, UsageLocation.NO_LOCATION)); - descriptors.addAll(outerScope.getProperties(referencedName, UsageLocation.NO_LOCATION)); + descriptors.addAll(outerScope.getFunctions(referencedName, LookupLocation.NO_LOCATION)); + descriptors.addAll(outerScope.getProperties(referencedName, LookupLocation.NO_LOCATION)); VariableDescriptor localVariable = outerScope.getLocalVariable(referencedName); if (localVariable != null) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/SingleImportScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/SingleImportScope.kt index 8d52ece02cb..b8d5944ef0c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/SingleImportScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/SingleImportScope.kt @@ -20,20 +20,20 @@ import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.utils.Printer class SingleImportScope(private val aliasName: Name, private val descriptors: Collection) : JetScopeImpl() { - override fun getClassifier(name: Name, location: UsageLocation) + override fun getClassifier(name: Name, location: LookupLocation) = if (name == aliasName) descriptors.filterIsInstance().singleOrNull() else null override fun getPackage(name: Name) = if (name == aliasName) descriptors.filterIsInstance().singleOrNull() else null - override fun getProperties(name: Name, location: UsageLocation) + override fun getProperties(name: Name, location: LookupLocation) = if (name == aliasName) descriptors.filterIsInstance() else emptyList() - override fun getFunctions(name: Name, location: UsageLocation) + override fun getFunctions(name: Name, location: LookupLocation) = if (name == aliasName) descriptors.filterIsInstance() else emptyList() override fun getContainingDeclaration(): DeclarationDescriptor = throw UnsupportedOperationException() diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/dynamicCalls.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/dynamicCalls.kt index fcfb9d660b2..e1f140a1e92 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/dynamicCalls.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/dynamicCalls.kt @@ -29,7 +29,7 @@ import org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCol import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns import org.jetbrains.kotlin.resolve.scopes.JetScope import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver import org.jetbrains.kotlin.types.DynamicType import org.jetbrains.kotlin.types.JetType @@ -49,7 +49,7 @@ object DynamicCallableDescriptors { p.println(javaClass.getSimpleName(), ": dynamic candidates for " + call) } - override fun getFunctions(name: Name, location: UsageLocation): Collection { + override fun getFunctions(name: Name, location: LookupLocation): Collection { if (isAugmentedAssignmentConvention(name)) return listOf() if (call.getCallType() == Call.CallType.INVOKE && call.getValueArgumentList() == null && call.getFunctionLiteralArguments().isEmpty()) { @@ -77,7 +77,7 @@ object DynamicCallableDescriptors { return false } - override fun getProperties(name: Name, location: UsageLocation): Collection { + override fun getProperties(name: Name, location: LookupLocation): Collection { return if (call.getValueArgumentList() == null && call.getValueArguments().isEmpty()) { listOf(createDynamicProperty(owner, name, call)) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyDeclarationResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyDeclarationResolver.java index aab3d995600..f1d4faf7e2a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyDeclarationResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyDeclarationResolver.java @@ -30,7 +30,7 @@ import org.jetbrains.kotlin.resolve.BindingContext; import org.jetbrains.kotlin.resolve.BindingTrace; import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyPackageDescriptor; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.storage.LockBasedLazyResolveStorageManager; import javax.inject.Inject; @@ -70,7 +70,7 @@ public class LazyDeclarationResolver { // class A {} class A { fun foo(): A} // and if we find the class by name only, we may b-not get the right one. // This call is only needed to make sure the classes are written to trace - ClassifierDescriptor scopeDescriptor = resolutionScope.getClassifier(classOrObject.getNameAsSafeName(), UsageLocation.NO_LOCATION); + ClassifierDescriptor scopeDescriptor = resolutionScope.getClassifier(classOrObject.getNameAsSafeName(), LookupLocation.NO_LOCATION); DeclarationDescriptor descriptor = getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, classOrObject); if (descriptor == null) { @@ -134,7 +134,7 @@ public class LazyDeclarationResolver { @Override public DeclarationDescriptor visitNamedFunction(@NotNull JetNamedFunction function, Void data) { JetScope scopeForDeclaration = resolutionScopeToResolveDeclaration(function); - scopeForDeclaration.getFunctions(function.getNameAsSafeName(), UsageLocation.NO_LOCATION); + scopeForDeclaration.getFunctions(function.getNameAsSafeName(), LookupLocation.NO_LOCATION); return getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, function); } @@ -146,7 +146,7 @@ public class LazyDeclarationResolver { // This is a primary constructor parameter ClassDescriptor classDescriptor = getClassDescriptor(jetClass); if (parameter.hasValOrVar()) { - classDescriptor.getDefaultType().getMemberScope().getProperties(parameter.getNameAsSafeName(), UsageLocation.NO_LOCATION); + classDescriptor.getDefaultType().getMemberScope().getProperties(parameter.getNameAsSafeName(), LookupLocation.NO_LOCATION); return getBindingContext().get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter); } else { @@ -189,7 +189,7 @@ public class LazyDeclarationResolver { @Override public DeclarationDescriptor visitProperty(@NotNull JetProperty property, Void data) { JetScope scopeForDeclaration = resolutionScopeToResolveDeclaration(property); - scopeForDeclaration.getProperties(property.getNameAsSafeName(), UsageLocation.NO_LOCATION); + scopeForDeclaration.getProperties(property.getNameAsSafeName(), LookupLocation.NO_LOCATION); return getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, property); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt index 00309714442..563b924262b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt @@ -29,7 +29,7 @@ import org.jetbrains.kotlin.resolve.QualifiedExpressionResolver import org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.LookupMode import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScope -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue import org.jetbrains.kotlin.storage.StorageManager import org.jetbrains.kotlin.types.JetType @@ -234,7 +234,7 @@ class LazyImportScope( return Visibilities.isVisible(ReceiverValue.IRRELEVANT_RECEIVER, descriptor, importResolver.moduleDescriptor) == includeVisible } - override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? { + override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? { return importResolver.selectSingleFromImports(name, LookupMode.ONLY_CLASSES_AND_PACKAGES) { scope, name -> val descriptor = scope.getClassifier(name, location) if (descriptor != null && isClassVisible(descriptor as ClassDescriptor/*no type parameter can be imported*/)) descriptor else null @@ -246,24 +246,24 @@ class LazyImportScope( return importResolver.selectSingleFromImports(name, LookupMode.ONLY_CLASSES_AND_PACKAGES) { scope, name -> scope.getPackage(name) } } - override fun getProperties(name: Name, location: UsageLocation): Collection { + override fun getProperties(name: Name, location: LookupLocation): Collection { if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf() return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getProperties(name, location) } } override fun getLocalVariable(name: Name) = null - override fun getFunctions(name: Name, location: UsageLocation): Collection { + override fun getFunctions(name: Name, location: LookupLocation): Collection { if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf() return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getFunctions(name, location) } } - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: LookupLocation): Collection { if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf() return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getSyntheticExtensionProperties(receiverTypes, name, location) } } - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection { if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf() return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getSyntheticExtensionFunctions(receiverTypes, name, location) } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSession.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSession.java index a491bd436f5..db7514f2b35 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSession.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSession.java @@ -41,7 +41,7 @@ import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationsContextImpl; import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyPackageDescriptor; import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyScriptDescriptor; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.storage.*; import javax.inject.Inject; @@ -289,7 +289,7 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext { public ClassDescriptor getClassDescriptorForScript(@NotNull JetScript script) { JetScope resolutionScope = lazyDeclarationResolver.resolutionScopeToResolveDeclaration(script); FqName fqName = ScriptNameUtil.classNameForScript(script); - ClassifierDescriptor classifier = resolutionScope.getClassifier(fqName.shortName(), UsageLocation.NO_LOCATION); + ClassifierDescriptor classifier = resolutionScope.getClassifier(fqName.shortName(), LookupLocation.NO_LOCATION); assert classifier != null : "No descriptor for " + fqName + " in file " + script.getContainingFile(); return (ClassDescriptor) classifier; } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSessionUtils.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSessionUtils.java index 3c9f2b8ba12..3eab523956a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSessionUtils.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/ResolveSessionUtils.java @@ -31,7 +31,7 @@ import org.jetbrains.kotlin.name.SpecialNames; import org.jetbrains.kotlin.psi.JetNamedDeclaration; import org.jetbrains.kotlin.psi.JetNamedDeclarationUtil; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import java.util.ArrayList; import java.util.Collection; @@ -84,7 +84,7 @@ public class ResolveSessionUtils { JetScope scope = outerScope; for (Name name : path.pathSegments()) { - ClassifierDescriptor classifier = scope.getClassifier(name, UsageLocation.NO_LOCATION); + ClassifierDescriptor classifier = scope.getClassifier(name, LookupLocation.NO_LOCATION); if (!(classifier instanceof ClassDescriptor)) return null; scope = ((ClassDescriptor) classifier).getUnsubstitutedInnerClassesScope(); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/AbstractLazyMemberScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/AbstractLazyMemberScope.kt index 0b37a8dfa48..28dbfdc8b1d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/AbstractLazyMemberScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/AbstractLazyMemberScope.kt @@ -17,7 +17,10 @@ package org.jetbrains.kotlin.resolve.lazy.descriptors import com.google.common.collect.Sets -import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.descriptors.VariableDescriptor import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingTrace @@ -29,10 +32,9 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProvider import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScope import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.storage.MemoizedFunctionToNotNull import org.jetbrains.kotlin.storage.StorageManager -import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.utils.Printer import org.jetbrains.kotlin.utils.toReadOnlyList import java.util.LinkedHashSet @@ -62,9 +64,9 @@ protected constructor( override fun getContainingDeclaration() = thisDescriptor - override fun getClassifier(name: Name, location: UsageLocation): ClassDescriptor? = classDescriptors(name).firstOrNull() + override fun getClassifier(name: Name, location: LookupLocation): ClassDescriptor? = classDescriptors(name).firstOrNull() - override fun getFunctions(name: Name, location: UsageLocation): Collection = functionDescriptors(name) + override fun getFunctions(name: Name, location: LookupLocation): Collection = functionDescriptors(name) private fun doGetFunctions(name: Name): Collection { val result = Sets.newLinkedHashSet() @@ -89,7 +91,7 @@ protected constructor( protected abstract fun getNonDeclaredFunctions(name: Name, result: MutableSet) - override fun getProperties(name: Name, location: UsageLocation): Collection = propertyDescriptors(name) + override fun getProperties(name: Name, location: LookupLocation): Collection = propertyDescriptors(name) public fun doGetProperties(name: Name): Collection { val result = LinkedHashSet() diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java index bcc6f068540..ff44afce491 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java @@ -369,7 +369,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes } Name name = ((JetClassOrObjectInfo) companionObjectInfo).getName(); assert name != null; - getUnsubstitutedMemberScope().getClassifier(name, UsageLocation.NO_LOCATION); + getUnsubstitutedMemberScope().getClassifier(name, LookupLocation.NO_LOCATION); ClassDescriptor companionObjectDescriptor = c.getTrace().get(BindingContext.CLASS, companionObject); if (companionObjectDescriptor instanceof LazyClassDescriptor) { assert DescriptorUtils.isCompanionObject(companionObjectDescriptor) : "Not a companion object: " + companionObjectDescriptor; 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 fb33e8582fc..04db94e37ec 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 @@ -34,7 +34,7 @@ import org.jetbrains.kotlin.resolve.lazy.LazyClassContext import org.jetbrains.kotlin.resolve.lazy.declarations.ClassMemberDeclarationProvider import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScope -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.resolve.varianceChecker.VarianceChecker import org.jetbrains.kotlin.storage.NotNullLazyValue import org.jetbrains.kotlin.storage.NullableLazyValue @@ -115,7 +115,7 @@ public open class LazyClassMemberScope( OverrideResolver.resolveUnknownVisibilities(result, trace) } - override fun getFunctions(name: Name, location: UsageLocation): Collection { + override fun getFunctions(name: Name, location: LookupLocation): Collection { // TODO: this should be handled by lazy function descriptors val functions = super.getFunctions(name, location) resolveUnknownVisibilitiesForMembers(functions) @@ -173,7 +173,7 @@ public open class LazyClassMemberScope( } } - override fun getProperties(name: Name, location: UsageLocation): Collection { + override fun getProperties(name: Name, location: LookupLocation): Collection { // TODO: this should be handled by lazy property descriptors val properties = super.getProperties(name, location) resolveUnknownVisibilitiesForMembers(properties as Collection) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/scopes/WritableScopeImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/scopes/WritableScopeImpl.kt index a7711611a16..118579c7c99 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/scopes/WritableScopeImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/scopes/WritableScopeImpl.kt @@ -16,15 +16,13 @@ package org.jetbrains.kotlin.resolve.scopes -import com.google.common.collect.* +import com.intellij.util.SmartList import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.types.checker.JetTypeChecker -import org.jetbrains.kotlin.utils.Printer - -import java.util.* -import com.intellij.util.SmartList import org.jetbrains.kotlin.util.collectionUtils.concatInOrder +import org.jetbrains.kotlin.utils.Printer +import java.util.ArrayList +import java.util.HashMap // Reads from: // 1. Maps @@ -156,7 +154,7 @@ public class WritableScopeImpl @jvmOverloads constructor( functionsByName!![name] = functionsByName!![name] + descriptorIndex } - override fun getFunctions(name: Name, location: UsageLocation): Collection { + override fun getFunctions(name: Name, location: LookupLocation): Collection { checkMayRead() return concatInOrder(functionsByName(name), workerScope.getFunctions(name, location)) @@ -166,7 +164,7 @@ public class WritableScopeImpl @jvmOverloads constructor( addVariableOrClassDescriptor(classifierDescriptor) } - override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? { + override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? { checkMayRead() return variableOrClassDescriptorByName(name) as? ClassifierDescriptor @@ -270,13 +268,13 @@ public class WritableScopeImpl @jvmOverloads constructor( return workerScope.getLocalVariable(name) } - override fun getFunctions(name: Name, location: UsageLocation): Collection { + override fun getFunctions(name: Name, location: LookupLocation): Collection { checkMayRead() return concatInOrder(functionsByName(name, descriptorLimit), workerScope.getFunctions(name, location)) } - override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? { + override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? { checkMayRead() return variableOrClassDescriptorByName(name, descriptorLimit) as? ClassifierDescriptor diff --git a/compiler/tests/org/jetbrains/kotlin/resolve/annotation/AbstractAnnotationDescriptorResolveTest.java b/compiler/tests/org/jetbrains/kotlin/resolve/annotation/AbstractAnnotationDescriptorResolveTest.java index 514fee12ea5..50c1fe45f75 100644 --- a/compiler/tests/org/jetbrains/kotlin/resolve/annotation/AbstractAnnotationDescriptorResolveTest.java +++ b/compiler/tests/org/jetbrains/kotlin/resolve/annotation/AbstractAnnotationDescriptorResolveTest.java @@ -38,7 +38,7 @@ import org.jetbrains.kotlin.renderer.DescriptorRendererOptions; import org.jetbrains.kotlin.renderer.NameShortness; import org.jetbrains.kotlin.resolve.BindingContext; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.test.JetLiteFixture; import org.jetbrains.kotlin.test.JetTestUtils; import org.jetbrains.kotlin.types.TypeProjection; @@ -155,7 +155,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends JetLiteFix protected static FunctionDescriptor getFunctionDescriptor(@NotNull PackageFragmentDescriptor packageView, @NotNull String name) { Name functionName = Name.identifier(name); JetScope memberScope = packageView.getMemberScope(); - Collection functions = memberScope.getFunctions(functionName, UsageLocation.NO_LOCATION); + Collection functions = memberScope.getFunctions(functionName, LookupLocation.NO_LOCATION); assert functions.size() == 1 : "Failed to find function " + functionName + " in class" + "." + packageView.getName(); return functions.iterator().next(); } @@ -164,7 +164,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends JetLiteFix private static FunctionDescriptor getFunctionDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) { Name functionName = Name.identifier(name); JetScope memberScope = classDescriptor.getMemberScope(Collections.emptyList()); - Collection functions = memberScope.getFunctions(functionName, UsageLocation.NO_LOCATION); + Collection functions = memberScope.getFunctions(functionName, LookupLocation.NO_LOCATION); assert functions.size() == 1 : "Failed to find function " + functionName + " in class" + "." + classDescriptor.getName(); return functions.iterator().next(); } @@ -173,13 +173,13 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends JetLiteFix protected static PropertyDescriptor getPropertyDescriptor(@NotNull PackageFragmentDescriptor packageView, @NotNull String name, boolean failOnMissing) { Name propertyName = Name.identifier(name); JetScope memberScope = packageView.getMemberScope(); - Collection properties = memberScope.getProperties(propertyName, UsageLocation.NO_LOCATION); + Collection properties = memberScope.getProperties(propertyName, LookupLocation.NO_LOCATION); if (properties.isEmpty()) { for (DeclarationDescriptor descriptor : memberScope.getAllDescriptors()) { if (descriptor instanceof ClassDescriptor) { Collection classProperties = ((ClassDescriptor) descriptor).getMemberScope(Collections.emptyList()) - .getProperties(propertyName, UsageLocation.NO_LOCATION); + .getProperties(propertyName, LookupLocation.NO_LOCATION); if (!classProperties.isEmpty()) { properties = classProperties; break; @@ -200,7 +200,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends JetLiteFix private static PropertyDescriptor getPropertyDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) { Name propertyName = Name.identifier(name); JetScope memberScope = classDescriptor.getMemberScope(Collections.emptyList()); - Collection properties = memberScope.getProperties(propertyName, UsageLocation.NO_LOCATION); + Collection properties = memberScope.getProperties(propertyName, LookupLocation.NO_LOCATION); assert properties.size() == 1 : "Failed to find property " + propertyName + " in class " + classDescriptor.getName(); return (PropertyDescriptor) properties.iterator().next(); } @@ -208,7 +208,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends JetLiteFix @NotNull protected static ClassDescriptor getClassDescriptor(@NotNull PackageFragmentDescriptor packageView, @NotNull String name) { Name className = Name.identifier(name); - ClassifierDescriptor aClass = packageView.getMemberScope().getClassifier(className, UsageLocation.NO_LOCATION); + ClassifierDescriptor aClass = packageView.getMemberScope().getClassifier(className, LookupLocation.NO_LOCATION); assertNotNull("Failed to find class: " + packageView.getName() + "." + className, aClass); assert aClass instanceof ClassDescriptor : "Not a class: " + aClass; return (ClassDescriptor) aClass; @@ -218,7 +218,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends JetLiteFix private static ClassDescriptor getInnerClassDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) { Name propertyName = Name.identifier(name); JetScope memberScope = classDescriptor.getMemberScope(Collections.emptyList()); - ClassifierDescriptor innerClass = memberScope.getClassifier(propertyName, UsageLocation.NO_LOCATION); + ClassifierDescriptor innerClass = memberScope.getClassifier(propertyName, LookupLocation.NO_LOCATION); assert innerClass instanceof ClassDescriptor : "Failed to find inner class " + propertyName + " in class " + diff --git a/compiler/tests/org/jetbrains/kotlin/test/util/DescriptorValidator.java b/compiler/tests/org/jetbrains/kotlin/test/util/DescriptorValidator.java index 6a4600a66dc..5de94c8e0fb 100644 --- a/compiler/tests/org/jetbrains/kotlin/test/util/DescriptorValidator.java +++ b/compiler/tests/org/jetbrains/kotlin/test/util/DescriptorValidator.java @@ -24,7 +24,7 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.builtins.KotlinBuiltIns; import org.jetbrains.kotlin.descriptors.*; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.types.JetType; import org.junit.Assert; @@ -411,7 +411,7 @@ public class DescriptorValidator { public Void visitVariableDescriptor( VariableDescriptor descriptor, JetScope scope ) { - assertFound(scope, descriptor, scope.getProperties(descriptor.getName(), UsageLocation.NO_LOCATION)); + assertFound(scope, descriptor, scope.getProperties(descriptor.getName(), LookupLocation.NO_LOCATION)); return null; } @@ -419,7 +419,7 @@ public class DescriptorValidator { public Void visitFunctionDescriptor( FunctionDescriptor descriptor, JetScope scope ) { - assertFound(scope, descriptor, scope.getFunctions(descriptor.getName(), UsageLocation.NO_LOCATION)); + assertFound(scope, descriptor, scope.getFunctions(descriptor.getName(), LookupLocation.NO_LOCATION)); return null; } @@ -427,7 +427,7 @@ public class DescriptorValidator { public Void visitTypeParameterDescriptor( TypeParameterDescriptor descriptor, JetScope scope ) { - assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), UsageLocation.NO_LOCATION), true); + assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), LookupLocation.NO_LOCATION), true); return null; } @@ -435,7 +435,7 @@ public class DescriptorValidator { public Void visitClassDescriptor( ClassDescriptor descriptor, JetScope scope ) { - assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), UsageLocation.NO_LOCATION), true); + assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), LookupLocation.NO_LOCATION), true); return null; } diff --git a/compiler/tests/org/jetbrains/kotlin/types/BoundsSubstitutorTest.java b/compiler/tests/org/jetbrains/kotlin/types/BoundsSubstitutorTest.java index 34be53481ca..2eb5bc760ac 100644 --- a/compiler/tests/org/jetbrains/kotlin/types/BoundsSubstitutorTest.java +++ b/compiler/tests/org/jetbrains/kotlin/types/BoundsSubstitutorTest.java @@ -26,7 +26,7 @@ import org.jetbrains.kotlin.psi.JetFile; import org.jetbrains.kotlin.renderer.DescriptorRenderer; import org.jetbrains.kotlin.resolve.lazy.KotlinTestWithEnvironment; import org.jetbrains.kotlin.resolve.lazy.LazyResolveTestUtil; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.test.ConfigurationKind; import java.util.Collection; @@ -74,7 +74,7 @@ public class BoundsSubstitutorTest extends KotlinTestWithEnvironment { JetFile jetFile = JetPsiFactory(getProject()).createFile("fun.kt", text); ModuleDescriptor module = LazyResolveTestUtil.resolveLazily(Collections.singletonList(jetFile), getEnvironment()); Collection functions = - module.getPackage(FqName.ROOT).getMemberScope().getFunctions(Name.identifier("f"), UsageLocation.NO_LOCATION); + module.getPackage(FqName.ROOT).getMemberScope().getFunctions(Name.identifier("f"), LookupLocation.NO_LOCATION); assert functions.size() == 1 : "Many functions defined"; FunctionDescriptor function = ContainerUtil.getFirstItem(functions); diff --git a/compiler/tests/org/jetbrains/kotlin/types/JetTypeCheckerTest.java b/compiler/tests/org/jetbrains/kotlin/types/JetTypeCheckerTest.java index 53a299d37cd..4049533d600 100644 --- a/compiler/tests/org/jetbrains/kotlin/types/JetTypeCheckerTest.java +++ b/compiler/tests/org/jetbrains/kotlin/types/JetTypeCheckerTest.java @@ -623,7 +623,7 @@ public class JetTypeCheckerTest extends JetLiteFixture { else { Name shortName = fqName.shortName(); assert shortName.equals(defaultImport.getImportedName()); - writableScope.addClassifierDescriptor(module.getPackage(fqName.parent()).getMemberScope().getClassifier(shortName, UsageLocation.NO_LOCATION)); + writableScope.addClassifierDescriptor(module.getPackage(fqName.parent()).getMemberScope().getClassifier(shortName, LookupLocation.NO_LOCATION)); } } scopeChain.add(module.getPackage(FqName.ROOT).getMemberScope()); diff --git a/compiler/tests/org/jetbrains/kotlin/types/TypeSubstitutorTest.java b/compiler/tests/org/jetbrains/kotlin/types/TypeSubstitutorTest.java index c17ddbab4a9..9cd51b287a8 100644 --- a/compiler/tests/org/jetbrains/kotlin/types/TypeSubstitutorTest.java +++ b/compiler/tests/org/jetbrains/kotlin/types/TypeSubstitutorTest.java @@ -85,7 +85,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment { JetFile jetFile = JetPsiFactory(getProject()).createFile(text); ModuleDescriptor module = LazyResolveTestUtil.resolveLazily(Collections.singletonList(jetFile), getEnvironment()); JetScope topLevelDeclarations = module.getPackage(FqName.ROOT).getMemberScope(); - ClassifierDescriptor contextClass = topLevelDeclarations.getClassifier(Name.identifier("___Context"), UsageLocation.NO_LOCATION); + ClassifierDescriptor contextClass = topLevelDeclarations.getClassifier(Name.identifier("___Context"), LookupLocation.NO_LOCATION); assert contextClass instanceof ClassDescriptor; WritableScopeImpl typeParameters = new WritableScopeImpl(JetScope.Empty.INSTANCE$, module, RedeclarationHandler.THROW_EXCEPTION, "Type parameter scope"); @@ -124,7 +124,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment { String typeParameterName = pair.first; String replacementProjectionString = pair.second; - ClassifierDescriptor classifier = scope.getClassifier(Name.identifier(typeParameterName), UsageLocation.NO_LOCATION); + ClassifierDescriptor classifier = scope.getClassifier(Name.identifier(typeParameterName), LookupLocation.NO_LOCATION); assertNotNull("No type parameter named " + typeParameterName, classifier); assertTrue(typeParameterName + " is not a type parameter: " + classifier, classifier instanceof TypeParameterDescriptor); 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 0d2d2cb522c..37657e1d03d 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 @@ -40,7 +40,7 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.DescriptorFactory import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.utils.* @@ -285,7 +285,7 @@ public class LazyJavaClassMemberScope( override fun getDispatchReceiverParameter(): ReceiverParameterDescriptor? = DescriptorUtils.getDispatchReceiverParameterIfNeeded(getContainingDeclaration()) - override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? = nestedClasses(name) + override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? = nestedClasses(name) override fun getClassNames(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection = nestedClassIndex().keySet() + enumEntryIndex().keySet() diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaPackageScope.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaPackageScope.kt index dd8687f779d..ec735ad1c56 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaPackageScope.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaPackageScope.kt @@ -33,7 +33,7 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.SpecialNames import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScope -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.utils.addIfNotNull public class LazyJavaPackageScope( @@ -76,11 +76,11 @@ public class LazyJavaPackageScope( } } - override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? = + override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? = if (SpecialNames.isSafeIdentifier(name)) classes(name) else null - override fun getProperties(name: Name, location: UsageLocation) = deserializedPackageScope().getProperties(name, location) - override fun getFunctions(name: Name, location: UsageLocation) = deserializedPackageScope().getFunctions(name, location) + super.getFunctions(name, location) + override fun getProperties(name: Name, location: LookupLocation) = deserializedPackageScope().getProperties(name, location) + override fun getFunctions(name: Name, location: LookupLocation) = deserializedPackageScope().getFunctions(name, location) + super.getFunctions(name, location) override fun addExtraDescriptors(result: MutableSet, kindFilter: DescriptorKindFilter, diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt index 9e9cadc6c6d..6f1978df2f7 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt @@ -40,7 +40,7 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindExclude.NonExtensions import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScope import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.storage.NotNullLazyValue import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.types.TypeUtils @@ -210,7 +210,7 @@ public abstract class LazyJavaScope( return ResolvedValueParameters(descriptors, synthesizedNames) } - override fun getFunctions(name: Name, location: UsageLocation) = functions(name) + override fun getFunctions(name: Name, location: LookupLocation) = functions(name) protected open fun getFunctionNames(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection = memberIndex().getMethodNames(nameFilter) @@ -289,7 +289,7 @@ public abstract class LazyJavaScope( return propertyType } - override fun getProperties(name: Name, location: UsageLocation): Collection = properties(name) + override fun getProperties(name: Name, location: LookupLocation): Collection = properties(name) override fun getOwnDeclaredDescriptors() = getDescriptors() diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaStaticClassScope.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaStaticClassScope.kt index e2fb400041f..e72cf29d697 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaStaticClassScope.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaStaticClassScope.kt @@ -26,7 +26,7 @@ import org.jetbrains.kotlin.resolve.DescriptorFactory.createEnumValueOfMethod import org.jetbrains.kotlin.resolve.DescriptorFactory.createEnumValuesMethod import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.utils.addIfNotNull public class LazyJavaStaticClassScope( @@ -58,7 +58,7 @@ public class LazyJavaStaticClassScope( memberIndex().getAllFieldNames() override fun getClassNames(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection = listOf() - override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? = null + override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? = null override fun getSubPackages(): Collection = listOf() diff --git a/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java b/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java index 17645855ad0..566bda9e19e 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java +++ b/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java @@ -31,7 +31,7 @@ import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.resolve.DescriptorUtils; import org.jetbrains.kotlin.resolve.constants.ConstantValue; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.storage.LockBasedStorageManager; import org.jetbrains.kotlin.types.*; import org.jetbrains.kotlin.types.checker.JetTypeChecker; @@ -239,7 +239,7 @@ public class KotlinBuiltIns { @NotNull private ClassDescriptor getAnnotationClassByName(@NotNull Name simpleName) { - ClassifierDescriptor classifier = annotationPackageFragment.getMemberScope().getClassifier(simpleName, UsageLocation.NO_LOCATION); + ClassifierDescriptor classifier = annotationPackageFragment.getMemberScope().getClassifier(simpleName, LookupLocation.NO_LOCATION); assert classifier instanceof ClassDescriptor : "Must be a class descriptor " + simpleName + ", but was " + (classifier == null ? "null" : classifier.toString()); return (ClassDescriptor) classifier; @@ -254,7 +254,7 @@ public class KotlinBuiltIns { @Nullable public ClassDescriptor getBuiltInClassByNameNullable(@NotNull Name simpleName) { - ClassifierDescriptor classifier = getBuiltInsPackageFragment().getMemberScope().getClassifier(simpleName, UsageLocation.NO_LOCATION); + ClassifierDescriptor classifier = getBuiltInsPackageFragment().getMemberScope().getClassifier(simpleName, LookupLocation.NO_LOCATION); assert classifier == null || classifier instanceof ClassDescriptor : "Must be a class descriptor " + simpleName + ", but was " + classifier; return (ClassDescriptor) classifier; @@ -399,7 +399,7 @@ public class KotlinBuiltIns { @Nullable public ClassDescriptor getAnnotationTargetEnumEntry(@NotNull KotlinTarget target) { ClassifierDescriptor result = getAnnotationTargetEnum().getUnsubstitutedInnerClassesScope().getClassifier( - Name.identifier(target.name()), UsageLocation.NO_LOCATION + Name.identifier(target.name()), LookupLocation.NO_LOCATION ); return result instanceof ClassDescriptor ? (ClassDescriptor) result : null; } @@ -412,7 +412,7 @@ public class KotlinBuiltIns { @Nullable public ClassDescriptor getAnnotationRetentionEnumEntry(@NotNull KotlinRetention retention) { ClassifierDescriptor result = getAnnotationRetentionEnum().getUnsubstitutedInnerClassesScope().getClassifier( - Name.identifier(retention.name()), UsageLocation.NO_LOCATION + Name.identifier(retention.name()), LookupLocation.NO_LOCATION ); return result instanceof ClassDescriptor ? (ClassDescriptor) result : null; } @@ -1038,6 +1038,6 @@ public class KotlinBuiltIns { @NotNull public FunctionDescriptor getIdentityEquals() { - return KotlinPackage.first(getBuiltInsPackageFragment().getMemberScope().getFunctions(Name.identifier("identityEquals"), UsageLocation.NO_LOCATION)); + return KotlinPackage.first(getBuiltInsPackageFragment().getMemberScope().getFunctions(Name.identifier("identityEquals"), LookupLocation.NO_LOCATION)); } } diff --git a/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/FunctionClassScope.kt b/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/FunctionClassScope.kt index f0162d11eca..2f6f60eeccc 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/FunctionClassScope.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/FunctionClassScope.kt @@ -21,7 +21,7 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.OverridingUtil import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.storage.StorageManager import org.jetbrains.kotlin.utils.Printer import org.jetbrains.kotlin.utils.toReadOnlyList @@ -48,11 +48,11 @@ class FunctionClassScope( return allDescriptors() } - override fun getFunctions(name: Name, location: UsageLocation): Collection { + override fun getFunctions(name: Name, location: LookupLocation): Collection { return allDescriptors().filterIsInstance().filter { it.getName() == name } } - override fun getProperties(name: Name, location: UsageLocation): Collection { + override fun getProperties(name: Name, location: LookupLocation): Collection { return allDescriptors().filterIsInstance().filter { it.getName() == name } } diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/EnumEntrySyntheticClassDescriptor.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/EnumEntrySyntheticClassDescriptor.java index afaa27cd8d1..070b55c743b 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/EnumEntrySyntheticClassDescriptor.java +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/EnumEntrySyntheticClassDescriptor.java @@ -192,25 +192,25 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase { @NotNull @Override @SuppressWarnings("unchecked") - public Collection getProperties(@NotNull Name name, @NotNull UsageLocation location) { + public Collection getProperties(@NotNull Name name, @NotNull LookupLocation location) { return (Collection) properties.invoke(name); } @NotNull @SuppressWarnings("unchecked") private Collection computeProperties(@NotNull Name name) { - return resolveFakeOverrides(name, (Collection) getSupertypeScope().getProperties(name, UsageLocation.NO_LOCATION)); + return resolveFakeOverrides(name, (Collection) getSupertypeScope().getProperties(name, LookupLocation.NO_LOCATION)); } @NotNull @Override - public Collection getFunctions(@NotNull Name name, @NotNull UsageLocation location) { + public Collection getFunctions(@NotNull Name name, @NotNull LookupLocation location) { return functions.invoke(name); } @NotNull private Collection computeFunctions(@NotNull Name name) { - return resolveFakeOverrides(name, getSupertypeScope().getFunctions(name, UsageLocation.NO_LOCATION)); + return resolveFakeOverrides(name, getSupertypeScope().getFunctions(name, LookupLocation.NO_LOCATION)); } @NotNull @@ -266,8 +266,8 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase { private Collection computeAllDeclarations() { Collection result = new HashSet(); for (Name name : enumMemberNames.invoke()) { - result.addAll(getFunctions(name, UsageLocation.NO_LOCATION)); - result.addAll(getProperties(name, UsageLocation.NO_LOCATION)); + result.addAll(getFunctions(name, LookupLocation.NO_LOCATION)); + result.addAll(getProperties(name, LookupLocation.NO_LOCATION)); } return result; } diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java index 1c207b82059..ad2a0836b75 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java @@ -35,7 +35,7 @@ import org.jetbrains.kotlin.resolve.constants.StringValue; import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter; import org.jetbrains.kotlin.resolve.scopes.FilteringScope; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.types.ErrorUtils; import org.jetbrains.kotlin.types.JetType; import org.jetbrains.kotlin.types.LazyType; @@ -393,7 +393,7 @@ public class DescriptorUtils { @Nullable public static ClassDescriptor getInnerClassByName(@NotNull ClassDescriptor classDescriptor, @NotNull String innerClassName) { ClassifierDescriptor classifier = - classDescriptor.getDefaultType().getMemberScope().getClassifier(Name.identifier(innerClassName), UsageLocation.NO_LOCATION); + classDescriptor.getDefaultType().getMemberScope().getClassifier(Name.identifier(innerClassName), LookupLocation.NO_LOCATION); assert classifier instanceof ClassDescriptor : "Inner class " + innerClassName + " in " + classDescriptor + " should be instance of ClassDescriptor, but was: " + (classifier == null ? "null" : classifier.getClass()); diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/AbstractScopeAdapter.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/AbstractScopeAdapter.kt index fbf6dc7bf78..b295bbb2a92 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/AbstractScopeAdapter.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/AbstractScopeAdapter.kt @@ -31,7 +31,7 @@ public abstract class AbstractScopeAdapter : JetScope { return workerScope.getImplicitReceiversHierarchy() } - override fun getFunctions(name: Name, location: UsageLocation): Collection { + override fun getFunctions(name: Name, location: LookupLocation): Collection { return workerScope.getFunctions(name, location) } @@ -39,19 +39,19 @@ public abstract class AbstractScopeAdapter : JetScope { return workerScope.getPackage(name) } - override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? { + override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? { return workerScope.getClassifier(name, location) } - override fun getProperties(name: Name, location: UsageLocation): Collection { + override fun getProperties(name: Name, location: LookupLocation): Collection { return workerScope.getProperties(name, location) } - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: LookupLocation): Collection { return workerScope.getSyntheticExtensionProperties(receiverTypes, name, location) } - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection { + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection { return workerScope.getSyntheticExtensionFunctions(receiverTypes, name, location) } diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/ChainedScope.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/ChainedScope.kt index 279ddd4b858..68e705ac99b 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/ChainedScope.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/ChainedScope.kt @@ -49,25 +49,25 @@ public open class ChainedScope( return result ?: emptySet() } - override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? + override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? = getFirstMatch { it.getClassifier(name, location) } override fun getPackage(name: Name): PackageViewDescriptor? = getFirstMatch { it.getPackage(name) } - override fun getProperties(name: Name, location: UsageLocation): Collection + override fun getProperties(name: Name, location: LookupLocation): Collection = getFromAllScopes { it.getProperties(name, location) } override fun getLocalVariable(name: Name): VariableDescriptor? = getFirstMatch { it.getLocalVariable(name) } - override fun getFunctions(name: Name, location: UsageLocation): Collection + override fun getFunctions(name: Name, location: LookupLocation): Collection = getFromAllScopes { it.getFunctions(name, location) } - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: LookupLocation): Collection = getFromAllScopes { it.getSyntheticExtensionProperties(receiverTypes, name, location) } - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection = getFromAllScopes { it.getSyntheticExtensionFunctions(receiverTypes, name, location) } override fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/ExplicitImportsScope.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/ExplicitImportsScope.kt index 2bb663ec79b..672a9a6410f 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/ExplicitImportsScope.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/ExplicitImportsScope.kt @@ -18,18 +18,17 @@ package org.jetbrains.kotlin.resolve.scopes import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.utils.Printer import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull public class ExplicitImportsScope(private val descriptors: Collection) : JetScopeImpl() { - override fun getClassifier(name: Name, location: UsageLocation) = descriptors.filter { it.getName() == name }.firstIsInstanceOrNull() + override fun getClassifier(name: Name, location: LookupLocation) = descriptors.filter { it.getName() == name }.firstIsInstanceOrNull() override fun getPackage(name: Name)= descriptors.filter { it.getName() == name }.firstIsInstanceOrNull() - override fun getProperties(name: Name, location: UsageLocation) = descriptors.filter { it.getName() == name }.filterIsInstance() + override fun getProperties(name: Name, location: LookupLocation) = descriptors.filter { it.getName() == name }.filterIsInstance() - override fun getFunctions(name: Name, location: UsageLocation) = descriptors.filter { it.getName() == name }.filterIsInstance() + override fun getFunctions(name: Name, location: LookupLocation) = descriptors.filter { it.getName() == name }.filterIsInstance() override fun getContainingDeclaration() = throw UnsupportedOperationException() diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/FilteringScope.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/FilteringScope.kt index 57c14b0954b..e739e6901b1 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/FilteringScope.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/FilteringScope.kt @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.utils.Printer public class FilteringScope(private val workerScope: JetScope, private val predicate: (DeclarationDescriptor) -> Boolean) : JetScope { - override fun getFunctions(name: Name, location: UsageLocation) = workerScope.getFunctions(name, location).filter(predicate) + override fun getFunctions(name: Name, location: LookupLocation) = workerScope.getFunctions(name, location).filter(predicate) override fun getContainingDeclaration() = workerScope.getContainingDeclaration() @@ -34,14 +34,14 @@ public class FilteringScope(private val workerScope: JetScope, private val predi override fun getPackage(name: Name) = filterDescriptor(workerScope.getPackage(name)) - override fun getClassifier(name: Name, location: UsageLocation) = filterDescriptor(workerScope.getClassifier(name, location)) + override fun getClassifier(name: Name, location: LookupLocation) = filterDescriptor(workerScope.getClassifier(name, location)) - override fun getProperties(name: Name, location: UsageLocation) = workerScope.getProperties(name, location).filter(predicate) + override fun getProperties(name: Name, location: LookupLocation) = workerScope.getProperties(name, location).filter(predicate) - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: LookupLocation): Collection = workerScope.getSyntheticExtensionProperties(receiverTypes, name, location).filter(predicate) - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection = workerScope.getSyntheticExtensionFunctions(receiverTypes, name, location).filter(predicate) override fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/InnerClassesScopeWrapper.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/InnerClassesScopeWrapper.kt index 0c62c2c56b1..20c1482136f 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/InnerClassesScopeWrapper.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/InnerClassesScopeWrapper.kt @@ -21,7 +21,7 @@ import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor import org.jetbrains.kotlin.name.Name public class InnerClassesScopeWrapper(override val workerScope: JetScope) : AbstractScopeAdapter() { - override fun getClassifier(name: Name, location: UsageLocation) = workerScope.getClassifier(name, location) as? ClassDescriptor + override fun getClassifier(name: Name, location: LookupLocation) = workerScope.getClassifier(name, location) as? ClassDescriptor override fun getDeclarationsByLabel(labelName: Name) = workerScope.getDeclarationsByLabel(labelName).filterIsInstance() diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScope.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScope.kt index 49f1270b26b..3a23fe4c407 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScope.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScope.kt @@ -25,18 +25,18 @@ import java.lang.reflect.Modifier public interface JetScope { - public fun getClassifier(name: Name, location: UsageLocation = UsageLocation.NO_LOCATION): ClassifierDescriptor? + public fun getClassifier(name: Name, location: LookupLocation = LookupLocation.NO_LOCATION): ClassifierDescriptor? public fun getPackage(name: Name): PackageViewDescriptor? - public fun getProperties(name: Name, location: UsageLocation = UsageLocation.NO_LOCATION): Collection + public fun getProperties(name: Name, location: LookupLocation = LookupLocation.NO_LOCATION): Collection public fun getLocalVariable(name: Name): VariableDescriptor? - public fun getFunctions(name: Name, location: UsageLocation = UsageLocation.NO_LOCATION): Collection + public fun getFunctions(name: Name, location: LookupLocation = LookupLocation.NO_LOCATION): Collection - public fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation = UsageLocation.NO_LOCATION): Collection - public fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation = UsageLocation.NO_LOCATION): Collection + public fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: LookupLocation = LookupLocation.NO_LOCATION): Collection + public fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation = LookupLocation.NO_LOCATION): Collection public fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection public fun getSyntheticExtensionFunctions(receiverTypes: Collection): Collection @@ -246,8 +246,8 @@ public interface DescriptorKindExclude { } } -public interface UsageLocation { +public interface LookupLocation { companion object { - val NO_LOCATION = object : UsageLocation {} + val NO_LOCATION = object : LookupLocation {} } } diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScopeImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScopeImpl.kt index bf9d5ea7430..44a53b30620 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScopeImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScopeImpl.kt @@ -22,18 +22,18 @@ import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.utils.Printer public abstract class JetScopeImpl : JetScope { - override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? = null + override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? = null - override fun getProperties(name: Name, location: UsageLocation): Collection = emptyList() + override fun getProperties(name: Name, location: LookupLocation): Collection = emptyList() override fun getLocalVariable(name: Name): VariableDescriptor? = null override fun getPackage(name: Name): PackageViewDescriptor? = null - override fun getFunctions(name: Name, location: UsageLocation): Collection = emptyList() + override fun getFunctions(name: Name, location: LookupLocation): Collection = emptyList() - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection = emptyList() - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection = emptyList() + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: LookupLocation): Collection = emptyList() + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection = emptyList() override fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection = emptyList() override fun getSyntheticExtensionFunctions(receiverTypes: Collection): Collection = emptyList() diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/StaticScopeForKotlinClass.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/StaticScopeForKotlinClass.kt index 9392130e446..edb449c5af6 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/StaticScopeForKotlinClass.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/StaticScopeForKotlinClass.kt @@ -28,7 +28,7 @@ import java.util.ArrayList public class StaticScopeForKotlinClass( private val containingClass: ClassDescriptor ) : JetScopeImpl() { - override fun getClassifier(name: Name, location: UsageLocation) = null // TODO + override fun getClassifier(name: Name, location: LookupLocation) = null // TODO private val functions: List by lazy { if (containingClass.getKind() != ClassKind.ENUM_CLASS) { @@ -44,7 +44,7 @@ public class StaticScopeForKotlinClass( override fun getOwnDeclaredDescriptors() = functions - override fun getFunctions(name: Name, location: UsageLocation) = functions.filterTo(ArrayList(2)) { it.getName() == name } + override fun getFunctions(name: Name, location: LookupLocation) = functions.filterTo(ArrayList(2)) { it.getName() == name } override fun getContainingDeclaration() = containingClass diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt index 5f9945e993f..5ebd60a504b 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt @@ -62,18 +62,18 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su return result } - override fun getProperties(name: Name, location: UsageLocation) = substitute(workerScope.getProperties(name, location)) + override fun getProperties(name: Name, location: LookupLocation) = substitute(workerScope.getProperties(name, location)) override fun getLocalVariable(name: Name) = substitute(workerScope.getLocalVariable(name)) - override fun getClassifier(name: Name, location: UsageLocation) = substitute(workerScope.getClassifier(name, location)) + override fun getClassifier(name: Name, location: LookupLocation) = substitute(workerScope.getClassifier(name, location)) - override fun getFunctions(name: Name, location: UsageLocation) = substitute(workerScope.getFunctions(name, location)) + override fun getFunctions(name: Name, location: LookupLocation) = substitute(workerScope.getFunctions(name, location)) - override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: UsageLocation): Collection + override fun getSyntheticExtensionProperties(receiverTypes: Collection, name: Name, location: LookupLocation): Collection = substitute(workerScope.getSyntheticExtensionProperties(receiverTypes, name, location)) - override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: UsageLocation): Collection + override fun getSyntheticExtensionFunctions(receiverTypes: Collection, name: Name, location: LookupLocation): Collection = substitute(workerScope.getSyntheticExtensionFunctions(receiverTypes, name, location)) override fun getSyntheticExtensionProperties(receiverTypes: Collection): Collection diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.java b/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.java index 8e7ec802934..f6987bb2101 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.java +++ b/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.java @@ -26,7 +26,7 @@ import org.jetbrains.kotlin.descriptors.impl.*; import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.storage.LockBasedStorageManager; import org.jetbrains.kotlin.types.error.ErrorSimpleFunctionDescriptorImpl; import org.jetbrains.kotlin.utils.Printer; @@ -83,13 +83,13 @@ public class ErrorUtils { @Nullable @Override - public ClassifierDescriptor getClassifier(@NotNull Name name, @NotNull UsageLocation location) { + public ClassifierDescriptor getClassifier(@NotNull Name name, @NotNull LookupLocation location) { return createErrorClass(name.asString()); } @NotNull @Override - public Set getProperties(@NotNull Name name, @NotNull UsageLocation location) { + public Set getProperties(@NotNull Name name, @NotNull LookupLocation location) { return ERROR_VARIABLE_GROUP; } @@ -97,7 +97,7 @@ public class ErrorUtils { @Override public Collection getSyntheticExtensionProperties( @NotNull Collection receiverTypes, @NotNull Name name, - @NotNull UsageLocation location + @NotNull LookupLocation location ) { return ERROR_PROPERTY_GROUP; } @@ -106,7 +106,7 @@ public class ErrorUtils { @Override public Collection getSyntheticExtensionFunctions( @NotNull Collection receiverTypes, @NotNull Name name, - @NotNull UsageLocation location + @NotNull LookupLocation location ) { return Collections.singleton(createErrorFunction(this)); } @@ -143,7 +143,7 @@ public class ErrorUtils { @NotNull @Override - public Set getFunctions(@NotNull Name name, @NotNull UsageLocation location) { + public Set getFunctions(@NotNull Name name, @NotNull LookupLocation location) { return Collections.singleton(createErrorFunction(this)); } @@ -199,7 +199,7 @@ public class ErrorUtils { @Nullable @Override - public ClassifierDescriptor getClassifier(@NotNull Name name, @NotNull UsageLocation location) { + public ClassifierDescriptor getClassifier(@NotNull Name name, @NotNull LookupLocation location) { throw new IllegalStateException(); } @@ -211,7 +211,7 @@ public class ErrorUtils { @NotNull @Override - public Collection getProperties(@NotNull Name name, @NotNull UsageLocation location) { + public Collection getProperties(@NotNull Name name, @NotNull LookupLocation location) { throw new IllegalStateException(); } @@ -223,7 +223,7 @@ public class ErrorUtils { @NotNull @Override - public Collection getFunctions(@NotNull Name name, @NotNull UsageLocation location) { + public Collection getFunctions(@NotNull Name name, @NotNull LookupLocation location) { throw new IllegalStateException(); } @@ -231,7 +231,7 @@ public class ErrorUtils { @Override public Collection getSyntheticExtensionProperties( @NotNull Collection receiverTypes, @NotNull Name name, - @NotNull UsageLocation location + @NotNull LookupLocation location ) { throw new IllegalStateException(); } @@ -240,7 +240,7 @@ public class ErrorUtils { @Override public Collection getSyntheticExtensionFunctions( @NotNull Collection receiverTypes, @NotNull Name name, - @NotNull UsageLocation location + @NotNull LookupLocation location ) { throw new IllegalStateException(); } diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedMemberScope.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedMemberScope.kt index ede3d8eef7c..6b3fbec9f09 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedMemberScope.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedMemberScope.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.serialization.Flags import org.jetbrains.kotlin.serialization.ProtoBuf import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind @@ -93,7 +93,7 @@ public abstract class DeserializedMemberScope protected constructor( protected open fun computeNonDeclaredFunctions(name: Name, functions: MutableCollection) { } - override fun getFunctions(name: Name, location: UsageLocation): Collection = functions(name) + override fun getFunctions(name: Name, location: LookupLocation): Collection = functions(name) private fun computeProperties(name: Name): Collection { val descriptors = computeMembers(name, Kind.PROPERTY) @@ -104,9 +104,9 @@ public abstract class DeserializedMemberScope protected constructor( protected open fun computeNonDeclaredProperties(name: Name, descriptors: MutableCollection) { } - override fun getProperties(name: Name, location: UsageLocation): Collection = properties.invoke(name) + override fun getProperties(name: Name, location: LookupLocation): Collection = properties.invoke(name) - override fun getClassifier(name: Name, location: UsageLocation) = getClassDescriptor(name) + override fun getClassifier(name: Name, location: LookupLocation) = getClassDescriptor(name) protected abstract fun getClassDescriptor(name: Name): ClassifierDescriptor? diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IDELightClassGenerationSupport.java b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IDELightClassGenerationSupport.java index 025da1b6156..97d687d6c2f 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IDELightClassGenerationSupport.java +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IDELightClassGenerationSupport.java @@ -60,7 +60,7 @@ import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode; import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil; import org.jetbrains.kotlin.resolve.lazy.KotlinCodeAnalyzer; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import java.io.IOException; import java.util.*; @@ -140,7 +140,7 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport if (declaration instanceof JetFunction) { JetFunction jetFunction = (JetFunction) declaration; Name name = jetFunction.getNameAsSafeName(); - Collection functions = packageDescriptor.getMemberScope().getFunctions(name, UsageLocation.NO_LOCATION); + Collection functions = packageDescriptor.getMemberScope().getFunctions(name, LookupLocation.NO_LOCATION); for (FunctionDescriptor descriptor : functions) { ForceResolveUtil.forceResolveAllContents(descriptor); } @@ -148,7 +148,7 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport else if (declaration instanceof JetProperty) { JetProperty jetProperty = (JetProperty) declaration; Name name = jetProperty.getNameAsSafeName(); - Collection properties = packageDescriptor.getMemberScope().getProperties(name, UsageLocation.NO_LOCATION); + Collection properties = packageDescriptor.getMemberScope().getProperties(name, LookupLocation.NO_LOCATION); for (VariableDescriptor descriptor : properties) { ForceResolveUtil.forceResolveAllContents(descriptor); } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/textBuilder/missingDependencies.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/textBuilder/missingDependencies.kt index ab01ea50a11..d299cef4984 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/textBuilder/missingDependencies.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/textBuilder/missingDependencies.kt @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.scopes.JetScope import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.types.ErrorUtils.createErrorType import org.jetbrains.kotlin.types.TypeProjection import org.jetbrains.kotlin.types.TypeSubstitution @@ -49,7 +49,7 @@ private class ScopeWithMissingDependencies(val fqName: FqName, val containing: D p.println("Special scope for decompiler, containing class with any name") } - override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? { + override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? { return MissingDependencyErrorClassDescriptor(getContainingDeclaration(), fqName.child(name)) } } diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/HeuristicSignatures.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/HeuristicSignatures.kt index 8531de163b3..7ec7c9f2138 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/HeuristicSignatures.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/HeuristicSignatures.kt @@ -30,7 +30,7 @@ import org.jetbrains.kotlin.resolve.BindingTraceContext import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.scopes.ChainedScope import org.jetbrains.kotlin.resolve.scopes.JetScope -import org.jetbrains.kotlin.resolve.scopes.UsageLocation +import org.jetbrains.kotlin.resolve.scopes.LookupLocation import org.jetbrains.kotlin.types.* import java.util.HashMap @@ -105,6 +105,6 @@ public object HeuristicSignatures { private class TypeParametersScope(params: Collection) : JetScope by JetScope.Empty { private val paramsByName = params.map { it.getName() to it }.toMap() - override fun getClassifier(name: Name, location: UsageLocation) = paramsByName[name] + override fun getClassifier(name: Name, location: LookupLocation) = paramsByName[name] } } diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeMemberFunctionSignatureFix.java b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeMemberFunctionSignatureFix.java index d0e2eda2224..fd07f01a97e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeMemberFunctionSignatureFix.java +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeMemberFunctionSignatureFix.java @@ -54,7 +54,7 @@ import org.jetbrains.kotlin.renderer.NameShortness; import org.jetbrains.kotlin.resolve.FunctionDescriptorUtil; import org.jetbrains.kotlin.resolve.VisibilityUtil; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import org.jetbrains.kotlin.types.JetType; import org.jetbrains.kotlin.types.TypeUtils; import org.jetbrains.kotlin.types.checker.JetTypeChecker; @@ -268,7 +268,7 @@ public class ChangeMemberFunctionSignatureFix extends JetHintAction conflicts = oldDescriptor instanceof FunctionDescriptor - ? callableScope.getFunctions(newName, UsageLocation.NO_LOCATION) - : callableScope.getProperties(newName, UsageLocation.NO_LOCATION); + ? callableScope.getFunctions(newName, LookupLocation.NO_LOCATION) + : callableScope.getProperties(newName, LookupLocation.NO_LOCATION); for (CallableDescriptor conflict : conflicts) { if (conflict == oldDescriptor) continue; @@ -639,7 +639,7 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro } if (parametersScope != null) { if (kind == JetMethodDescriptor.Kind.PRIMARY_CONSTRUCTOR && valOrVar != JetValVar.None) { - for (VariableDescriptor property : parametersScope.getProperties(Name.identifier(parameterName), UsageLocation.NO_LOCATION)) { + for (VariableDescriptor property : parametersScope.getProperties(Name.identifier(parameterName), LookupLocation.NO_LOCATION)) { PsiElement propertyDeclaration = DescriptorToSourceUtils.descriptorToDeclaration(property); if (propertyDeclaration != null && !(propertyDeclaration.getParent() instanceof JetParameterList)) { diff --git a/js/js.translator/src/org/jetbrains/kotlin/js/translate/utils/ManglingUtils.java b/js/js.translator/src/org/jetbrains/kotlin/js/translate/utils/ManglingUtils.java index b4a1469861f..250a093cfe2 100644 --- a/js/js.translator/src/org/jetbrains/kotlin/js/translate/utils/ManglingUtils.java +++ b/js/js.translator/src/org/jetbrains/kotlin/js/translate/utils/ManglingUtils.java @@ -31,7 +31,7 @@ import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.resolve.DescriptorUtils; import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter; import org.jetbrains.kotlin.resolve.scopes.JetScope; -import org.jetbrains.kotlin.resolve.scopes.UsageLocation; +import org.jetbrains.kotlin.resolve.scopes.LookupLocation; import java.util.*; @@ -249,7 +249,7 @@ public class ManglingUtils { @NotNull public static String getStableMangledNameForDescriptor(@NotNull ClassDescriptor descriptor, @NotNull String functionName) { Collection functions = - descriptor.getDefaultType().getMemberScope().getFunctions(Name.identifier(functionName), UsageLocation.NO_LOCATION); + descriptor.getDefaultType().getMemberScope().getFunctions(Name.identifier(functionName), LookupLocation.NO_LOCATION); assert functions.size() == 1 : "Can't select a single function: " + functionName + " in " + descriptor; return getSuggestedName((DeclarationDescriptor) functions.iterator().next()); }