Renamed KtScope to MemberScope
This commit is contained in:
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionCandidate
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.ResolutionTaskHolder
|
||||
import org.jetbrains.kotlin.resolve.scopes.KtScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.DeserializationContext
|
||||
import org.jetbrains.kotlin.serialization.deserialization.TypeDeserializer
|
||||
@@ -62,7 +62,7 @@ class LazyOperationsLog(
|
||||
public fun getText(): String {
|
||||
val groupedByOwner = records.groupByTo(IdentityHashMap()) {
|
||||
val owner = it.data.fieldOwner
|
||||
if (owner is KtScope) owner.getContainingDeclaration() else owner
|
||||
if (owner is MemberScope) owner.getContainingDeclaration() else owner
|
||||
}.map { Pair(it.getKey(), it.getValue()) }
|
||||
|
||||
return groupedByOwner.map {
|
||||
@@ -118,7 +118,7 @@ class LazyOperationsLog(
|
||||
|
||||
sb.append(" = ${render(data.result)}")
|
||||
|
||||
if (data.fieldOwner is KtScope) {
|
||||
if (data.fieldOwner is MemberScope) {
|
||||
sb.append(" // through ${render(data.fieldOwner)}")
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -37,7 +37,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.kotlinSignature.TypeTransformingVisitor;
|
||||
import org.jetbrains.kotlin.resolve.lazy.LazyResolveTestUtil;
|
||||
import org.jetbrains.kotlin.resolve.scopes.KtScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
@@ -155,7 +155,7 @@ public abstract class AbstractSdkAnnotationsValidityTest extends UsefulTestCase
|
||||
return null;
|
||||
}
|
||||
|
||||
private Void visitDeclarationRecursively(@NotNull DeclarationDescriptor descriptor, @NotNull KtScope memberScope) {
|
||||
private Void visitDeclarationRecursively(@NotNull DeclarationDescriptor descriptor, @NotNull MemberScope memberScope) {
|
||||
for (DeclarationDescriptor member : DescriptorUtils.getAllDescriptors(memberScope)) {
|
||||
member.acceptVoid(this);
|
||||
}
|
||||
|
||||
+4
-4
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.jvm.compiler
|
||||
|
||||
import org.jetbrains.kotlin.resolve.scopes.KtScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedMemberScope
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
@@ -28,13 +28,13 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.resolve.MemberComparator
|
||||
|
||||
class DeserializedScopeValidationVisitor : ValidationVisitor() {
|
||||
override fun validateScope(scope: KtScope, collector: DescriptorValidator.DiagnosticCollector) {
|
||||
override fun validateScope(scope: MemberScope, collector: DescriptorValidator.DiagnosticCollector) {
|
||||
super.validateScope(scope, collector)
|
||||
validateDeserializedScope(scope)
|
||||
}
|
||||
}
|
||||
|
||||
private fun validateDeserializedScope(scope: KtScope) {
|
||||
private fun validateDeserializedScope(scope: MemberScope) {
|
||||
val isPackageViewScope = scope.safeGetContainingDeclaration() is PackageViewDescriptor
|
||||
if (scope is DeserializedMemberScope || isPackageViewScope) {
|
||||
val relevantDescriptors = scope.getDescriptors().filter { member ->
|
||||
@@ -45,7 +45,7 @@ private fun validateDeserializedScope(scope: KtScope) {
|
||||
}
|
||||
|
||||
//NOTE: see TypeUtils#IntersectionScope#getContainingDeclaration()
|
||||
private fun KtScope.safeGetContainingDeclaration(): DeclarationDescriptor? {
|
||||
private fun MemberScope.safeGetContainingDeclaration(): DeclarationDescriptor? {
|
||||
return try {
|
||||
getContainingDeclaration()
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.resolve.scopes.KtScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ExpectedLoadErrorsUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Void visitDeclarationRecursively(@NotNull DeclarationDescriptor descriptor, @NotNull KtScope memberScope) {
|
||||
private Void visitDeclarationRecursively(@NotNull DeclarationDescriptor descriptor, @NotNull MemberScope memberScope) {
|
||||
for (DeclarationDescriptor member : DescriptorUtils.getAllDescriptors(memberScope)) {
|
||||
member.acceptVoid(this);
|
||||
}
|
||||
|
||||
+5
-5
@@ -142,7 +142,7 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
|
||||
val generatedPackageDir = File(tmpdir, LoadDescriptorUtil.TEST_PACKAGE_FQNAME.pathSegments().single().asString())
|
||||
val allClassFiles = FileUtil.findFilesByMask(Pattern.compile(".*\\.class"), generatedPackageDir)
|
||||
|
||||
val packageScopes = arrayListOf<KtScope>()
|
||||
val packageScopes = arrayListOf<MemberScope>()
|
||||
val classes = arrayListOf<ClassDescriptor>()
|
||||
var shouldAddPackageView = false
|
||||
for (classFile in allClassFiles) {
|
||||
@@ -186,9 +186,9 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
|
||||
}
|
||||
|
||||
private class SyntheticPackageViewForTest(override val module: ModuleDescriptor,
|
||||
packageScopes: List<KtScope>,
|
||||
packageScopes: List<MemberScope>,
|
||||
classes: List<ClassifierDescriptor>) : PackageViewDescriptor {
|
||||
private val scope: KtScope
|
||||
private val scope: MemberScope
|
||||
|
||||
init {
|
||||
scope = ChainedScope(this, "synthetic package view for test", ScopeWithClassifiers(classes, this), *packageScopes.toTypedArray())
|
||||
@@ -196,7 +196,7 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
|
||||
|
||||
override val fqName: FqName
|
||||
get() = LoadDescriptorUtil.TEST_PACKAGE_FQNAME
|
||||
override val memberScope: KtScope
|
||||
override val memberScope: MemberScope
|
||||
get() = scope
|
||||
override fun <R, D> accept(visitor: DeclarationDescriptorVisitor<R, D>, data: D): R =
|
||||
visitor.visitPackageViewDescriptor(this, data)
|
||||
@@ -214,7 +214,7 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
|
||||
private class ScopeWithClassifiers(
|
||||
classifiers: List<ClassifierDescriptor>,
|
||||
val ownerDescriptor: DeclarationDescriptor
|
||||
) : KtScopeImpl() {
|
||||
) : MemberScopeImpl() {
|
||||
override fun getContainingDeclaration() = ownerDescriptor
|
||||
|
||||
private val classifierMap = HashMap<Name, ClassifierDescriptor>()
|
||||
|
||||
+6
-6
@@ -42,7 +42,7 @@ import org.jetbrains.kotlin.renderer.DescriptorRendererOptions;
|
||||
import org.jetbrains.kotlin.renderer.NameShortness;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.scopes.KtScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||
import org.jetbrains.kotlin.test.KotlinLiteFixture;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.types.TypeProjection;
|
||||
@@ -168,7 +168,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends KotlinLite
|
||||
@NotNull
|
||||
protected static FunctionDescriptor getFunctionDescriptor(@NotNull PackageFragmentDescriptor packageView, @NotNull String name) {
|
||||
Name functionName = Name.identifier(name);
|
||||
KtScope memberScope = packageView.getMemberScope();
|
||||
MemberScope memberScope = packageView.getMemberScope();
|
||||
Collection<FunctionDescriptor> functions = memberScope.getFunctions(functionName, NoLookupLocation.FROM_TEST);
|
||||
assert functions.size() == 1 : "Failed to find function " + functionName + " in class" + "." + packageView.getName();
|
||||
return functions.iterator().next();
|
||||
@@ -177,7 +177,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends KotlinLite
|
||||
@NotNull
|
||||
private static FunctionDescriptor getFunctionDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) {
|
||||
Name functionName = Name.identifier(name);
|
||||
KtScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||
MemberScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||
Collection<FunctionDescriptor> functions = memberScope.getFunctions(functionName, NoLookupLocation.FROM_TEST);
|
||||
assert functions.size() == 1 : "Failed to find function " + functionName + " in class" + "." + classDescriptor.getName();
|
||||
return functions.iterator().next();
|
||||
@@ -186,7 +186,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends KotlinLite
|
||||
@Nullable
|
||||
protected static PropertyDescriptor getPropertyDescriptor(@NotNull PackageFragmentDescriptor packageView, @NotNull String name, boolean failOnMissing) {
|
||||
Name propertyName = Name.identifier(name);
|
||||
KtScope memberScope = packageView.getMemberScope();
|
||||
MemberScope memberScope = packageView.getMemberScope();
|
||||
Collection<PropertyDescriptor> properties = memberScope.getProperties(propertyName, NoLookupLocation.FROM_TEST);
|
||||
if (properties.isEmpty()) {
|
||||
for (DeclarationDescriptor descriptor : DescriptorUtils.getAllDescriptors(memberScope)) {
|
||||
@@ -213,7 +213,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends KotlinLite
|
||||
@NotNull
|
||||
private static PropertyDescriptor getPropertyDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) {
|
||||
Name propertyName = Name.identifier(name);
|
||||
KtScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||
MemberScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||
Collection<PropertyDescriptor> properties = memberScope.getProperties(propertyName, NoLookupLocation.FROM_TEST);
|
||||
assert properties.size() == 1 : "Failed to find property " + propertyName + " in class " + classDescriptor.getName();
|
||||
return properties.iterator().next();
|
||||
@@ -231,7 +231,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends KotlinLite
|
||||
@NotNull
|
||||
private static ClassDescriptor getInnerClassDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) {
|
||||
Name propertyName = Name.identifier(name);
|
||||
KtScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||
MemberScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||
ClassifierDescriptor innerClass = memberScope.getClassifier(propertyName, NoLookupLocation.FROM_TEST);
|
||||
assert innerClass instanceof ClassDescriptor : "Failed to find inner class " +
|
||||
propertyName +
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.TypeResolver
|
||||
import org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstructor
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.resolve.scopes.KtScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
@@ -66,7 +66,7 @@ public class ConstraintSystemTestData(
|
||||
val number = matcher.group(1)!!
|
||||
return KotlinTypeImpl.create(
|
||||
Annotations.EMPTY, IntegerValueTypeConstructor(number.toLong(), functionFoo.builtIns), false, listOf(),
|
||||
KtScope.empty(functionFoo)
|
||||
MemberScope.empty(functionFoo)
|
||||
)
|
||||
}
|
||||
return typeResolver.resolveType(
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.scopes.KtScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.junit.Assert;
|
||||
|
||||
@@ -84,7 +84,7 @@ public class DescriptorValidator {
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void validateScope(@NotNull KtScope scope, @NotNull DiagnosticCollector collector) {
|
||||
protected void validateScope(@NotNull MemberScope scope, @NotNull DiagnosticCollector collector) {
|
||||
for (DeclarationDescriptor descriptor : DescriptorUtils.getAllDescriptors(scope)) {
|
||||
if (recursiveFilter.apply(descriptor)) {
|
||||
descriptor.accept(new ScopeValidatorVisitor(collector), scope);
|
||||
@@ -358,7 +358,7 @@ public class DescriptorValidator {
|
||||
|
||||
}
|
||||
|
||||
private static class ScopeValidatorVisitor implements DeclarationDescriptorVisitor<Void, KtScope> {
|
||||
private static class ScopeValidatorVisitor implements DeclarationDescriptorVisitor<Void, MemberScope> {
|
||||
private final DiagnosticCollector collector;
|
||||
|
||||
public ScopeValidatorVisitor(DiagnosticCollector collector) {
|
||||
@@ -370,7 +370,7 @@ public class DescriptorValidator {
|
||||
}
|
||||
|
||||
private void assertFound(
|
||||
@NotNull KtScope scope,
|
||||
@NotNull MemberScope scope,
|
||||
@NotNull DeclarationDescriptor expected,
|
||||
@Nullable DeclarationDescriptor found,
|
||||
boolean shouldBeSame
|
||||
@@ -384,7 +384,7 @@ public class DescriptorValidator {
|
||||
}
|
||||
|
||||
private void assertFound(
|
||||
@NotNull KtScope scope,
|
||||
@NotNull MemberScope scope,
|
||||
@NotNull DeclarationDescriptor expected,
|
||||
@NotNull Collection<? extends DeclarationDescriptor> found
|
||||
) {
|
||||
@@ -395,14 +395,14 @@ public class DescriptorValidator {
|
||||
|
||||
@Override
|
||||
public Void visitPackageFragmentDescriptor(
|
||||
PackageFragmentDescriptor descriptor, KtScope scope
|
||||
PackageFragmentDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visitPackageViewDescriptor(
|
||||
PackageViewDescriptor descriptor, KtScope scope
|
||||
PackageViewDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
assertFound(scope, descriptor, scope.getPackage(descriptor.getName()), false);
|
||||
return null;
|
||||
@@ -410,7 +410,7 @@ public class DescriptorValidator {
|
||||
|
||||
@Override
|
||||
public Void visitVariableDescriptor(
|
||||
VariableDescriptor descriptor, KtScope scope
|
||||
VariableDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
assertFound(scope, descriptor, scope.getProperties(descriptor.getName(), NoLookupLocation.FROM_TEST));
|
||||
return null;
|
||||
@@ -418,7 +418,7 @@ public class DescriptorValidator {
|
||||
|
||||
@Override
|
||||
public Void visitFunctionDescriptor(
|
||||
FunctionDescriptor descriptor, KtScope scope
|
||||
FunctionDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
assertFound(scope, descriptor, scope.getFunctions(descriptor.getName(), NoLookupLocation.FROM_TEST));
|
||||
return null;
|
||||
@@ -426,7 +426,7 @@ public class DescriptorValidator {
|
||||
|
||||
@Override
|
||||
public Void visitTypeParameterDescriptor(
|
||||
TypeParameterDescriptor descriptor, KtScope scope
|
||||
TypeParameterDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), NoLookupLocation.FROM_TEST), true);
|
||||
return null;
|
||||
@@ -434,7 +434,7 @@ public class DescriptorValidator {
|
||||
|
||||
@Override
|
||||
public Void visitClassDescriptor(
|
||||
ClassDescriptor descriptor, KtScope scope
|
||||
ClassDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
assertFound(scope, descriptor, scope.getClassifier(descriptor.getName(), NoLookupLocation.FROM_TEST), true);
|
||||
return null;
|
||||
@@ -442,7 +442,7 @@ public class DescriptorValidator {
|
||||
|
||||
@Override
|
||||
public Void visitModuleDeclaration(
|
||||
ModuleDescriptor descriptor, KtScope scope
|
||||
ModuleDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
report(descriptor, "Module found in scope: " + scope);
|
||||
return null;
|
||||
@@ -450,7 +450,7 @@ public class DescriptorValidator {
|
||||
|
||||
@Override
|
||||
public Void visitConstructorDescriptor(
|
||||
ConstructorDescriptor descriptor, KtScope scope
|
||||
ConstructorDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
report(descriptor, "Constructor found in scope: " + scope);
|
||||
return null;
|
||||
@@ -458,7 +458,7 @@ public class DescriptorValidator {
|
||||
|
||||
@Override
|
||||
public Void visitScriptDescriptor(
|
||||
ScriptDescriptor descriptor, KtScope scope
|
||||
ScriptDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
report(descriptor, "Script found in scope: " + scope);
|
||||
return null;
|
||||
@@ -466,21 +466,21 @@ public class DescriptorValidator {
|
||||
|
||||
@Override
|
||||
public Void visitPropertyDescriptor(
|
||||
PropertyDescriptor descriptor, KtScope scope
|
||||
PropertyDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
return visitVariableDescriptor(descriptor, scope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visitValueParameterDescriptor(
|
||||
ValueParameterDescriptor descriptor, KtScope scope
|
||||
ValueParameterDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
return visitVariableDescriptor(descriptor, scope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visitPropertyGetterDescriptor(
|
||||
PropertyGetterDescriptor descriptor, KtScope scope
|
||||
PropertyGetterDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
report(descriptor, "Getter found in scope: " + scope);
|
||||
return null;
|
||||
@@ -488,7 +488,7 @@ public class DescriptorValidator {
|
||||
|
||||
@Override
|
||||
public Void visitPropertySetterDescriptor(
|
||||
PropertySetterDescriptor descriptor, KtScope scope
|
||||
PropertySetterDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
report(descriptor, "Setter found in scope: " + scope);
|
||||
return null;
|
||||
@@ -496,7 +496,7 @@ public class DescriptorValidator {
|
||||
|
||||
@Override
|
||||
public Void visitReceiverParameterDescriptor(
|
||||
ReceiverParameterDescriptor descriptor, KtScope scope
|
||||
ReceiverParameterDescriptor descriptor, MemberScope scope
|
||||
) {
|
||||
report(descriptor, "Receiver parameter found in scope: " + scope);
|
||||
return null;
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.renderer.*;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.MemberComparator;
|
||||
import org.jetbrains.kotlin.resolve.scopes.KtScope;
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.utils.Printer;
|
||||
import org.junit.Assert;
|
||||
@@ -128,7 +128,7 @@ public class RecursiveDescriptorComparator {
|
||||
ClassDescriptor klass = (ClassDescriptor) descriptor;
|
||||
appendSubDescriptors(descriptor, module,
|
||||
klass.getDefaultType().getMemberScope(), klass.getConstructors(), printer);
|
||||
KtScope staticScope = klass.getStaticScope();
|
||||
MemberScope staticScope = klass.getStaticScope();
|
||||
if (!DescriptorUtils.getAllDescriptors(staticScope).isEmpty()) {
|
||||
printer.println();
|
||||
printer.println("// Static members");
|
||||
@@ -185,7 +185,7 @@ public class RecursiveDescriptorComparator {
|
||||
private void appendSubDescriptors(
|
||||
@NotNull DeclarationDescriptor descriptor,
|
||||
@NotNull ModuleDescriptor module,
|
||||
@NotNull KtScope memberScope,
|
||||
@NotNull MemberScope memberScope,
|
||||
@NotNull Collection<? extends DeclarationDescriptor> extraSubDescriptors,
|
||||
@NotNull Printer printer
|
||||
) {
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil;
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession;
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProviderFactory;
|
||||
import org.jetbrains.kotlin.resolve.scopes.*;
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.ScopeUtilsKt;
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||
import org.jetbrains.kotlin.test.KotlinLiteFixture;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
@@ -84,7 +83,7 @@ public class DefaultModalityModifiersTest extends KotlinLiteFixture {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private LexicalScope createScope(@NotNull KtScope libraryScope) {
|
||||
private LexicalScope createScope(@NotNull MemberScope libraryScope) {
|
||||
KtFile file = KtPsiFactoryKt
|
||||
.KtPsiFactory(getProject()).createFile("abstract class C { abstract fun foo(); abstract val a: Int }");
|
||||
List<KtDeclaration> declarations = file.getDeclarations();
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages;
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.psi.KtPsiFactoryKt;
|
||||
@@ -105,7 +104,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
|
||||
}
|
||||
});
|
||||
return new LexicalChainedScope(typeParameters, module, false, null, "TypeSubstitutorTest::getContextScope()",
|
||||
new KtScope[] {
|
||||
new MemberScope[] {
|
||||
contextClass.getDefaultType().getMemberScope(),
|
||||
module.getBuiltIns().getBuiltInsPackageScope()
|
||||
});
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.jetbrains.kotlin.psi.KtTypeProjection;
|
||||
import org.jetbrains.kotlin.psi.KtTypeReference;
|
||||
import org.jetbrains.kotlin.resolve.TypeResolver;
|
||||
import org.jetbrains.kotlin.resolve.scopes.*;
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.ScopeUtilsKt;
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||
import org.jetbrains.kotlin.test.KotlinLiteFixture;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
@@ -200,7 +199,7 @@ public class TypeUnifierTest extends KotlinLiteFixture {
|
||||
return makeTypeProjection(builtIns.getBuiltInsPackageScope(), typeStr);
|
||||
}
|
||||
|
||||
private TypeProjection makeTypeProjection(KtScope scope, String typeStr) {
|
||||
private TypeProjection makeTypeProjection(MemberScope scope, String typeStr) {
|
||||
LexicalScope withX = new LexicalScopeImpl(TypeTestUtilsKt.asLexicalScope(scope), scope.getContainingDeclaration(),
|
||||
false, null, "With X", RedeclarationHandler.DO_NOTHING,
|
||||
new Function1<LexicalScopeImpl.InitializeHandler, Unit>() {
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
package org.jetbrains.kotlin.types
|
||||
|
||||
import org.jetbrains.kotlin.resolve.scopes.BaseLexicalScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.KtScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.memberScopeAsImportingScope
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
|
||||
public fun KtScope.asLexicalScope(): LexicalScope {
|
||||
public fun MemberScope.asLexicalScope(): LexicalScope {
|
||||
val importingScope = memberScopeAsImportingScope()
|
||||
return object : BaseLexicalScope(importingScope, getContainingDeclaration()) {
|
||||
override fun printStructure(p: Printer) {
|
||||
|
||||
Reference in New Issue
Block a user