Refactoring: extract test dummy traces
This commit is contained in:
+3
-4
@@ -27,11 +27,10 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.TypeResolver
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant
|
||||
import org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstructor
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.DummyTraces
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.KotlinTypeFactory
|
||||
import java.util.regex.Pattern
|
||||
@@ -76,8 +75,8 @@ class ConstraintSystemTestData(
|
||||
)
|
||||
}
|
||||
return typeResolver.resolveType(
|
||||
scopeToResolveTypeParameters, KtPsiFactory(project).createType(name),
|
||||
KotlinTestUtils.DUMMY_TRACE, true)
|
||||
scopeToResolveTypeParameters, KtPsiFactory(project).createType(name),
|
||||
DummyTraces.DUMMY_TRACE, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.diagnostics.Severity;
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages;
|
||||
import org.jetbrains.kotlin.psi.KtExpression;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.expressions.KotlinTypeInfo;
|
||||
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice;
|
||||
import org.jetbrains.kotlin.util.slicedMap.SlicedMap;
|
||||
import org.jetbrains.kotlin.util.slicedMap.WritableSlice;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class DummyTraces {
|
||||
public static final BindingTrace DUMMY_TRACE = new BindingTrace() {
|
||||
@NotNull
|
||||
@Override
|
||||
public BindingContext getBindingContext() {
|
||||
return new BindingContext() {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Diagnostics getDiagnostics() {
|
||||
return Diagnostics.Companion.getEMPTY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
return DUMMY_TRACE.get(slice, key);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <K, V> Collection<K> getKeys(WritableSlice<K, V> slice) {
|
||||
return DUMMY_TRACE.getKeys(slice);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@TestOnly
|
||||
@Override
|
||||
public <K, V> ImmutableMap<K, V> getSliceContents(@NotNull ReadOnlySlice<K, V> slice) {
|
||||
return ImmutableMap.of();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public KotlinType getType(@NotNull KtExpression expression) {
|
||||
return DUMMY_TRACE.getType(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOwnDataTo(@NotNull BindingTrace trace, boolean commitDiagnostics) {
|
||||
// do nothing
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> void record(WritableSlice<K, V> slice, K key, V value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K> void record(WritableSlice<K, Boolean> slice, K key) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
if (slice == BindingContext.PROCESSED) return (V) Boolean.FALSE;
|
||||
return SlicedMap.DO_NOTHING.get(slice, key);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <K, V> Collection<K> getKeys(WritableSlice<K, V> slice) {
|
||||
assert slice.isCollective();
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public KotlinType getType(@NotNull KtExpression expression) {
|
||||
KotlinTypeInfo typeInfo = get(BindingContext.EXPRESSION_TYPE_INFO, expression);
|
||||
return typeInfo != null ? typeInfo.getType() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordType(@NotNull KtExpression expression, @Nullable KotlinType type) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void report(@NotNull Diagnostic diagnostic) {
|
||||
if (Errors.UNRESOLVED_REFERENCE_DIAGNOSTICS.contains(diagnostic.getFactory())) {
|
||||
throw new IllegalStateException("Unresolved: " + diagnostic.getPsiElement().getText());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wantsDiagnostics() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
public static BindingTrace DUMMY_EXCEPTION_ON_ERROR_TRACE = new BindingTrace() {
|
||||
@NotNull
|
||||
@Override
|
||||
public BindingContext getBindingContext() {
|
||||
return new BindingContext() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Diagnostics getDiagnostics() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
return DUMMY_EXCEPTION_ON_ERROR_TRACE.get(slice, key);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <K, V> Collection<K> getKeys(WritableSlice<K, V> slice) {
|
||||
return DUMMY_EXCEPTION_ON_ERROR_TRACE.getKeys(slice);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@TestOnly
|
||||
@Override
|
||||
public <K, V> ImmutableMap<K, V> getSliceContents(@NotNull ReadOnlySlice<K, V> slice) {
|
||||
return ImmutableMap.of();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public KotlinType getType(@NotNull KtExpression expression) {
|
||||
return DUMMY_EXCEPTION_ON_ERROR_TRACE.getType(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOwnDataTo(@NotNull BindingTrace trace, boolean commitDiagnostics) {
|
||||
// do nothing
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> void record(WritableSlice<K, V> slice, K key, V value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K> void record(WritableSlice<K, Boolean> slice, K key) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <K, V> Collection<K> getKeys(WritableSlice<K, V> slice) {
|
||||
assert slice.isCollective();
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public KotlinType getType(@NotNull KtExpression expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordType(@NotNull KtExpression expression, @Nullable KotlinType type) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void report(@NotNull Diagnostic diagnostic) {
|
||||
if (diagnostic.getSeverity() == Severity.ERROR) {
|
||||
throw new IllegalStateException(DefaultErrorMessages.render(diagnostic));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wantsDiagnostics() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
@@ -36,7 +35,6 @@ import kotlin.text.StringsKt;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.kotlin.CoroutineTestUtilKt;
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult;
|
||||
import org.jetbrains.kotlin.builtins.DefaultBuiltIns;
|
||||
@@ -55,28 +53,15 @@ import org.jetbrains.kotlin.cli.jvm.config.JvmContentRootsKt;
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
|
||||
import org.jetbrains.kotlin.config.*;
|
||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.diagnostics.Severity;
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages;
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
||||
import org.jetbrains.kotlin.jvm.compiler.LoadDescriptorUtil;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.KtExpression;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.psi.KtPsiFactoryKt;
|
||||
import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics;
|
||||
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil;
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
import org.jetbrains.kotlin.test.util.JetTestUtilsKt;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.expressions.KotlinTypeInfo;
|
||||
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice;
|
||||
import org.jetbrains.kotlin.util.slicedMap.SlicedMap;
|
||||
import org.jetbrains.kotlin.util.slicedMap.WritableSlice;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
import org.junit.Assert;
|
||||
|
||||
@@ -130,180 +115,6 @@ public class KotlinTestUtils {
|
||||
private static final Pattern DIRECTIVE_PATTERN = Pattern.compile("^//\\s*!([\\w_]+)(:\\s*(.*)$)?", Pattern.MULTILINE);
|
||||
private static final Pattern LINE_SEPARATOR_PATTERN = Pattern.compile("\\r\\n|\\r|\\n");
|
||||
|
||||
public static final BindingTrace DUMMY_TRACE = new BindingTrace() {
|
||||
@NotNull
|
||||
@Override
|
||||
public BindingContext getBindingContext() {
|
||||
return new BindingContext() {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Diagnostics getDiagnostics() {
|
||||
return Diagnostics.Companion.getEMPTY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
return DUMMY_TRACE.get(slice, key);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <K, V> Collection<K> getKeys(WritableSlice<K, V> slice) {
|
||||
return DUMMY_TRACE.getKeys(slice);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@TestOnly
|
||||
@Override
|
||||
public <K, V> ImmutableMap<K, V> getSliceContents(@NotNull ReadOnlySlice<K, V> slice) {
|
||||
return ImmutableMap.of();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public KotlinType getType(@NotNull KtExpression expression) {
|
||||
return DUMMY_TRACE.getType(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOwnDataTo(@NotNull BindingTrace trace, boolean commitDiagnostics) {
|
||||
// do nothing
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> void record(WritableSlice<K, V> slice, K key, V value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K> void record(WritableSlice<K, Boolean> slice, K key) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
if (slice == BindingContext.PROCESSED) return (V) Boolean.FALSE;
|
||||
return SlicedMap.DO_NOTHING.get(slice, key);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <K, V> Collection<K> getKeys(WritableSlice<K, V> slice) {
|
||||
assert slice.isCollective();
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public KotlinType getType(@NotNull KtExpression expression) {
|
||||
KotlinTypeInfo typeInfo = get(BindingContext.EXPRESSION_TYPE_INFO, expression);
|
||||
return typeInfo != null ? typeInfo.getType() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordType(@NotNull KtExpression expression, @Nullable KotlinType type) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void report(@NotNull Diagnostic diagnostic) {
|
||||
if (Errors.UNRESOLVED_REFERENCE_DIAGNOSTICS.contains(diagnostic.getFactory())) {
|
||||
throw new IllegalStateException("Unresolved: " + diagnostic.getPsiElement().getText());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wantsDiagnostics() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
public static BindingTrace DUMMY_EXCEPTION_ON_ERROR_TRACE = new BindingTrace() {
|
||||
@NotNull
|
||||
@Override
|
||||
public BindingContext getBindingContext() {
|
||||
return new BindingContext() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Diagnostics getDiagnostics() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
return DUMMY_EXCEPTION_ON_ERROR_TRACE.get(slice, key);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <K, V> Collection<K> getKeys(WritableSlice<K, V> slice) {
|
||||
return DUMMY_EXCEPTION_ON_ERROR_TRACE.getKeys(slice);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@TestOnly
|
||||
@Override
|
||||
public <K, V> ImmutableMap<K, V> getSliceContents(@NotNull ReadOnlySlice<K, V> slice) {
|
||||
return ImmutableMap.of();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public KotlinType getType(@NotNull KtExpression expression) {
|
||||
return DUMMY_EXCEPTION_ON_ERROR_TRACE.getType(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOwnDataTo(@NotNull BindingTrace trace, boolean commitDiagnostics) {
|
||||
// do nothing
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> void record(WritableSlice<K, V> slice, K key, V value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K> void record(WritableSlice<K, Boolean> slice, K key) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <K, V> Collection<K> getKeys(WritableSlice<K, V> slice) {
|
||||
assert slice.isCollective();
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public KotlinType getType(@NotNull KtExpression expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordType(@NotNull KtExpression expression, @Nullable KotlinType type) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void report(@NotNull Diagnostic diagnostic) {
|
||||
if (diagnostic.getSeverity() == Severity.ERROR) {
|
||||
throw new IllegalStateException(DefaultErrorMessages.render(diagnostic));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wantsDiagnostics() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
private KotlinTestUtils() {
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProvid
|
||||
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.DummyTraces;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment;
|
||||
import org.jetbrains.kotlin.tests.di.ContainerForTests;
|
||||
@@ -143,7 +144,7 @@ public class DefaultModalityModifiersTest extends KotlinTestWithEnvironment {
|
||||
KtNamedFunction function = (KtNamedFunction) declarations.get(0);
|
||||
SimpleFunctionDescriptor functionDescriptor =
|
||||
functionDescriptorResolver.resolveFunctionDescriptor(classDescriptor, scope, function,
|
||||
KotlinTestUtils.DUMMY_TRACE, DataFlowInfoFactory.EMPTY);
|
||||
DummyTraces.DUMMY_TRACE, DataFlowInfoFactory.EMPTY);
|
||||
|
||||
assertEquals(expectedFunctionModality, functionDescriptor.getModality());
|
||||
}
|
||||
@@ -156,7 +157,7 @@ public class DefaultModalityModifiersTest extends KotlinTestWithEnvironment {
|
||||
KtProperty property = (KtProperty) declarations.get(0);
|
||||
PropertyDescriptor propertyDescriptor = descriptorResolver.resolvePropertyDescriptor(
|
||||
classDescriptor, scope, scope, property,
|
||||
KotlinTestUtils.DUMMY_TRACE, DataFlowInfoFactory.EMPTY,
|
||||
DummyTraces.DUMMY_TRACE, DataFlowInfoFactory.EMPTY,
|
||||
InferenceSession.Companion.getDefault()
|
||||
);
|
||||
|
||||
@@ -172,7 +173,7 @@ public class DefaultModalityModifiersTest extends KotlinTestWithEnvironment {
|
||||
KtProperty property = (KtProperty) declarations.get(0);
|
||||
PropertyDescriptor propertyDescriptor = descriptorResolver.resolvePropertyDescriptor(
|
||||
classDescriptor, scope, scope, property,
|
||||
KotlinTestUtils.DUMMY_TRACE, DataFlowInfoFactory.EMPTY,
|
||||
DummyTraces.DUMMY_TRACE, DataFlowInfoFactory.EMPTY,
|
||||
InferenceSession.Companion.getDefault()
|
||||
);
|
||||
PropertyAccessorDescriptor propertyAccessor = isGetter
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory;
|
||||
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil;
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.DummyTraces;
|
||||
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment;
|
||||
|
||||
public class KotlinOverloadTest extends KotlinTestWithEnvironment {
|
||||
@@ -171,7 +171,7 @@ public class KotlinOverloadTest extends KotlinTestWithEnvironment {
|
||||
KtNamedFunction function = KtPsiFactoryKt.KtPsiFactory(getProject()).createFunction(funDecl);
|
||||
LexicalScope scope = TypeTestUtilsKt.builtInPackageAsLexicalScope(module);
|
||||
return functionDescriptorResolver.resolveFunctionDescriptor(
|
||||
module, scope, function, KotlinTestUtils.DUMMY_TRACE, DataFlowInfoFactory.EMPTY
|
||||
module, scope, function, DummyTraces.DUMMY_TRACE, DataFlowInfoFactory.EMPTY
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory;
|
||||
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil;
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.DummyTraces;
|
||||
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment;
|
||||
|
||||
public class KotlinOverridingTest extends KotlinTestWithEnvironment {
|
||||
@@ -172,7 +172,7 @@ public class KotlinOverridingTest extends KotlinTestWithEnvironment {
|
||||
KtNamedFunction function = KtPsiFactoryKt.KtPsiFactory(getProject()).createFunction(funDecl);
|
||||
LexicalScope scope = TypeTestUtilsKt.builtInPackageAsLexicalScope(module);
|
||||
return functionDescriptorResolver.resolveFunctionDescriptor(
|
||||
module, scope, function, KotlinTestUtils.DUMMY_TRACE, DataFlowInfoFactory.EMPTY
|
||||
module, scope, function, DummyTraces.DUMMY_TRACE, DataFlowInfoFactory.EMPTY
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ 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.DummyTraces;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment;
|
||||
import org.jetbrains.kotlin.tests.di.ContainerForTests;
|
||||
@@ -534,7 +535,7 @@ public class KotlinTypeCheckerTest extends KotlinTestWithEnvironment {
|
||||
KotlinType type = expressionTypingServices.getType(
|
||||
scopeWithImports, ktExpression, TypeUtils.NO_EXPECTED_TYPE,
|
||||
DataFlowInfoFactory.EMPTY, InferenceSession.Companion.getDefault(),
|
||||
KotlinTestUtils.DUMMY_TRACE
|
||||
DummyTraces.DUMMY_TRACE
|
||||
);
|
||||
assertNotNull(type);
|
||||
assertEquals(type + " != " + expectedType, expectedType, type);
|
||||
@@ -583,6 +584,6 @@ public class KotlinTypeCheckerTest extends KotlinTestWithEnvironment {
|
||||
}
|
||||
|
||||
private KotlinType makeType(LexicalScope scope, String typeStr) {
|
||||
return typeResolver.resolveType(scope, KtPsiFactoryKt.KtPsiFactory(getProject()).createType(typeStr), KotlinTestUtils.DUMMY_TRACE, true);
|
||||
return typeResolver.resolveType(scope, KtPsiFactoryKt.KtPsiFactory(getProject()).createType(typeStr), DummyTraces.DUMMY_TRACE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil;
|
||||
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.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.DummyTraces;
|
||||
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -208,7 +208,7 @@ public class TypeUnifierTest extends KotlinTestWithEnvironment {
|
||||
|
||||
KtTypeReference typeReference = projection.getTypeReference();
|
||||
assert typeReference != null;
|
||||
KotlinType type = typeResolver.resolveType(withX, typeReference, KotlinTestUtils.DUMMY_TRACE, true);
|
||||
KotlinType type = typeResolver.resolveType(withX, typeReference, DummyTraces.DUMMY_TRACE, true);
|
||||
|
||||
return new TypeProjectionImpl(getProjectionKind(typeStr, projection), type);
|
||||
}
|
||||
|
||||
+1
-4
@@ -21,7 +21,7 @@ abstract class AbstractNavigateToLibraryTest : KotlinLightCodeInsightFixtureTest
|
||||
abstract val expectedFileExt: String
|
||||
|
||||
protected fun doTest(path: String) {
|
||||
myFixture.configureByFile(path)
|
||||
myFixture.configureByFile(fileName())
|
||||
NavigationChecker.checkAnnotatedCode(file, File(path.replace(".kt", expectedFileExt)))
|
||||
}
|
||||
|
||||
@@ -29,9 +29,6 @@ abstract class AbstractNavigateToLibraryTest : KotlinLightCodeInsightFixtureTest
|
||||
SourceNavigationHelper.setForceResolve(false)
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
override fun getTestDataPath(): String =
|
||||
KotlinTestUtils.getHomeDirectory() + File.separator
|
||||
}
|
||||
|
||||
abstract class AbstractNavigateToDecompiledLibraryTest : AbstractNavigateToLibraryTest() {
|
||||
|
||||
+2
-1
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtens
|
||||
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.DummyTraces
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
||||
@@ -32,7 +33,7 @@ abstract class AbstractAndroidSyntheticPropertyDescriptorTest : KtUsefulTestCase
|
||||
val fragmentProvider =
|
||||
ext.getPackageFragmentProvider(
|
||||
project, analysisResult.moduleDescriptor, LockBasedStorageManager.NO_LOCKS,
|
||||
KotlinTestUtils.DUMMY_EXCEPTION_ON_ERROR_TRACE, null, LookupTracker.DO_NOTHING
|
||||
DummyTraces.DUMMY_EXCEPTION_ON_ERROR_TRACE, null, LookupTracker.DO_NOTHING
|
||||
) as AndroidSyntheticPackageFragmentProvider
|
||||
|
||||
val renderer = DescriptorRenderer.COMPACT_WITH_MODIFIERS
|
||||
|
||||
Reference in New Issue
Block a user