[FE] Add context receivers to scope

This commit is contained in:
Anastasiya Shadrina
2021-02-16 23:47:56 +07:00
committed by TeamCityServer
parent c5687e080d
commit d923c95671
27 changed files with 166 additions and 59 deletions
@@ -100,7 +100,7 @@ public class DefaultModalityModifiersTest extends KotlinTestWithEnvironment {
DeclarationDescriptor classDescriptor =
bindingContext.getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, aClass);
return new LexicalScopeImpl(
ScopeUtilsKt.memberScopeAsImportingScope(libraryScope), root, false, null,
ScopeUtilsKt.memberScopeAsImportingScope(libraryScope), root, false, Collections.emptyList(),
LexicalScopeKind.SYNTHETIC, LocalRedeclarationChecker.DO_NOTHING.INSTANCE,
handler -> {
handler.addClassifierDescriptor((ClassifierDescriptor) classDescriptor);
@@ -551,7 +551,7 @@ public class KotlinTypeCheckerTest extends KotlinTestWithEnvironment {
);
LexicalScope scope = new LexicalScopeImpl(scopeWithImports, scopeWithImports.getOwnerDescriptor(), false,
receiverParameterDescriptor, LexicalScopeKind.SYNTHETIC);
Collections.singletonList(receiverParameterDescriptor), LexicalScopeKind.SYNTHETIC);
assertType(scope, expression, expectedType);
}
@@ -48,6 +48,7 @@ import org.jetbrains.kotlin.tests.di.InjectionKt;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -90,7 +91,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
LocalRedeclarationChecker redeclarationChecker =
new ThrowingLocalRedeclarationChecker(new OverloadChecker(TypeSpecificityComparator.NONE.INSTANCE));
LexicalScope typeParameters = new LexicalScopeImpl(
topLevelScope, module, false, null, LexicalScopeKind.SYNTHETIC,
topLevelScope, module, false, Collections.emptyList(), LexicalScopeKind.SYNTHETIC,
redeclarationChecker,
handler -> {
for (TypeParameterDescriptor parameterDescriptor : contextClass.getTypeConstructor().getParameters()) {
@@ -100,7 +101,7 @@ public class TypeSubstitutorTest extends KotlinTestWithEnvironment {
}
);
return LexicalChainedScope.Companion.create(
typeParameters, module, false, null, LexicalScopeKind.SYNTHETIC,
typeParameters, module, false, Collections.emptyList(), LexicalScopeKind.SYNTHETIC,
contextClass.getDefaultType().getMemberScope(),
module.getBuiltIns().getBuiltInsPackageScope()
);
@@ -42,6 +42,7 @@ import org.jetbrains.kotlin.test.ConfigurationKind;
import org.jetbrains.kotlin.test.DummyTraces;
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -197,7 +198,7 @@ public class TypeUnifierTest extends KotlinTestWithEnvironment {
private TypeProjection makeType(String typeStr) {
LexicalScope withX = new LexicalScopeImpl(
builtinsImportingScope, module,
false, null, LexicalScopeKind.SYNTHETIC, LocalRedeclarationChecker.DO_NOTHING.INSTANCE,
false, Collections.emptyList(), LexicalScopeKind.SYNTHETIC, LocalRedeclarationChecker.DO_NOTHING.INSTANCE,
handler -> {
handler.addClassifierDescriptor(x);
handler.addClassifierDescriptor(y);