Location.NOWHERE -> UsageLocation.NO_LOCATION

This commit is contained in:
Zalim Bashorov
2015-07-15 14:29:56 +03:00
parent e2e3520c3d
commit 41449c107e
50 changed files with 153 additions and 151 deletions
@@ -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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
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<FunctionDescriptor> functions = owner.getDefaultType().getMemberScope().getFunctions(name, Location.NOWHERE);
Collection<FunctionDescriptor> functions = owner.getDefaultType().getMemberScope().getFunctions(name, UsageLocation.NO_LOCATION);
for (FunctionDescriptor function : functions) {
if (!CallResolverUtilPackage.isOrOverridesSynthesized(function)
&& function.getTypeParameters().isEmpty()
@@ -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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
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<JetElement> {
ClassDescriptor elementClass = elementDescriptor.getExtensionReceiverParameter() == null
? getBuiltIns(elementDescriptor).getFunction(arity)
: getBuiltIns(elementDescriptor).getExtensionFunction(arity);
return elementClass.getDefaultType().getMemberScope().getFunctions(OperatorConventions.INVOKE, Location.NOWHERE).iterator().next();
return elementClass.getDefaultType().getMemberScope().getFunctions(OperatorConventions.INVOKE, UsageLocation.NO_LOCATION).iterator().next();
}
}
@@ -75,7 +75,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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
import org.jetbrains.kotlin.resolve.scopes.receivers.*;
import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor;
import org.jetbrains.kotlin.types.JetType;
@@ -1076,7 +1076,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
Type asmLoopRangeType = asmType(loopRangeType);
Collection<VariableDescriptor> incrementProp =
loopRangeType.getMemberScope().getProperties(Name.identifier("increment"), Location.NOWHERE);
loopRangeType.getMemberScope().getProperties(Name.identifier("increment"), UsageLocation.NO_LOCATION);
assert incrementProp.size() == 1 : loopRangeType + " " + incrementProp.size();
incrementType = asmType(incrementProp.iterator().next().getType());
@@ -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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
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<FunctionDescriptor> functions =
descriptor.getDefaultType().getMemberScope().getFunctions(Name.identifier("toArray"), Location.NOWHERE);
descriptor.getDefaultType().getMemberScope().getFunctions(Name.identifier("toArray"), UsageLocation.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, Location.NOWHERE), new Function1<FunctionDescriptor, Boolean>() {
KotlinPackage.single(descriptor.getStaticScope().getFunctions(ENUM_VALUES, UsageLocation.NO_LOCATION), new Function1<FunctionDescriptor, Boolean>() {
@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, Location.NOWHERE), new Function1<FunctionDescriptor, Boolean>() {
KotlinPackage.single(descriptor.getStaticScope().getFunctions(ENUM_VALUE_OF, UsageLocation.NO_LOCATION), new Function1<FunctionDescriptor, Boolean>() {
@Override
public Boolean invoke(FunctionDescriptor descriptor) {
return CodegenUtil.isEnumValueOfMethod(descriptor);
@@ -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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
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, Location.NOWHERE).iterator().next().getOriginal();
functionJetType.getMemberScope().getFunctions(OperatorConventions.INVOKE, UsageLocation.NO_LOCATION).iterator().next().getOriginal();
StackValue functionField = StackValue.field(functionType, ownerType, FUNCTION_FIELD_NAME, false, StackValue.none());
codegen.genDelegate(erasedInterfaceFunction, invokeFunction, functionField);
@@ -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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
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<FunctionDescriptor> superFunctionCandidates = supertype.getMemberScope().getFunctions(name, Location.NOWHERE);
Collection<FunctionDescriptor> superFunctionCandidates = supertype.getMemberScope().getFunctions(name, UsageLocation.NO_LOCATION);
for (FunctionDescriptor candidate : superFunctionCandidates) {
JvmMethodSignature candidateSignature = SIGNATURE_MAPPER.mapToJvmMethodSignature(candidate);
if (JvmSignaturePackage.erasedSignaturesEqualIgnoringReturnTypes(autoSignature, candidateSignature)) {
@@ -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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
import org.jetbrains.kotlin.types.JetType
import org.jetbrains.kotlin.utils.Printer
import java.util.ArrayList
@@ -42,15 +42,15 @@ class AllUnderImportsScope : JetScope {
return scopes.flatMap { it.getDescriptors(kindFilter, nameFilter) }
}
override fun getClassifier(name: Name, location: Location): ClassifierDescriptor? {
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? {
return scopes.asSequence().map { it.getClassifier(name) }.filterNotNull().singleOrNull()
}
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> {
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> {
return scopes.flatMap { it.getProperties(name) }
}
override fun getFunctions(name: Name, location: Location): Collection<FunctionDescriptor> {
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
return scopes.flatMap { it.getFunctions(name) }
}
@@ -525,7 +525,7 @@ public class DescriptorResolver {
Name name = nameExpression.getReferencedNameAsName();
ClassifierDescriptor classifier = scope.getClassifier(name, Location.NOWHERE);
ClassifierDescriptor classifier = scope.getClassifier(name, UsageLocation.NO_LOCATION);
if (classifier instanceof TypeParameterDescriptor && classifier.getContainingDeclaration() == descriptor) continue;
if (classifier != null) {
@@ -37,7 +37,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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
@@ -734,9 +734,9 @@ public class OverrideResolver {
) {
for (JetType supertype : declaringClass.getTypeConstructor().getSupertypes()) {
Set<CallableMemberDescriptor> all = Sets.newLinkedHashSet();
all.addAll(supertype.getMemberScope().getFunctions(declared.getName(), Location.NOWHERE));
all.addAll(supertype.getMemberScope().getFunctions(declared.getName(), UsageLocation.NO_LOCATION));
//noinspection unchecked
all.addAll((Collection) supertype.getMemberScope().getProperties(declared.getName(), Location.NOWHERE));
all.addAll((Collection) supertype.getMemberScope().getProperties(declared.getName(), UsageLocation.NO_LOCATION));
for (CallableMemberDescriptor fromSuper : all) {
if (OverridingUtil.DEFAULT.isOverridableBy(fromSuper, declared).getResult() == OVERRIDABLE) {
if (Visibilities.isVisible(ReceiverValue.IRRELEVANT_RECEIVER, fromSuper, declared)) {
@@ -30,6 +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.receivers.ReceiverValue;
import org.jetbrains.kotlin.resolve.validation.SymbolUsageValidator;
@@ -228,14 +229,14 @@ public class QualifiedExpressionResolver {
descriptors.add(packageDescriptor);
}
ClassifierDescriptor classifierDescriptor = outerScope.getClassifier(referencedName, Location.NOWHERE);
ClassifierDescriptor classifierDescriptor = outerScope.getClassifier(referencedName, UsageLocation.NO_LOCATION);
if (classifierDescriptor != null) {
descriptors.add(classifierDescriptor);
}
if (lookupMode == LookupMode.EVERYTHING) {
descriptors.addAll(outerScope.getFunctions(referencedName, Location.NOWHERE));
descriptors.addAll(outerScope.getProperties(referencedName, Location.NOWHERE));
descriptors.addAll(outerScope.getFunctions(referencedName, UsageLocation.NO_LOCATION));
descriptors.addAll(outerScope.getProperties(referencedName, UsageLocation.NO_LOCATION));
VariableDescriptor localVariable = outerScope.getLocalVariable(referencedName);
if (localVariable != null) {
@@ -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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
import org.jetbrains.kotlin.utils.Printer
class SingleImportScope(private val aliasName: Name, private val descriptors: Collection<DeclarationDescriptor>) : JetScopeImpl() {
override fun getClassifier(name: Name, location: Location)
override fun getClassifier(name: Name, location: UsageLocation)
= if (name == aliasName) descriptors.filterIsInstance<ClassifierDescriptor>().singleOrNull() else null
override fun getPackage(name: Name)
= if (name == aliasName) descriptors.filterIsInstance<PackageViewDescriptor>().singleOrNull() else null
override fun getProperties(name: Name, location: Location)
override fun getProperties(name: Name, location: UsageLocation)
= if (name == aliasName) descriptors.filterIsInstance<VariableDescriptor>() else emptyList()
override fun getFunctions(name: Name, location: Location)
override fun getFunctions(name: Name, location: UsageLocation)
= if (name == aliasName) descriptors.filterIsInstance<FunctionDescriptor>() else emptyList()
override fun getContainingDeclaration(): DeclarationDescriptor = throw UnsupportedOperationException()
@@ -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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
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: Location): Collection<FunctionDescriptor> {
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
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: Location): Collection<VariableDescriptor> {
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> {
return if (call.getValueArgumentList() == null && call.getValueArguments().isEmpty()) {
listOf(createDynamicProperty(owner, name, call))
}
@@ -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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
import org.jetbrains.kotlin.storage.LockBasedLazyResolveStorageManager;
import javax.inject.Inject;
@@ -70,7 +70,7 @@ public class LazyDeclarationResolver {
// class A {} class A { fun foo(): A<completion here>}
// 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(), Location.NOWHERE);
ClassifierDescriptor scopeDescriptor = resolutionScope.getClassifier(classOrObject.getNameAsSafeName(), UsageLocation.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(), Location.NOWHERE);
scopeForDeclaration.getFunctions(function.getNameAsSafeName(), UsageLocation.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(), Location.NOWHERE);
classDescriptor.getDefaultType().getMemberScope().getProperties(parameter.getNameAsSafeName(), UsageLocation.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(), Location.NOWHERE);
scopeForDeclaration.getProperties(property.getNameAsSafeName(), UsageLocation.NO_LOCATION);
return getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, property);
}
@@ -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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
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: Location): ClassifierDescriptor? {
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? {
return importResolver.selectSingleFromImports(name, LookupMode.ONLY_CLASSES_AND_PACKAGES) { scope, name ->
val descriptor = scope.getClassifier(name)
if (descriptor != null && isClassVisible(descriptor as ClassDescriptor/*no type parameter can be imported*/)) descriptor else null
@@ -246,14 +246,14 @@ class LazyImportScope(
return importResolver.selectSingleFromImports(name, LookupMode.ONLY_CLASSES_AND_PACKAGES) { scope, name -> scope.getPackage(name) }
}
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> {
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> {
if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf()
return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getProperties(name) }
}
override fun getLocalVariable(name: Name) = null
override fun getFunctions(name: Name, location: Location): Collection<FunctionDescriptor> {
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf()
return importResolver.collectFromImports(name, LookupMode.EVERYTHING) { scope, name -> scope.getFunctions(name) }
}
@@ -40,7 +40,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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
import org.jetbrains.kotlin.storage.*;
import javax.inject.Inject;
@@ -282,7 +282,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(), Location.NOWHERE);
ClassifierDescriptor classifier = resolutionScope.getClassifier(fqName.shortName(), UsageLocation.NO_LOCATION);
assert classifier != null : "No descriptor for " + fqName + " in file " + script.getContainingFile();
return (ClassDescriptor) classifier;
}
@@ -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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
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, Location.NOWHERE);
ClassifierDescriptor classifier = scope.getClassifier(name, UsageLocation.NO_LOCATION);
if (!(classifier instanceof ClassDescriptor)) return null;
scope = ((ClassDescriptor) classifier).getUnsubstitutedInnerClassesScope();
}
@@ -29,7 +29,7 @@ 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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
import org.jetbrains.kotlin.storage.MemoizedFunctionToNotNull
import org.jetbrains.kotlin.storage.StorageManager
import org.jetbrains.kotlin.types.JetType
@@ -62,9 +62,9 @@ protected constructor(
override fun getContainingDeclaration() = thisDescriptor
override fun getClassifier(name: Name, location: Location): ClassDescriptor? = classDescriptors(name).firstOrNull()
override fun getClassifier(name: Name, location: UsageLocation): ClassDescriptor? = classDescriptors(name).firstOrNull()
override fun getFunctions(name: Name, location: Location): Collection<FunctionDescriptor> = functionDescriptors(name)
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> = functionDescriptors(name)
private fun doGetFunctions(name: Name): Collection<FunctionDescriptor> {
val result = Sets.newLinkedHashSet<FunctionDescriptor>()
@@ -89,7 +89,7 @@ protected constructor(
protected abstract fun getNonDeclaredFunctions(name: Name, result: MutableSet<FunctionDescriptor>)
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> = propertyDescriptors(name)
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> = propertyDescriptors(name)
public fun doGetProperties(name: Name): Collection<VariableDescriptor> {
val result = LinkedHashSet<VariableDescriptor>()
@@ -349,7 +349,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
}
Name name = ((JetClassOrObjectInfo) companionObjectInfo).getName();
assert name != null;
getUnsubstitutedMemberScope().getClassifier(name, Location.NOWHERE);
getUnsubstitutedMemberScope().getClassifier(name, UsageLocation.NO_LOCATION);
ClassDescriptor companionObjectDescriptor = c.getTrace().get(BindingContext.CLASS, companionObject);
if (companionObjectDescriptor instanceof LazyClassDescriptor) {
assert DescriptorUtils.isCompanionObject(companionObjectDescriptor) : "Not a companion object: " + companionObjectDescriptor;
@@ -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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
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: Location): Collection<FunctionDescriptor> {
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
// TODO: this should be handled by lazy function descriptors
val functions = super.getFunctions(name)
resolveUnknownVisibilitiesForMembers(functions)
@@ -173,7 +173,7 @@ public open class LazyClassMemberScope(
}
}
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> {
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> {
// TODO: this should be handled by lazy property descriptors
val properties = super.getProperties(name)
resolveUnknownVisibilitiesForMembers(properties as Collection<CallableMemberDescriptor>)
@@ -156,7 +156,7 @@ public class WritableScopeImpl @jvmOverloads constructor(
functionsByName!![name] = functionsByName!![name] + descriptorIndex
}
override fun getFunctions(name: Name, location: Location): Collection<FunctionDescriptor> {
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
checkMayRead()
return concatInOrder(functionsByName(name), workerScope.getFunctions(name))
@@ -166,7 +166,7 @@ public class WritableScopeImpl @jvmOverloads constructor(
addVariableOrClassDescriptor(classifierDescriptor)
}
override fun getClassifier(name: Name, location: Location): ClassifierDescriptor? {
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? {
checkMayRead()
return variableOrClassDescriptorByName(name) as? ClassifierDescriptor
@@ -270,13 +270,13 @@ public class WritableScopeImpl @jvmOverloads constructor(
return workerScope.getLocalVariable(name)
}
override fun getFunctions(name: Name, location: Location): Collection<FunctionDescriptor> {
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
checkMayRead()
return concatInOrder(functionsByName(name, descriptorLimit), workerScope.getFunctions(name))
}
override fun getClassifier(name: Name, location: Location): ClassifierDescriptor? {
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? {
checkMayRead()
return variableOrClassDescriptorByName(name, descriptorLimit) as? ClassifierDescriptor
@@ -37,7 +37,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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
import org.jetbrains.kotlin.test.JetLiteFixture;
import org.jetbrains.kotlin.test.JetTestUtils;
import org.jetbrains.kotlin.types.TypeProjection;
@@ -153,7 +153,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<FunctionDescriptor> functions = memberScope.getFunctions(functionName, Location.NOWHERE);
Collection<FunctionDescriptor> functions = memberScope.getFunctions(functionName, UsageLocation.NO_LOCATION);
assert functions.size() == 1 : "Failed to find function " + functionName + " in class" + "." + packageView.getName();
return functions.iterator().next();
}
@@ -162,7 +162,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.<TypeProjection>emptyList());
Collection<FunctionDescriptor> functions = memberScope.getFunctions(functionName, Location.NOWHERE);
Collection<FunctionDescriptor> functions = memberScope.getFunctions(functionName, UsageLocation.NO_LOCATION);
assert functions.size() == 1 : "Failed to find function " + functionName + " in class" + "." + classDescriptor.getName();
return functions.iterator().next();
}
@@ -171,13 +171,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<VariableDescriptor> properties = memberScope.getProperties(propertyName, Location.NOWHERE);
Collection<VariableDescriptor> properties = memberScope.getProperties(propertyName, UsageLocation.NO_LOCATION);
if (properties.isEmpty()) {
for (DeclarationDescriptor descriptor : memberScope.getAllDescriptors()) {
if (descriptor instanceof ClassDescriptor) {
Collection<VariableDescriptor> classProperties =
((ClassDescriptor) descriptor).getMemberScope(Collections.<TypeProjection>emptyList())
.getProperties(propertyName, Location.NOWHERE);
.getProperties(propertyName, UsageLocation.NO_LOCATION);
if (!classProperties.isEmpty()) {
properties = classProperties;
break;
@@ -198,7 +198,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.<TypeProjection>emptyList());
Collection<VariableDescriptor> properties = memberScope.getProperties(propertyName, Location.NOWHERE);
Collection<VariableDescriptor> properties = memberScope.getProperties(propertyName, UsageLocation.NO_LOCATION);
assert properties.size() == 1 : "Failed to find property " + propertyName + " in class " + classDescriptor.getName();
return (PropertyDescriptor) properties.iterator().next();
}
@@ -206,7 +206,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, Location.NOWHERE);
ClassifierDescriptor aClass = packageView.getMemberScope().getClassifier(className, UsageLocation.NO_LOCATION);
assertNotNull("Failed to find class: " + packageView.getName() + "." + className, aClass);
assert aClass instanceof ClassDescriptor : "Not a class: " + aClass;
return (ClassDescriptor) aClass;
@@ -216,7 +216,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.<TypeProjection>emptyList());
ClassifierDescriptor innerClass = memberScope.getClassifier(propertyName, Location.NOWHERE);
ClassifierDescriptor innerClass = memberScope.getClassifier(propertyName, UsageLocation.NO_LOCATION);
assert innerClass instanceof ClassDescriptor : "Failed to find inner class " +
propertyName +
" in class " +
@@ -24,6 +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.types.JetType;
import org.junit.Assert;
@@ -410,7 +411,7 @@ public class DescriptorValidator {
public Void visitVariableDescriptor(
VariableDescriptor descriptor, JetScope scope
) {
assertFound(scope, descriptor, scope.getProperties(descriptor.getName(), Location.NOWHERE));
assertFound(scope, descriptor, scope.getProperties(descriptor.getName(), UsageLocation.NO_LOCATION));
return null;
}
@@ -418,7 +419,7 @@ public class DescriptorValidator {
public Void visitFunctionDescriptor(
FunctionDescriptor descriptor, JetScope scope
) {
assertFound(scope, descriptor, scope.getFunctions(descriptor.getName(), Location.NOWHERE));
assertFound(scope, descriptor, scope.getFunctions(descriptor.getName(), UsageLocation.NO_LOCATION));
return null;
}
@@ -426,7 +427,7 @@ public class DescriptorValidator {
public Void visitTypeParameterDescriptor(
TypeParameterDescriptor descriptor, JetScope scope
) {
assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), Location.NOWHERE), true);
assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), UsageLocation.NO_LOCATION), true);
return null;
}
@@ -434,7 +435,7 @@ public class DescriptorValidator {
public Void visitClassDescriptor(
ClassDescriptor descriptor, JetScope scope
) {
assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), Location.NOWHERE), true);
assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), UsageLocation.NO_LOCATION), true);
return null;
}
@@ -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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
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<FunctionDescriptor> functions =
module.getPackage(FqName.ROOT).getMemberScope().getFunctions(Name.identifier("f"), Location.NOWHERE);
module.getPackage(FqName.ROOT).getMemberScope().getFunctions(Name.identifier("f"), UsageLocation.NO_LOCATION);
assert functions.size() == 1 : "Many functions defined";
FunctionDescriptor function = ContainerUtil.getFirstItem(functions);
@@ -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, Location.NOWHERE));
writableScope.addClassifierDescriptor(module.getPackage(fqName.parent()).getMemberScope().getClassifier(shortName, UsageLocation.NO_LOCATION));
}
}
scopeChain.add(module.getPackage(FqName.ROOT).getMemberScope());
@@ -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"), Location.NOWHERE);
ClassifierDescriptor contextClass = topLevelDeclarations.getClassifier(Name.identifier("___Context"), UsageLocation.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), Location.NOWHERE);
ClassifierDescriptor classifier = scope.getClassifier(Name.identifier(typeParameterName), UsageLocation.NO_LOCATION);
assertNotNull("No type parameter named " + typeParameterName, classifier);
assertTrue(typeParameterName + " is not a type parameter: " + classifier, classifier instanceof TypeParameterDescriptor);
@@ -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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
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: Location): ClassifierDescriptor? = nestedClasses(name)
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? = nestedClasses(name)
override fun getClassNames(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection<Name>
= nestedClassIndex().keySet() + enumEntryIndex().keySet()
@@ -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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
import org.jetbrains.kotlin.storage.NotNullLazyValue
import org.jetbrains.kotlin.types.JetType
import org.jetbrains.kotlin.types.TypeUtils
@@ -218,7 +218,7 @@ public abstract class LazyJavaMemberScope(
return ResolvedValueParameters(descriptors, synthesizedNames)
}
override fun getFunctions(name: Name, location: Location) = functions(name)
override fun getFunctions(name: Name, location: UsageLocation) = functions(name)
protected open fun getFunctionNames(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection<Name>
= memberIndex().getMethodNames(nameFilter)
@@ -297,7 +297,7 @@ public abstract class LazyJavaMemberScope(
return propertyType
}
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> = properties(name)
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> = properties(name)
override fun getOwnDeclaredDescriptors() = getDescriptors()
@@ -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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
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<Name> = listOf()
override fun getClassifier(name: Name, location: Location): ClassifierDescriptor? = null
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? = null
override fun getSubPackages(): Collection<FqName> = listOf()
@@ -32,7 +32,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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
import org.jetbrains.kotlin.utils.addIfNotNull
public class LazyPackageFragmentScopeForJavaPackage(
@@ -70,10 +70,10 @@ public class LazyPackageFragmentScopeForJavaPackage(
}
}
override fun getClassifier(name: Name, location: Location): ClassifierDescriptor? = classes(name)
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? = classes(name)
override fun getProperties(name: Name, location: Location) = deserializedPackageScope().getProperties(name)
override fun getFunctions(name: Name, location: Location) = deserializedPackageScope().getFunctions(name) + super.getFunctions(name)
override fun getProperties(name: Name, location: UsageLocation) = deserializedPackageScope().getProperties(name)
override fun getFunctions(name: Name, location: UsageLocation) = deserializedPackageScope().getFunctions(name) + super.getFunctions(name)
override fun addExtraDescriptors(result: MutableSet<DeclarationDescriptor>,
kindFilter: DescriptorKindFilter,
@@ -34,7 +34,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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.checker.JetTypeChecker;
@@ -252,7 +252,7 @@ public class KotlinBuiltIns {
@Nullable
public ClassDescriptor getBuiltInClassByNameNullable(@NotNull Name simpleName) {
ClassifierDescriptor classifier = getBuiltInsPackageFragment().getMemberScope().getClassifier(simpleName, Location.NOWHERE);
ClassifierDescriptor classifier = getBuiltInsPackageFragment().getMemberScope().getClassifier(simpleName, UsageLocation.NO_LOCATION);
assert classifier == null ||
classifier instanceof ClassDescriptor : "Must be a class descriptor " + simpleName + ", but was " + classifier;
return (ClassDescriptor) classifier;
@@ -1019,6 +1019,6 @@ public class KotlinBuiltIns {
@NotNull
public FunctionDescriptor getIdentityEquals() {
return KotlinPackage.first(getBuiltInsPackageFragment().getMemberScope().getFunctions(Name.identifier("identityEquals"), Location.NOWHERE));
return KotlinPackage.first(getBuiltInsPackageFragment().getMemberScope().getFunctions(Name.identifier("identityEquals"), UsageLocation.NO_LOCATION));
}
}
@@ -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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
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: Location): Collection<FunctionDescriptor> {
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
return allDescriptors().filterIsInstance<FunctionDescriptor>().filter { it.getName() == name }
}
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> {
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> {
return allDescriptors().filterIsInstance<PropertyDescriptor>().filter { it.getName() == name }
}
@@ -192,25 +192,25 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
@NotNull
@Override
@SuppressWarnings("unchecked")
public Collection<VariableDescriptor> getProperties(@NotNull Name name, @NotNull Location location) {
public Collection<VariableDescriptor> getProperties(@NotNull Name name, @NotNull UsageLocation location) {
return (Collection) properties.invoke(name);
}
@NotNull
@SuppressWarnings("unchecked")
private Collection<PropertyDescriptor> computeProperties(@NotNull Name name) {
return resolveFakeOverrides(name, (Collection) getSupertypeScope().getProperties(name, Location.NOWHERE));
return resolveFakeOverrides(name, (Collection) getSupertypeScope().getProperties(name, UsageLocation.NO_LOCATION));
}
@NotNull
@Override
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name, @NotNull Location location) {
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name, @NotNull UsageLocation location) {
return functions.invoke(name);
}
@NotNull
private Collection<FunctionDescriptor> computeFunctions(@NotNull Name name) {
return resolveFakeOverrides(name, getSupertypeScope().getFunctions(name, Location.NOWHERE));
return resolveFakeOverrides(name, getSupertypeScope().getFunctions(name, UsageLocation.NO_LOCATION));
}
@NotNull
@@ -266,8 +266,8 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
private Collection<DeclarationDescriptor> computeAllDeclarations() {
Collection<DeclarationDescriptor> result = new HashSet<DeclarationDescriptor>();
for (Name name : enumMemberNames.invoke()) {
result.addAll(getFunctions(name, Location.NOWHERE));
result.addAll(getProperties(name, Location.NOWHERE));
result.addAll(getFunctions(name, UsageLocation.NO_LOCATION));
result.addAll(getProperties(name, UsageLocation.NO_LOCATION));
}
return result;
}
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.name.SpecialNames;
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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
import org.jetbrains.kotlin.types.ErrorUtils;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.LazyType;
@@ -389,7 +389,7 @@ public class DescriptorUtils {
@Nullable
public static ClassDescriptor getInnerClassByName(@NotNull ClassDescriptor classDescriptor, @NotNull String innerClassName) {
ClassifierDescriptor classifier =
classDescriptor.getDefaultType().getMemberScope().getClassifier(Name.identifier(innerClassName), Location.NOWHERE);
classDescriptor.getDefaultType().getMemberScope().getClassifier(Name.identifier(innerClassName), UsageLocation.NO_LOCATION);
assert classifier instanceof ClassDescriptor :
"Inner class " + innerClassName + " in " + classDescriptor + " should be instance of ClassDescriptor, but was: "
+ (classifier == null ? "null" : classifier.getClass());
@@ -31,7 +31,7 @@ public abstract class AbstractScopeAdapter : JetScope {
return workerScope.getImplicitReceiversHierarchy()
}
override fun getFunctions(name: Name, location: Location): Collection<FunctionDescriptor> {
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> {
return workerScope.getFunctions(name)
}
@@ -39,11 +39,11 @@ public abstract class AbstractScopeAdapter : JetScope {
return workerScope.getPackage(name)
}
override fun getClassifier(name: Name, location: Location): ClassifierDescriptor? {
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? {
return workerScope.getClassifier(name)
}
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> {
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> {
return workerScope.getProperties(name)
}
@@ -50,19 +50,19 @@ public open class ChainedScope(
return result ?: emptySet()
}
override fun getClassifier(name: Name, location: Location): ClassifierDescriptor?
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor?
= getFirstMatch { it.getClassifier(name) }
override fun getPackage(name: Name): PackageViewDescriptor?
= getFirstMatch { it.getPackage(name) }
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor>
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor>
= getFromAllScopes { it.getProperties(name) }
override fun getLocalVariable(name: Name): VariableDescriptor?
= getFirstMatch { it.getLocalVariable(name) }
override fun getFunctions(name: Name, location: Location): Collection<FunctionDescriptor>
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor>
= getFromAllScopes { it.getFunctions(name) }
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor>
@@ -23,13 +23,13 @@ import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
public class ExplicitImportsScope(private val descriptors: Collection<DeclarationDescriptor>) : JetScopeImpl() {
override fun getClassifier(name: Name, location: Location) = descriptors.filter { it.getName() == name }.firstIsInstanceOrNull<ClassifierDescriptor>()
override fun getClassifier(name: Name, location: UsageLocation) = descriptors.filter { it.getName() == name }.firstIsInstanceOrNull<ClassifierDescriptor>()
override fun getPackage(name: Name)= descriptors.filter { it.getName() == name }.firstIsInstanceOrNull<PackageViewDescriptor>()
override fun getProperties(name: Name, location: Location) = descriptors.filter { it.getName() == name }.filterIsInstance<VariableDescriptor>()
override fun getProperties(name: Name, location: UsageLocation) = descriptors.filter { it.getName() == name }.filterIsInstance<VariableDescriptor>()
override fun getFunctions(name: Name, location: Location) = descriptors.filter { it.getName() == name }.filterIsInstance<FunctionDescriptor>()
override fun getFunctions(name: Name, location: UsageLocation) = descriptors.filter { it.getName() == name }.filterIsInstance<FunctionDescriptor>()
override fun getContainingDeclaration() = throw UnsupportedOperationException()
@@ -24,7 +24,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: Location) = workerScope.getFunctions(name).filter(predicate)
override fun getFunctions(name: Name, location: UsageLocation) = workerScope.getFunctions(name).filter(predicate)
override fun getContainingDeclaration() = workerScope.getContainingDeclaration()
@@ -33,9 +33,9 @@ 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: Location) = filterDescriptor(workerScope.getClassifier(name))
override fun getClassifier(name: Name, location: UsageLocation) = filterDescriptor(workerScope.getClassifier(name))
override fun getProperties(name: Name, location: Location) = workerScope.getProperties(name).filter(predicate)
override fun getProperties(name: Name, location: UsageLocation) = workerScope.getProperties(name).filter(predicate)
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor> = workerScope.getSyntheticExtensionProperties(receiverTypes, name).filter(predicate)
@@ -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: Location) = workerScope.getClassifier(name) as? ClassDescriptor
override fun getClassifier(name: Name, location: UsageLocation) = workerScope.getClassifier(name) as? ClassDescriptor
override fun getDeclarationsByLabel(labelName: Name) = workerScope.getDeclarationsByLabel(labelName).filterIsInstance<ClassDescriptor>()
@@ -25,15 +25,15 @@ import java.lang.reflect.Modifier
public interface JetScope {
public fun getClassifier(name: Name, location: Location = Location.NOWHERE): ClassifierDescriptor?
public fun getClassifier(name: Name, location: UsageLocation = UsageLocation.NO_LOCATION): ClassifierDescriptor?
public fun getPackage(name: Name): PackageViewDescriptor?
public fun getProperties(name: Name, location: Location = Location.NOWHERE): Collection<VariableDescriptor>
public fun getProperties(name: Name, location: UsageLocation = UsageLocation.NO_LOCATION): Collection<VariableDescriptor>
public fun getLocalVariable(name: Name): VariableDescriptor?
public fun getFunctions(name: Name, location: Location = Location.NOWHERE): Collection<FunctionDescriptor>
public fun getFunctions(name: Name, location: UsageLocation = UsageLocation.NO_LOCATION): Collection<FunctionDescriptor>
public fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor>
@@ -244,8 +244,8 @@ public interface DescriptorKindExclude {
}
}
public interface Location {
public interface UsageLocation {
companion object {
val NOWHERE = object : Location {}
val NO_LOCATION = object : UsageLocation {}
}
}
@@ -22,15 +22,15 @@ import org.jetbrains.kotlin.types.JetType
import org.jetbrains.kotlin.utils.Printer
public abstract class JetScopeImpl : JetScope {
override fun getClassifier(name: Name, location: Location): ClassifierDescriptor? = null
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? = null
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> = setOf()
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> = setOf()
override fun getLocalVariable(name: Name): VariableDescriptor? = null
override fun getPackage(name: Name): PackageViewDescriptor? = null
override fun getFunctions(name: Name, location: Location): Collection<FunctionDescriptor> = setOf()
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> = setOf()
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor> = listOf()
@@ -28,7 +28,7 @@ import java.util.ArrayList
public class StaticScopeForKotlinClass(
private val containingClass: ClassDescriptor
) : JetScopeImpl() {
override fun getClassifier(name: Name, location: Location) = null // TODO
override fun getClassifier(name: Name, location: UsageLocation) = null // TODO
private val functions: List<FunctionDescriptor> 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: Location) = functions.filterTo(ArrayList<FunctionDescriptor>(2)) { it.getName() == name }
override fun getFunctions(name: Name, location: UsageLocation) = functions.filterTo(ArrayList<FunctionDescriptor>(2)) { it.getName() == name }
override fun getContainingDeclaration() = containingClass
@@ -61,13 +61,13 @@ public class SubstitutingScope(private val workerScope: JetScope, private val su
return result
}
override fun getProperties(name: Name, location: Location) = substitute(workerScope.getProperties(name))
override fun getProperties(name: Name, location: UsageLocation) = substitute(workerScope.getProperties(name))
override fun getLocalVariable(name: Name) = substitute(workerScope.getLocalVariable(name))
override fun getClassifier(name: Name, location: Location) = substitute(workerScope.getClassifier(name))
override fun getClassifier(name: Name, location: UsageLocation) = substitute(workerScope.getClassifier(name))
override fun getFunctions(name: Name, location: Location) = substitute(workerScope.getFunctions(name))
override fun getFunctions(name: Name, location: UsageLocation) = substitute(workerScope.getFunctions(name))
override fun getSyntheticExtensionProperties(receiverTypes: Collection<JetType>, name: Name): Collection<PropertyDescriptor> = substitute(workerScope.getSyntheticExtensionProperties(receiverTypes, name))
@@ -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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
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 Location location) {
public ClassifierDescriptor getClassifier(@NotNull Name name, @NotNull UsageLocation location) {
return createErrorClass(name.asString());
}
@NotNull
@Override
public Set<VariableDescriptor> getProperties(@NotNull Name name, @NotNull Location location) {
public Set<VariableDescriptor> getProperties(@NotNull Name name, @NotNull UsageLocation location) {
return ERROR_VARIABLE_GROUP;
}
@@ -125,7 +125,7 @@ public class ErrorUtils {
@NotNull
@Override
public Set<FunctionDescriptor> getFunctions(@NotNull Name name, @NotNull Location location) {
public Set<FunctionDescriptor> getFunctions(@NotNull Name name, @NotNull UsageLocation location) {
return Collections.<FunctionDescriptor>singleton(createErrorFunction(this));
}
@@ -181,7 +181,7 @@ public class ErrorUtils {
@Nullable
@Override
public ClassifierDescriptor getClassifier(@NotNull Name name, @NotNull Location location) {
public ClassifierDescriptor getClassifier(@NotNull Name name, @NotNull UsageLocation location) {
throw new IllegalStateException();
}
@@ -193,7 +193,7 @@ public class ErrorUtils {
@NotNull
@Override
public Collection<VariableDescriptor> getProperties(@NotNull Name name, @NotNull Location location) {
public Collection<VariableDescriptor> getProperties(@NotNull Name name, @NotNull UsageLocation location) {
throw new IllegalStateException();
}
@@ -205,7 +205,7 @@ public class ErrorUtils {
@NotNull
@Override
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name, @NotNull Location location) {
public Collection<FunctionDescriptor> getFunctions(@NotNull Name name, @NotNull UsageLocation location) {
throw new IllegalStateException();
}
@@ -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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
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<FunctionDescriptor>) {
}
override fun getFunctions(name: Name, location: Location): Collection<FunctionDescriptor> = functions(name)
override fun getFunctions(name: Name, location: UsageLocation): Collection<FunctionDescriptor> = functions(name)
private fun computeProperties(name: Name): Collection<VariableDescriptor> {
val descriptors = computeMembers<PropertyDescriptor>(name, Kind.PROPERTY)
@@ -104,9 +104,9 @@ public abstract class DeserializedMemberScope protected constructor(
protected open fun computeNonDeclaredProperties(name: Name, descriptors: MutableCollection<PropertyDescriptor>) {
}
override fun getProperties(name: Name, location: Location): Collection<VariableDescriptor> = properties.invoke(name)
override fun getProperties(name: Name, location: UsageLocation): Collection<VariableDescriptor> = properties.invoke(name)
override fun getClassifier(name: Name, location: Location) = getClassDescriptor(name)
override fun getClassifier(name: Name, location: UsageLocation) = getClassDescriptor(name)
protected abstract fun getClassDescriptor(name: Name): ClassifierDescriptor?
@@ -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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
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<FunctionDescriptor> functions = packageDescriptor.getMemberScope().getFunctions(name, Location.NOWHERE);
Collection<FunctionDescriptor> functions = packageDescriptor.getMemberScope().getFunctions(name, UsageLocation.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<VariableDescriptor> properties = packageDescriptor.getMemberScope().getProperties(name, Location.NOWHERE);
Collection<VariableDescriptor> properties = packageDescriptor.getMemberScope().getProperties(name, UsageLocation.NO_LOCATION);
for (VariableDescriptor descriptor : properties) {
ForceResolveUtil.forceResolveAllContents(descriptor);
}
@@ -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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
import org.jetbrains.kotlin.types.ErrorUtils.createErrorType
import org.jetbrains.kotlin.types.TypeProjection
import org.jetbrains.kotlin.types.TypeSubstitutor
@@ -48,7 +48,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: Location): ClassifierDescriptor? {
override fun getClassifier(name: Name, location: UsageLocation): ClassifierDescriptor? {
return MissingDependencyErrorClassDescriptor(getContainingDeclaration(), fqName.child(name))
}
}
@@ -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.Location
import org.jetbrains.kotlin.resolve.scopes.UsageLocation
import org.jetbrains.kotlin.types.JetType
import org.jetbrains.kotlin.types.SubstitutionUtils
import org.jetbrains.kotlin.types.TypeUtils
@@ -110,6 +110,6 @@ public object HeuristicSignatures {
private class TypeParametersScope(params: Collection<TypeParameterDescriptor>) : JetScope by JetScope.Empty {
private val paramsByName = params.map { it.getName() to it }.toMap()
override fun getClassifier(name: Name, location: Location) = paramsByName[name]
override fun getClassifier(name: Name, location: UsageLocation) = paramsByName[name]
}
}
@@ -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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
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<JetNamedFunc
Name name = functionDescriptor.getName();
for (JetType type : TypeUtils.getAllSupertypes(classDescriptor.getDefaultType())) {
JetScope scope = type.getMemberScope();
for (FunctionDescriptor function : scope.getFunctions(name, Location.NOWHERE)) {
for (FunctionDescriptor function : scope.getFunctions(name, UsageLocation.NO_LOCATION)) {
if (!function.getKind().isReal()) continue;
if (function.getModality().isOverridable())
superFunctions.add(function);
@@ -74,7 +74,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind;
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode;
import org.jetbrains.kotlin.resolve.scopes.JetScope;
import org.jetbrains.kotlin.resolve.scopes.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.resolve.scopes.receivers.ThisReceiver;
import org.jetbrains.kotlin.types.JetType;
@@ -579,8 +579,8 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
if (!kind.getIsConstructor() && callableScope != null && !info.getNewName().isEmpty()) {
Name newName = Name.identifier(info.getNewName());
Collection<? extends CallableDescriptor> conflicts = oldDescriptor instanceof FunctionDescriptor
? callableScope.getFunctions(newName, Location.NOWHERE)
: callableScope.getProperties(newName, Location.NOWHERE);
? callableScope.getFunctions(newName, UsageLocation.NO_LOCATION)
: callableScope.getProperties(newName, UsageLocation.NO_LOCATION);
for (CallableDescriptor conflict : conflicts) {
if (conflict == oldDescriptor) continue;
@@ -603,7 +603,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), Location.NOWHERE)) {
for (VariableDescriptor property : parametersScope.getProperties(Name.identifier(parameterName), UsageLocation.NO_LOCATION)) {
PsiElement propertyDeclaration = DescriptorToSourceUtils.descriptorToDeclaration(property);
if (propertyDeclaration != null && !(propertyDeclaration.getParent() instanceof JetParameterList)) {
@@ -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.Location;
import org.jetbrains.kotlin.resolve.scopes.UsageLocation;
import java.util.*;
@@ -249,7 +249,7 @@ public class ManglingUtils {
@NotNull
public static String getStableMangledNameForDescriptor(@NotNull ClassDescriptor descriptor, @NotNull String functionName) {
Collection<FunctionDescriptor> functions =
descriptor.getDefaultType().getMemberScope().getFunctions(Name.identifier(functionName), Location.NOWHERE);
descriptor.getDefaultType().getMemberScope().getFunctions(Name.identifier(functionName), UsageLocation.NO_LOCATION);
assert functions.size() == 1 : "Can't select a single function: " + functionName + " in " + descriptor;
return getSuggestedName((DeclarationDescriptor) functions.iterator().next());
}