Created kind in LexicalScope

This commit is contained in:
Stanislav Erokhin
2015-11-05 16:19:06 +03:00
parent f06f557dae
commit 67abdd755f
26 changed files with 127 additions and 72 deletions
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform;
import org.jetbrains.kotlin.resolve.lazy.LazyResolveTestUtil;
import org.jetbrains.kotlin.resolve.scopes.ImportingScope;
import org.jetbrains.kotlin.resolve.scopes.LexicalScopeImpl;
import org.jetbrains.kotlin.resolve.scopes.LexicalScopeKind;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.tests.di.ContainerForTests;
@@ -139,7 +140,7 @@ public class ExpectedResolveDataUtil {
LexicalScopeImpl lexicalScope = new LexicalScopeImpl(ImportingScope.Empty.INSTANCE, classDescriptor, false,
classDescriptor.getThisAsReceiverParameter(),
"Scope with implicit this for class: " + classDescriptor);
LexicalScopeKind.SYNTHETIC);
ExpressionTypingContext context = ExpressionTypingContext.newContext(
new BindingTraceContext(), lexicalScope,
@@ -32,10 +32,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
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.LexicalScope;
import org.jetbrains.kotlin.resolve.scopes.LexicalScopeImpl;
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
import org.jetbrains.kotlin.resolve.scopes.RedeclarationHandler;
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;
@@ -96,7 +93,7 @@ public class DefaultModalityModifiersTest extends KotlinLiteFixture {
AnalysisResult bindingContext = JvmResolveUtil.analyzeOneFileWithJavaIntegrationAndCheckForErrors(file);
final DeclarationDescriptor classDescriptor = bindingContext.getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, aClass);
return new LexicalScopeImpl(ScopeUtilsKt.memberScopeAsImportingScope(libraryScope), root, false, null,
"JetDefaultModalityModifiersTest", RedeclarationHandler.DO_NOTHING,
LexicalScopeKind.SYNTHETIC, RedeclarationHandler.DO_NOTHING,
new Function1<LexicalScopeImpl.InitializeHandler, Unit>() {
@Override
public Unit invoke(LexicalScopeImpl.InitializeHandler handler) {
@@ -36,6 +36,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
import org.jetbrains.kotlin.resolve.lazy.LazyResolveTestUtil;
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
import org.jetbrains.kotlin.resolve.scopes.LexicalScopeImpl;
import org.jetbrains.kotlin.resolve.scopes.LexicalScopeKind;
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver;
import org.jetbrains.kotlin.test.ConfigurationKind;
import org.jetbrains.kotlin.test.KotlinLiteFixture;
@@ -562,7 +563,7 @@ public class KotlinTypeCheckerTest extends KotlinLiteFixture {
);
LexicalScope scope = new LexicalScopeImpl(scopeWithImports, scopeWithImports.getOwnerDescriptor(), false,
receiverParameterDescriptor, "Scope with receiver: " + thisType);
receiverParameterDescriptor, LexicalScopeKind.SYNTHETIC);
assertType(scope, expression, expectedType);
}
@@ -92,7 +92,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
LexicalScope topLevelScope = trace.get(BindingContext.LEXICAL_SCOPE, jetFile);
final ClassifierDescriptor contextClass = ScopeUtilsKt.findClassifier(topLevelScope, Name.identifier("___Context"), NoLookupLocation.FROM_TEST);
assert contextClass instanceof ClassDescriptor;
LexicalScope typeParameters = new LexicalScopeImpl(topLevelScope, module, false, null, "Type parameter scope",
LexicalScope typeParameters = new LexicalScopeImpl(topLevelScope, module, false, null, LexicalScopeKind.SYNTHETIC,
RedeclarationHandler.THROW_EXCEPTION,
new Function1<LexicalScopeImpl.InitializeHandler, Unit>() {
@Override
@@ -103,7 +103,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
return Unit.INSTANCE;
}
});
return new LexicalChainedScope(typeParameters, module, false, null, "TypeSubstitutorTest::getContextScope()",
return new LexicalChainedScope(typeParameters, module, false, null, LexicalScopeKind.SYNTHETIC,
new MemberScope[] {
contextClass.getDefaultType().getMemberScope(),
module.getBuiltIns().getBuiltInsPackageScope()
@@ -202,7 +202,7 @@ public class TypeUnifierTest extends KotlinLiteFixture {
private TypeProjection makeTypeProjection(MemberScope scope, String typeStr) {
LexicalScope withX = new LexicalScopeImpl(ScopeUtilsKt.memberScopeAsImportingScope(scope), builtIns.getBuiltInsModule(),
false, null, "With X", RedeclarationHandler.DO_NOTHING,
false, null, LexicalScopeKind.SYNTHETIC, RedeclarationHandler.DO_NOTHING,
new Function1<LexicalScopeImpl.InitializeHandler, Unit>() {
@Override
public Unit invoke(LexicalScopeImpl.InitializeHandler handler) {