LookupLocation.NO_LOCATION_FROM_TEST -> NoLookupLocation.FROM_TEST
This commit is contained in:
+2
-2
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.cli.jvm.config.addJavaSourceRoots
|
|||||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||||
import org.jetbrains.kotlin.context.ProjectContext
|
import org.jetbrains.kotlin.context.ProjectContext
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi.JetFile
|
import org.jetbrains.kotlin.psi.JetFile
|
||||||
@@ -114,7 +114,7 @@ public class MultiModuleJavaAnalysisCustomTest : UsefulTestCase() {
|
|||||||
private fun checkClassInPackage(moduleDescriptor: ModuleDescriptor, packageName: String, className: String) {
|
private fun checkClassInPackage(moduleDescriptor: ModuleDescriptor, packageName: String, className: String) {
|
||||||
val kotlinPackage = moduleDescriptor.getPackage(FqName(packageName))
|
val kotlinPackage = moduleDescriptor.getPackage(FqName(packageName))
|
||||||
val kotlinClassName = Name.identifier(className)
|
val kotlinClassName = Name.identifier(className)
|
||||||
val kotlinClass = kotlinPackage.memberScope.getClassifier(kotlinClassName, LookupLocation.NO_LOCATION_FROM_TEST) as ClassDescriptor
|
val kotlinClass = kotlinPackage.memberScope.getClassifier(kotlinClassName, NoLookupLocation.FROM_TEST) as ClassDescriptor
|
||||||
checkClass(kotlinClass)
|
checkClass(kotlinClass)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.descriptors.*;
|
|||||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
|
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
|
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
|
||||||
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.psi.JetAnnotationEntry;
|
import org.jetbrains.kotlin.psi.JetAnnotationEntry;
|
||||||
@@ -38,7 +39,6 @@ import org.jetbrains.kotlin.renderer.DescriptorRendererOptions;
|
|||||||
import org.jetbrains.kotlin.renderer.NameShortness;
|
import org.jetbrains.kotlin.renderer.NameShortness;
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation;
|
|
||||||
import org.jetbrains.kotlin.test.JetLiteFixture;
|
import org.jetbrains.kotlin.test.JetLiteFixture;
|
||||||
import org.jetbrains.kotlin.test.JetTestUtils;
|
import org.jetbrains.kotlin.test.JetTestUtils;
|
||||||
import org.jetbrains.kotlin.types.TypeProjection;
|
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) {
|
protected static FunctionDescriptor getFunctionDescriptor(@NotNull PackageFragmentDescriptor packageView, @NotNull String name) {
|
||||||
Name functionName = Name.identifier(name);
|
Name functionName = Name.identifier(name);
|
||||||
JetScope memberScope = packageView.getMemberScope();
|
JetScope memberScope = packageView.getMemberScope();
|
||||||
Collection<FunctionDescriptor> functions = memberScope.getFunctions(functionName, LookupLocation.NO_LOCATION_FROM_TEST);
|
Collection<FunctionDescriptor> functions = memberScope.getFunctions(functionName, NoLookupLocation.FROM_TEST);
|
||||||
assert functions.size() == 1 : "Failed to find function " + functionName + " in class" + "." + packageView.getName();
|
assert functions.size() == 1 : "Failed to find function " + functionName + " in class" + "." + packageView.getName();
|
||||||
return functions.iterator().next();
|
return functions.iterator().next();
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends JetLiteFix
|
|||||||
private static FunctionDescriptor getFunctionDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) {
|
private static FunctionDescriptor getFunctionDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) {
|
||||||
Name functionName = Name.identifier(name);
|
Name functionName = Name.identifier(name);
|
||||||
JetScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
JetScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||||
Collection<FunctionDescriptor> functions = memberScope.getFunctions(functionName, LookupLocation.NO_LOCATION_FROM_TEST);
|
Collection<FunctionDescriptor> functions = memberScope.getFunctions(functionName, NoLookupLocation.FROM_TEST);
|
||||||
assert functions.size() == 1 : "Failed to find function " + functionName + " in class" + "." + classDescriptor.getName();
|
assert functions.size() == 1 : "Failed to find function " + functionName + " in class" + "." + classDescriptor.getName();
|
||||||
return functions.iterator().next();
|
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) {
|
protected static PropertyDescriptor getPropertyDescriptor(@NotNull PackageFragmentDescriptor packageView, @NotNull String name, boolean failOnMissing) {
|
||||||
Name propertyName = Name.identifier(name);
|
Name propertyName = Name.identifier(name);
|
||||||
JetScope memberScope = packageView.getMemberScope();
|
JetScope memberScope = packageView.getMemberScope();
|
||||||
Collection<VariableDescriptor> properties = memberScope.getProperties(propertyName, LookupLocation.NO_LOCATION_FROM_TEST);
|
Collection<VariableDescriptor> properties = memberScope.getProperties(propertyName, NoLookupLocation.FROM_TEST);
|
||||||
if (properties.isEmpty()) {
|
if (properties.isEmpty()) {
|
||||||
for (DeclarationDescriptor descriptor : memberScope.getAllDescriptors()) {
|
for (DeclarationDescriptor descriptor : memberScope.getAllDescriptors()) {
|
||||||
if (descriptor instanceof ClassDescriptor) {
|
if (descriptor instanceof ClassDescriptor) {
|
||||||
Collection<VariableDescriptor> classProperties =
|
Collection<VariableDescriptor> classProperties =
|
||||||
((ClassDescriptor) descriptor).getMemberScope(Collections.<TypeProjection>emptyList())
|
((ClassDescriptor) descriptor).getMemberScope(Collections.<TypeProjection>emptyList())
|
||||||
.getProperties(propertyName, LookupLocation.NO_LOCATION_FROM_TEST);
|
.getProperties(propertyName, NoLookupLocation.FROM_TEST);
|
||||||
if (!classProperties.isEmpty()) {
|
if (!classProperties.isEmpty()) {
|
||||||
properties = classProperties;
|
properties = classProperties;
|
||||||
break;
|
break;
|
||||||
@@ -200,7 +200,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends JetLiteFix
|
|||||||
private static PropertyDescriptor getPropertyDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) {
|
private static PropertyDescriptor getPropertyDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) {
|
||||||
Name propertyName = Name.identifier(name);
|
Name propertyName = Name.identifier(name);
|
||||||
JetScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
JetScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||||
Collection<VariableDescriptor> properties = memberScope.getProperties(propertyName, LookupLocation.NO_LOCATION_FROM_TEST);
|
Collection<VariableDescriptor> properties = memberScope.getProperties(propertyName, NoLookupLocation.FROM_TEST);
|
||||||
assert properties.size() == 1 : "Failed to find property " + propertyName + " in class " + classDescriptor.getName();
|
assert properties.size() == 1 : "Failed to find property " + propertyName + " in class " + classDescriptor.getName();
|
||||||
return (PropertyDescriptor) properties.iterator().next();
|
return (PropertyDescriptor) properties.iterator().next();
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends JetLiteFix
|
|||||||
@NotNull
|
@NotNull
|
||||||
protected static ClassDescriptor getClassDescriptor(@NotNull PackageFragmentDescriptor packageView, @NotNull String name) {
|
protected static ClassDescriptor getClassDescriptor(@NotNull PackageFragmentDescriptor packageView, @NotNull String name) {
|
||||||
Name className = Name.identifier(name);
|
Name className = Name.identifier(name);
|
||||||
ClassifierDescriptor aClass = packageView.getMemberScope().getClassifier(className, LookupLocation.NO_LOCATION_FROM_TEST);
|
ClassifierDescriptor aClass = packageView.getMemberScope().getClassifier(className, NoLookupLocation.FROM_TEST);
|
||||||
assertNotNull("Failed to find class: " + packageView.getName() + "." + className, aClass);
|
assertNotNull("Failed to find class: " + packageView.getName() + "." + className, aClass);
|
||||||
assert aClass instanceof ClassDescriptor : "Not a class: " + aClass;
|
assert aClass instanceof ClassDescriptor : "Not a class: " + aClass;
|
||||||
return (ClassDescriptor) aClass;
|
return (ClassDescriptor) aClass;
|
||||||
@@ -218,7 +218,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends JetLiteFix
|
|||||||
private static ClassDescriptor getInnerClassDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) {
|
private static ClassDescriptor getInnerClassDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) {
|
||||||
Name propertyName = Name.identifier(name);
|
Name propertyName = Name.identifier(name);
|
||||||
JetScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
JetScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||||
ClassifierDescriptor innerClass = memberScope.getClassifier(propertyName, LookupLocation.NO_LOCATION_FROM_TEST);
|
ClassifierDescriptor innerClass = memberScope.getClassifier(propertyName, NoLookupLocation.FROM_TEST);
|
||||||
assert innerClass instanceof ClassDescriptor : "Failed to find inner class " +
|
assert innerClass instanceof ClassDescriptor : "Failed to find inner class " +
|
||||||
propertyName +
|
propertyName +
|
||||||
" in class " +
|
" in class " +
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||||
import org.jetbrains.kotlin.descriptors.*;
|
import org.jetbrains.kotlin.descriptors.*;
|
||||||
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation;
|
|
||||||
import org.jetbrains.kotlin.types.JetType;
|
import org.jetbrains.kotlin.types.JetType;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ public class DescriptorValidator {
|
|||||||
public Void visitVariableDescriptor(
|
public Void visitVariableDescriptor(
|
||||||
VariableDescriptor descriptor, JetScope scope
|
VariableDescriptor descriptor, JetScope scope
|
||||||
) {
|
) {
|
||||||
assertFound(scope, descriptor, scope.getProperties(descriptor.getName(), LookupLocation.NO_LOCATION_FROM_TEST));
|
assertFound(scope, descriptor, scope.getProperties(descriptor.getName(), NoLookupLocation.FROM_TEST));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ public class DescriptorValidator {
|
|||||||
public Void visitFunctionDescriptor(
|
public Void visitFunctionDescriptor(
|
||||||
FunctionDescriptor descriptor, JetScope scope
|
FunctionDescriptor descriptor, JetScope scope
|
||||||
) {
|
) {
|
||||||
assertFound(scope, descriptor, scope.getFunctions(descriptor.getName(), LookupLocation.NO_LOCATION_FROM_TEST));
|
assertFound(scope, descriptor, scope.getFunctions(descriptor.getName(), NoLookupLocation.FROM_TEST));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,7 +427,7 @@ public class DescriptorValidator {
|
|||||||
public Void visitTypeParameterDescriptor(
|
public Void visitTypeParameterDescriptor(
|
||||||
TypeParameterDescriptor descriptor, JetScope scope
|
TypeParameterDescriptor descriptor, JetScope scope
|
||||||
) {
|
) {
|
||||||
assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), LookupLocation.NO_LOCATION_FROM_TEST), true);
|
assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), NoLookupLocation.FROM_TEST), true);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,7 +435,7 @@ public class DescriptorValidator {
|
|||||||
public Void visitClassDescriptor(
|
public Void visitClassDescriptor(
|
||||||
ClassDescriptor descriptor, JetScope scope
|
ClassDescriptor descriptor, JetScope scope
|
||||||
) {
|
) {
|
||||||
assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), LookupLocation.NO_LOCATION_FROM_TEST), true);
|
assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), NoLookupLocation.FROM_TEST), true);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ import com.intellij.util.containers.ContainerUtil;
|
|||||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
|
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
|
||||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor;
|
import org.jetbrains.kotlin.descriptors.ModuleDescriptor;
|
||||||
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.psi.JetFile;
|
import org.jetbrains.kotlin.psi.JetFile;
|
||||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||||
import org.jetbrains.kotlin.resolve.lazy.KotlinTestWithEnvironment;
|
import org.jetbrains.kotlin.resolve.lazy.KotlinTestWithEnvironment;
|
||||||
import org.jetbrains.kotlin.resolve.lazy.LazyResolveTestUtil;
|
import org.jetbrains.kotlin.resolve.lazy.LazyResolveTestUtil;
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation;
|
|
||||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -74,7 +74,7 @@ public class BoundsSubstitutorTest extends KotlinTestWithEnvironment {
|
|||||||
JetFile jetFile = JetPsiFactory(getProject()).createFile("fun.kt", text);
|
JetFile jetFile = JetPsiFactory(getProject()).createFile("fun.kt", text);
|
||||||
ModuleDescriptor module = LazyResolveTestUtil.resolveLazily(Collections.singletonList(jetFile), getEnvironment());
|
ModuleDescriptor module = LazyResolveTestUtil.resolveLazily(Collections.singletonList(jetFile), getEnvironment());
|
||||||
Collection<FunctionDescriptor> functions =
|
Collection<FunctionDescriptor> functions =
|
||||||
module.getPackage(FqName.ROOT).getMemberScope().getFunctions(Name.identifier("f"), LookupLocation.NO_LOCATION_FROM_TEST);
|
module.getPackage(FqName.ROOT).getMemberScope().getFunctions(Name.identifier("f"), NoLookupLocation.FROM_TEST);
|
||||||
assert functions.size() == 1 : "Many functions defined";
|
assert functions.size() == 1 : "Many functions defined";
|
||||||
FunctionDescriptor function = ContainerUtil.getFirstItem(functions);
|
FunctionDescriptor function = ContainerUtil.getFirstItem(functions);
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.descriptors.PackageViewDescriptor;
|
|||||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor;
|
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor;
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl;
|
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl;
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ReceiverParameterDescriptorImpl;
|
import org.jetbrains.kotlin.descriptors.impl.ReceiverParameterDescriptorImpl;
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation;
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.psi.JetExpression;
|
import org.jetbrains.kotlin.psi.JetExpression;
|
||||||
@@ -624,7 +624,7 @@ public class JetTypeCheckerTest extends JetLiteFixture {
|
|||||||
else {
|
else {
|
||||||
Name shortName = fqName.shortName();
|
Name shortName = fqName.shortName();
|
||||||
assert shortName.equals(defaultImport.getImportedName());
|
assert shortName.equals(defaultImport.getImportedName());
|
||||||
writableScope.addClassifierDescriptor(module.getPackage(fqName.parent()).getMemberScope().getClassifier(shortName, LookupLocation.NO_LOCATION_FROM_TEST));
|
writableScope.addClassifierDescriptor(module.getPackage(fqName.parent()).getMemberScope().getClassifier(shortName, NoLookupLocation.FROM_TEST));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scopeChain.add(module.getPackage(FqName.ROOT).getMemberScope());
|
scopeChain.add(module.getPackage(FqName.ROOT).getMemberScope());
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.descriptors.ModuleDescriptor;
|
|||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
|
||||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages;
|
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages;
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation;
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.psi.JetFile;
|
import org.jetbrains.kotlin.psi.JetFile;
|
||||||
@@ -86,7 +86,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
|
|||||||
JetFile jetFile = JetPsiFactory(getProject()).createFile(text);
|
JetFile jetFile = JetPsiFactory(getProject()).createFile(text);
|
||||||
ModuleDescriptor module = LazyResolveTestUtil.resolveLazily(Collections.singletonList(jetFile), getEnvironment());
|
ModuleDescriptor module = LazyResolveTestUtil.resolveLazily(Collections.singletonList(jetFile), getEnvironment());
|
||||||
JetScope topLevelDeclarations = module.getPackage(FqName.ROOT).getMemberScope();
|
JetScope topLevelDeclarations = module.getPackage(FqName.ROOT).getMemberScope();
|
||||||
ClassifierDescriptor contextClass = topLevelDeclarations.getClassifier(Name.identifier("___Context"), LookupLocation.NO_LOCATION_FROM_TEST);
|
ClassifierDescriptor contextClass = topLevelDeclarations.getClassifier(Name.identifier("___Context"), NoLookupLocation.FROM_TEST);
|
||||||
assert contextClass instanceof ClassDescriptor;
|
assert contextClass instanceof ClassDescriptor;
|
||||||
WritableScopeImpl typeParameters = new WritableScopeImpl(JetScope.Empty.INSTANCE$, module, RedeclarationHandler.THROW_EXCEPTION,
|
WritableScopeImpl typeParameters = new WritableScopeImpl(JetScope.Empty.INSTANCE$, module, RedeclarationHandler.THROW_EXCEPTION,
|
||||||
"Type parameter scope");
|
"Type parameter scope");
|
||||||
@@ -125,7 +125,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
|
|||||||
String typeParameterName = pair.first;
|
String typeParameterName = pair.first;
|
||||||
String replacementProjectionString = pair.second;
|
String replacementProjectionString = pair.second;
|
||||||
|
|
||||||
ClassifierDescriptor classifier = scope.getClassifier(Name.identifier(typeParameterName), LookupLocation.NO_LOCATION_FROM_TEST);
|
ClassifierDescriptor classifier = scope.getClassifier(Name.identifier(typeParameterName), NoLookupLocation.FROM_TEST);
|
||||||
assertNotNull("No type parameter named " + typeParameterName, classifier);
|
assertNotNull("No type parameter named " + typeParameterName, classifier);
|
||||||
assertTrue(typeParameterName + " is not a type parameter: " + classifier, classifier instanceof TypeParameterDescriptor);
|
assertTrue(typeParameterName + " is not a type parameter: " + classifier, classifier instanceof TypeParameterDescriptor);
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ public interface LookupLocation {
|
|||||||
@deprecated("Use more suitable constant if possible")
|
@deprecated("Use more suitable constant if possible")
|
||||||
val NO_LOCATION = NoLookupLocation.UNSORTED
|
val NO_LOCATION = NoLookupLocation.UNSORTED
|
||||||
val NO_LOCATION_FROM_BACKEND = NoLookupLocation.FROM_BACKEND
|
val NO_LOCATION_FROM_BACKEND = NoLookupLocation.FROM_BACKEND
|
||||||
val NO_LOCATION_FROM_TEST = NoLookupLocation.FROM_TEST
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCa
|
|||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor
|
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.psi.JetFile
|
import org.jetbrains.kotlin.psi.JetFile
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
@@ -43,7 +43,7 @@ public class KDocFinderTest() : LightPlatformCodeInsightFixtureTestCase() {
|
|||||||
myFixture.configureByFile(getTestName(false) + ".kt")
|
myFixture.configureByFile(getTestName(false) + ".kt")
|
||||||
val declaration = (myFixture.getFile() as JetFile).getDeclarations().single { it.getName() == "Bar" }
|
val declaration = (myFixture.getFile() as JetFile).getDeclarations().single { it.getName() == "Bar" }
|
||||||
val descriptor = declaration.resolveToDescriptor() as ClassDescriptor
|
val descriptor = declaration.resolveToDescriptor() as ClassDescriptor
|
||||||
val overriddenFunctionDescriptor = descriptor.defaultType.memberScope.getFunctions(Name.identifier("xyzzy"), LookupLocation.NO_LOCATION_FROM_TEST).single()
|
val overriddenFunctionDescriptor = descriptor.defaultType.memberScope.getFunctions(Name.identifier("xyzzy"), NoLookupLocation.FROM_TEST).single()
|
||||||
val doc = KDocFinder.findKDoc(overriddenFunctionDescriptor)
|
val doc = KDocFinder.findKDoc(overriddenFunctionDescriptor)
|
||||||
Assert.assertEquals("Doc for method xyzzy", doc!!.getContent())
|
Assert.assertEquals("Doc for method xyzzy", doc!!.getContent())
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ public class KDocFinderTest() : LightPlatformCodeInsightFixtureTestCase() {
|
|||||||
myFixture.configureByFile(getTestName(false) + ".kt")
|
myFixture.configureByFile(getTestName(false) + ".kt")
|
||||||
val declaration = (myFixture.getFile() as JetFile).getDeclarations().single { it.getName() == "Bar" }
|
val declaration = (myFixture.getFile() as JetFile).getDeclarations().single { it.getName() == "Bar" }
|
||||||
val descriptor = declaration.resolveToDescriptor() as ClassDescriptor
|
val descriptor = declaration.resolveToDescriptor() as ClassDescriptor
|
||||||
val overriddenFunctionDescriptor = descriptor.defaultType.memberScope.getFunctions(Name.identifier("xyzzy"), LookupLocation.NO_LOCATION_FROM_TEST).single()
|
val overriddenFunctionDescriptor = descriptor.defaultType.memberScope.getFunctions(Name.identifier("xyzzy"), NoLookupLocation.FROM_TEST).single()
|
||||||
val doc = KDocFinder.findKDoc(overriddenFunctionDescriptor)
|
val doc = KDocFinder.findKDoc(overriddenFunctionDescriptor)
|
||||||
Assert.assertEquals("Doc for method xyzzy", doc!!.getContent())
|
Assert.assertEquals("Doc for method xyzzy", doc!!.getContent())
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ public class KDocFinderTest() : LightPlatformCodeInsightFixtureTestCase() {
|
|||||||
myFixture.configureByFile(getTestName(false) + ".kt")
|
myFixture.configureByFile(getTestName(false) + ".kt")
|
||||||
val declaration = (myFixture.getFile() as JetFile).getDeclarations().single { it.getName() == "Foo" }
|
val declaration = (myFixture.getFile() as JetFile).getDeclarations().single { it.getName() == "Foo" }
|
||||||
val descriptor = declaration.resolveToDescriptor() as ClassDescriptor
|
val descriptor = declaration.resolveToDescriptor() as ClassDescriptor
|
||||||
val propertyDescriptor = descriptor.defaultType.memberScope.getProperties(Name.identifier("xyzzy"), LookupLocation.NO_LOCATION_FROM_TEST).single()
|
val propertyDescriptor = descriptor.defaultType.memberScope.getProperties(Name.identifier("xyzzy"), NoLookupLocation.FROM_TEST).single()
|
||||||
val doc = KDocFinder.findKDoc(propertyDescriptor)
|
val doc = KDocFinder.findKDoc(propertyDescriptor)
|
||||||
Assert.assertEquals("Doc for property xyzzy", doc!!.getContent())
|
Assert.assertEquals("Doc for property xyzzy", doc!!.getContent())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import org.jetbrains.kotlin.idea.search.allScope
|
|||||||
import org.jetbrains.kotlin.idea.test.DirectiveBasedActionUtils
|
import org.jetbrains.kotlin.idea.test.DirectiveBasedActionUtils
|
||||||
import org.jetbrains.kotlin.idea.test.KotlinMultiFileTestCase
|
import org.jetbrains.kotlin.idea.test.KotlinMultiFileTestCase
|
||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
import org.jetbrains.kotlin.name.*
|
import org.jetbrains.kotlin.name.*
|
||||||
import org.jetbrains.kotlin.psi.JetFile
|
import org.jetbrains.kotlin.psi.JetFile
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
||||||
@@ -186,13 +186,13 @@ public abstract class AbstractRenameTest : KotlinMultiFileTestCase() {
|
|||||||
private fun renameKotlinFunctionTest(renameParamsObject: JsonObject, context: TestContext) {
|
private fun renameKotlinFunctionTest(renameParamsObject: JsonObject, context: TestContext) {
|
||||||
val oldMethodName = Name.identifier(renameParamsObject.getString("oldName"))
|
val oldMethodName = Name.identifier(renameParamsObject.getString("oldName"))
|
||||||
|
|
||||||
doRenameInKotlinClassOrPackage(renameParamsObject, context) { it.getFunctions(oldMethodName, LookupLocation.NO_LOCATION_FROM_TEST).first() }
|
doRenameInKotlinClassOrPackage(renameParamsObject, context) { it.getFunctions(oldMethodName, NoLookupLocation.FROM_TEST).first() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renameKotlinPropertyTest(renameParamsObject: JsonObject, context: TestContext) {
|
private fun renameKotlinPropertyTest(renameParamsObject: JsonObject, context: TestContext) {
|
||||||
val oldPropertyName = Name.identifier(renameParamsObject.getString("oldName"))
|
val oldPropertyName = Name.identifier(renameParamsObject.getString("oldName"))
|
||||||
|
|
||||||
doRenameInKotlinClassOrPackage(renameParamsObject, context) { it.getProperties(oldPropertyName, LookupLocation.NO_LOCATION_FROM_TEST).first() }
|
doRenameInKotlinClassOrPackage(renameParamsObject, context) { it.getProperties(oldPropertyName, NoLookupLocation.FROM_TEST).first() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renameKotlinClassTest(renameParamsObject: JsonObject, context: TestContext) {
|
private fun renameKotlinClassTest(renameParamsObject: JsonObject, context: TestContext) {
|
||||||
|
|||||||
Reference in New Issue
Block a user