diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/repl/ReplInterpreter.java b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/repl/ReplInterpreter.java index d7c280cb92f..c30275fa601 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/repl/ReplInterpreter.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/repl/ReplInterpreter.java @@ -61,7 +61,7 @@ import org.jetbrains.kotlin.parsing.KotlinParserDefinition; import org.jetbrains.kotlin.psi.KtFile; import org.jetbrains.kotlin.psi.KtScript; import org.jetbrains.kotlin.resolve.*; -import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; +import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; import org.jetbrains.kotlin.resolve.jvm.JvmClassName; import org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM; import org.jetbrains.kotlin.resolve.lazy.ResolveSession; @@ -160,7 +160,7 @@ public class ReplInterpreter { new JvmPackagePartProvider(environment) ); - this.topDownAnalysisContext = new TopDownAnalysisContext(TopDownAnalysisMode.LocalDeclarations, DataFlowInfo.EMPTY, + this.topDownAnalysisContext = new TopDownAnalysisContext(TopDownAnalysisMode.LocalDeclarations, DataFlowInfoFactory.EMPTY, container.getResolveSession().getDeclarationScopeProvider()); this.topDownAnalyzer = container.getLazyTopDownAnalyzerForTopLevel(); this.resolveSession = container.getResolveSession(); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolver.java index 44c92486f71..e209cfb75a0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolver.java @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.psi.*; import org.jetbrains.kotlin.resolve.calls.CallResolver; import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument; import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults; -import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; +import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; import org.jetbrains.kotlin.resolve.calls.util.CallMaker; import org.jetbrains.kotlin.resolve.constants.ConstantValue; import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator; @@ -33,7 +33,6 @@ import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil; import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor; import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationsContextImpl; import org.jetbrains.kotlin.resolve.scopes.LexicalScope; -import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue; import org.jetbrains.kotlin.storage.StorageManager; import org.jetbrains.kotlin.types.ErrorUtils; import org.jetbrains.kotlin.types.KotlinType; @@ -191,7 +190,7 @@ public class AnnotationResolver { trace, scope, CallMaker.makeCall(null, null, annotationEntry), NO_EXPECTED_TYPE, - DataFlowInfo.EMPTY, + DataFlowInfoFactory.EMPTY, true ); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContextUtils.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContextUtils.java index bb5271bf55d..7e22647a2d6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContextUtils.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContextUtils.java @@ -29,7 +29,7 @@ import org.jetbrains.kotlin.psi.*; import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt; import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall; -import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; +import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; import org.jetbrains.kotlin.resolve.diagnostics.MutableDiagnosticsWithSuppression; import org.jetbrains.kotlin.types.KotlinType; import org.jetbrains.kotlin.types.TypeUtils; @@ -170,7 +170,7 @@ public class BindingContextUtils { if (!context.get(BindingContext.PROCESSED, expression)) return null; // NB: should never return null if expression is already processed KotlinTypeInfo result = context.get(BindingContext.EXPRESSION_TYPE_INFO, expression); - return result != null ? result : TypeInfoFactoryKt.noTypeInfo(DataFlowInfo.EMPTY); + return result != null ? result : TypeInfoFactoryKt.noTypeInfo(DataFlowInfoFactory.EMPTY); } public static boolean isExpressionWithValidReference( diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java index 963fea4f208..b297cd15d34 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java @@ -33,6 +33,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.TypeVariableKt; import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; +import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; import org.jetbrains.kotlin.resolve.scopes.ScopeUtils; import org.jetbrains.kotlin.resolve.scopes.LexicalScope; import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver; @@ -141,7 +142,7 @@ public class DelegatedPropertyResolver { TemporaryBindingTrace traceToResolvePDMethod = TemporaryBindingTrace.create(trace, "Trace to resolve propertyDelegated method in delegated property"); ExpressionTypingContext context = ExpressionTypingContext.newContext( traceToResolvePDMethod, delegateFunctionsScope, - DataFlowInfo.EMPTY, TypeUtils.NO_EXPECTED_TYPE); + DataFlowInfoFactory.EMPTY, TypeUtils.NO_EXPECTED_TYPE); KtPsiFactory psiFactory = KtPsiFactory(delegateExpression); List arguments = Collections.singletonList(createExpressionForProperty(psiFactory)); @@ -242,7 +243,7 @@ public class DelegatedPropertyResolver { ExpressionTypingContext context = ExpressionTypingContext.newContext( trace, delegateFunctionsScope, - DataFlowInfo.EMPTY, expectedType); + DataFlowInfoFactory.EMPTY, expectedType); boolean hasThis = propertyDescriptor.getExtensionReceiverParameter() != null || propertyDescriptor.getDispatchReceiverParameter() != null; diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzerForTopLevel.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzerForTopLevel.java index b0957212eec..ed8bd6f0672 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzerForTopLevel.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzerForTopLevel.java @@ -24,7 +24,7 @@ import org.jetbrains.kotlin.descriptors.impl.CompositePackageFragmentProvider; import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl; import org.jetbrains.kotlin.psi.KtFile; import org.jetbrains.kotlin.psi.KtScript; -import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; +import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; import org.jetbrains.kotlin.resolve.lazy.KotlinCodeAnalyzer; import org.jetbrains.kotlin.resolve.lazy.ImportResolver; @@ -71,7 +71,7 @@ public class LazyTopDownAnalyzerForTopLevel { @NotNull TopDownAnalysisMode topDownAnalysisMode, @NotNull Collection elements ) { - TopDownAnalysisContext c = lazyTopDownAnalyzer.analyzeDeclarations(topDownAnalysisMode, elements, DataFlowInfo.EMPTY); + TopDownAnalysisContext c = lazyTopDownAnalyzer.analyzeDeclarations(topDownAnalysisMode, elements, DataFlowInfoFactory.EMPTY); resolveImportsInAllFiles(c, codeAnalyzer); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowInfo.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowInfo.kt index 6c15718618e..3fc9232e8cb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowInfo.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowInfo.kt @@ -14,41 +14,32 @@ * limitations under the License. */ -package org.jetbrains.kotlin.resolve.calls.smartcasts; +package org.jetbrains.kotlin.resolve.calls.smartcasts -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.SetMultimap; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.types.KotlinType; - -import java.util.Map; -import java.util.Set; +import com.google.common.collect.ImmutableMap +import com.google.common.collect.SetMultimap +import org.jetbrains.kotlin.types.KotlinType /** * This interface is intended to provide and edit information about value nullabilities and possible types. * Data flow info is immutable so functions never change it. */ -public interface DataFlowInfo { - DataFlowInfo EMPTY = new DelegatingDataFlowInfo(null, ImmutableMap.of(), DelegatingDataFlowInfo.newTypeInfo()); +interface DataFlowInfo { - @NotNull - Map getCompleteNullabilityInfo(); + val completeNullabilityInfo: Map - @NotNull - SetMultimap getCompleteTypeInfo(); + val completeTypeInfo: SetMultimap /** * Returns collected nullability for the given value, NOT taking its predictability into account. */ - @NotNull - Nullability getCollectedNullability(@NotNull DataFlowValue key); + fun getCollectedNullability(key: DataFlowValue): Nullability /** * Returns collected nullability for the given value if it's predictable. * Otherwise basic value nullability is returned */ - @NotNull - Nullability getPredictableNullability(@NotNull DataFlowValue key); + fun getPredictableNullability(key: DataFlowValue): Nullability /** * Returns possible types for the given value, NOT taking its predictability into account. @@ -56,8 +47,7 @@ public interface DataFlowInfo { * IMPORTANT: by default, the original (native) type for this value * are NOT included. So it's quite possible to get an empty set here. */ - @NotNull - Set getCollectedTypes(@NotNull DataFlowValue key); + fun getCollectedTypes(key: DataFlowValue): Set /** * Returns possible types for the given value if it's predictable. @@ -66,46 +56,49 @@ public interface DataFlowInfo { * IMPORTANT: by default, the original (native) type for this value * are NOT included. So it's quite possible to get an empty set here. */ - @NotNull - Set getPredictableTypes(@NotNull DataFlowValue key); + fun getPredictableTypes(key: DataFlowValue): Set /** * Call this function to clear all data flow information about * the given data flow value. Useful when we are not sure how this value can be changed, e.g. in a loop. */ - @NotNull - DataFlowInfo clearValueInfo(@NotNull DataFlowValue value); + fun clearValueInfo(value: DataFlowValue): DataFlowInfo /** * Call this function when b is assigned to a */ - @NotNull - DataFlowInfo assign(@NotNull DataFlowValue a, @NotNull DataFlowValue b); + fun assign(a: DataFlowValue, b: DataFlowValue): DataFlowInfo /** * Call this function when it's known than a == b */ - @NotNull - DataFlowInfo equate(@NotNull DataFlowValue a, @NotNull DataFlowValue b); + fun equate(a: DataFlowValue, b: DataFlowValue): DataFlowInfo /** * Call this function when it's known than a != b */ - @NotNull - DataFlowInfo disequate(@NotNull DataFlowValue a, @NotNull DataFlowValue b); + fun disequate(a: DataFlowValue, b: DataFlowValue): DataFlowInfo - @NotNull - DataFlowInfo establishSubtyping(@NotNull DataFlowValue value, @NotNull KotlinType type); + fun establishSubtyping(value: DataFlowValue, type: KotlinType): DataFlowInfo /** * Call this function to add data flow information from other to this and return sum as the result */ - @NotNull - DataFlowInfo and(@NotNull DataFlowInfo other); + fun and(other: DataFlowInfo): DataFlowInfo /** * Call this function to choose data flow information common for this and other and return it as the result */ - @NotNull - DataFlowInfo or(@NotNull DataFlowInfo other); + fun or(other: DataFlowInfo): DataFlowInfo + + companion object { + val EMPTY = DataFlowInfoFactory.EMPTY + } +} + +object DataFlowInfoFactory { + @JvmField + val EMPTY: DataFlowInfo = DelegatingDataFlowInfo( + null, ImmutableMap.of(), DelegatingDataFlowInfo.newTypeInfo() + ) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt index 4f754c6c2c5..a2bc42ec3a5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt @@ -27,7 +27,7 @@ import java.util.* import org.jetbrains.kotlin.resolve.calls.smartcasts.Nullability.NOT_NULL -internal class DelegatingDataFlowInfo @JvmOverloads constructor( +internal class DelegatingDataFlowInfo( private val parent: DataFlowInfo?, private val nullabilityInfo: ImmutableMap, // Also immutable @@ -39,35 +39,37 @@ internal class DelegatingDataFlowInfo @JvmOverloads constructor( private val valueWithGivenTypeInfo: DataFlowValue? = null ) : DataFlowInfo { - override fun getCompleteNullabilityInfo(): Map { - val result = Maps.newHashMap() - var info: DelegatingDataFlowInfo? = this - while (info != null) { - for ((key, value) in info.nullabilityInfo) { - if (!result.containsKey(key)) { - result.put(key, value) + override val completeNullabilityInfo: Map + get() { + val result = Maps.newHashMap() + var info: DelegatingDataFlowInfo? = this + while (info != null) { + for ((key, value) in info.nullabilityInfo) { + if (!result.containsKey(key)) { + result.put(key, value) + } } + info = info.parent as DelegatingDataFlowInfo? } - info = info.parent as DelegatingDataFlowInfo? + return result } - return result - } - override fun getCompleteTypeInfo(): SetMultimap { - val result = newTypeInfo() - val withGivenTypeInfo = HashSet() - var info: DelegatingDataFlowInfo? = this - while (info != null) { - for (key in info.typeInfo.keySet()) { - if (!withGivenTypeInfo.contains(key)) { - result.putAll(key, info.typeInfo.get(key)) + override val completeTypeInfo: SetMultimap + get() { + val result = newTypeInfo() + val withGivenTypeInfo = HashSet() + var info: DelegatingDataFlowInfo? = this + while (info != null) { + for (key in info.typeInfo.keySet()) { + if (!withGivenTypeInfo.contains(key)) { + result.putAll(key, info.typeInfo.get(key)) + } } + info.valueWithGivenTypeInfo?.let { withGivenTypeInfo.add(it) } + info = info.parent as DelegatingDataFlowInfo? } - info.valueWithGivenTypeInfo?.let { withGivenTypeInfo.add(it) } - info = info.parent as DelegatingDataFlowInfo? + return result } - return result - } override fun getCollectedNullability(key: DataFlowValue) = getNullability(key, false) @@ -226,13 +228,12 @@ internal class DelegatingDataFlowInfo @JvmOverloads constructor( return DelegatingDataFlowInfo(this, newNullabilityInfo, newTypeInfo) } - override fun and(otherInfo: DataFlowInfo): DataFlowInfo { - if (otherInfo === DataFlowInfo.EMPTY) return this - if (this === DataFlowInfo.EMPTY) return otherInfo - if (this === otherInfo) return this + override fun and(other: DataFlowInfo): DataFlowInfo { + if (other === DataFlowInfo.EMPTY) return this + if (this === DataFlowInfo.EMPTY) return other + if (this === other) return this - assert(otherInfo is DelegatingDataFlowInfo) { "Unknown DataFlowInfo type: " + otherInfo } - val other = otherInfo as DelegatingDataFlowInfo + assert(other is DelegatingDataFlowInfo) { "Unknown DataFlowInfo type: " + other } val nullabilityMapBuilder = Maps.newHashMap() for ((key, otherFlags) in other.completeNullabilityInfo) { @@ -259,13 +260,12 @@ internal class DelegatingDataFlowInfo @JvmOverloads constructor( else if (this.containsNothing()) other else Sets.intersection(this, other) - override fun or(otherInfo: DataFlowInfo): DataFlowInfo { - if (otherInfo === DataFlowInfo.EMPTY) return DataFlowInfo.EMPTY + override fun or(other: DataFlowInfo): DataFlowInfo { + if (other === DataFlowInfo.EMPTY) return DataFlowInfo.EMPTY if (this === DataFlowInfo.EMPTY) return DataFlowInfo.EMPTY - if (this === otherInfo) return this + if (this === other) return this - assert(otherInfo is DelegatingDataFlowInfo) { "Unknown DataFlowInfo type: " + otherInfo } - val other = otherInfo as DelegatingDataFlowInfo + assert(other is DelegatingDataFlowInfo) { "Unknown DataFlowInfo type: " + other } val nullabilityMapBuilder = Maps.newHashMap() for ((key, otherFlags) in other.completeNullabilityInfo) { @@ -297,7 +297,6 @@ internal class DelegatingDataFlowInfo @JvmOverloads constructor( private fun containsAll(first: SetMultimap, second: SetMultimap) = first.entries().containsAll(second.entries()) - @JvmStatic fun newTypeInfo(): SetMultimap = LinkedHashMultimap.create() } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/DeclarationScopeProviderImpl.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/DeclarationScopeProviderImpl.java index 0b9285ba065..f84a21f0283 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/DeclarationScopeProviderImpl.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/DeclarationScopeProviderImpl.java @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.incremental.components.NoLookupLocation; import org.jetbrains.kotlin.psi.*; import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; +import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor; import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyScriptDescriptor; import org.jetbrains.kotlin.resolve.scopes.LexicalScope; @@ -91,6 +92,6 @@ public class DeclarationScopeProviderImpl implements DeclarationScopeProvider { @NotNull @Override public DataFlowInfo getOuterDataFlowInfoForDeclaration(@NotNull PsiElement elementOfDeclaration) { - return DataFlowInfo.EMPTY; + return DataFlowInfoFactory.EMPTY; } } diff --git a/compiler/tests/org/jetbrains/kotlin/resolve/ExpectedResolveDataUtil.java b/compiler/tests/org/jetbrains/kotlin/resolve/ExpectedResolveDataUtil.java index 453bcbd55ae..1b60ef12bf8 100644 --- a/compiler/tests/org/jetbrains/kotlin/resolve/ExpectedResolveDataUtil.java +++ b/compiler/tests/org/jetbrains/kotlin/resolve/ExpectedResolveDataUtil.java @@ -28,7 +28,7 @@ import org.jetbrains.kotlin.name.FqName; import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults; -import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; +import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt; import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform; import org.jetbrains.kotlin.resolve.lazy.LazyResolveTestUtil; @@ -143,7 +143,7 @@ public class ExpectedResolveDataUtil { ExpressionTypingContext context = ExpressionTypingContext.newContext( new BindingTraceContext(), lexicalScope, - DataFlowInfo.EMPTY, TypeUtils.NO_EXPECTED_TYPE); + DataFlowInfoFactory.EMPTY, TypeUtils.NO_EXPECTED_TYPE); OverloadResolutionResults functions = container.getFakeCallResolver().resolveFakeCall( context, null, Name.identifier(name), null, parameterTypes); diff --git a/compiler/tests/org/jetbrains/kotlin/types/DefaultModalityModifiersTest.java b/compiler/tests/org/jetbrains/kotlin/types/DefaultModalityModifiersTest.java index eb370340937..8bab7f014d7 100644 --- a/compiler/tests/org/jetbrains/kotlin/types/DefaultModalityModifiersTest.java +++ b/compiler/tests/org/jetbrains/kotlin/types/DefaultModalityModifiersTest.java @@ -28,7 +28,7 @@ import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl; import org.jetbrains.kotlin.incremental.components.NoLookupLocation; import org.jetbrains.kotlin.psi.*; import org.jetbrains.kotlin.resolve.*; -import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; +import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil; import org.jetbrains.kotlin.resolve.lazy.ResolveSession; import org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProviderFactory; @@ -132,7 +132,7 @@ public class DefaultModalityModifiersTest extends KotlinLiteFixture { KtNamedFunction function = (KtNamedFunction) declarations.get(0); SimpleFunctionDescriptor functionDescriptor = functionDescriptorResolver.resolveFunctionDescriptor(classDescriptor, scope, function, - KotlinTestUtils.DUMMY_TRACE, DataFlowInfo.EMPTY); + KotlinTestUtils.DUMMY_TRACE, DataFlowInfoFactory.EMPTY); assertEquals(expectedFunctionModality, functionDescriptor.getModality()); } @@ -144,7 +144,7 @@ public class DefaultModalityModifiersTest extends KotlinLiteFixture { List declarations = aClass.getDeclarations(); KtProperty property = (KtProperty) declarations.get(0); PropertyDescriptor propertyDescriptor = descriptorResolver.resolvePropertyDescriptor( - classDescriptor, scope, property, KotlinTestUtils.DUMMY_TRACE, DataFlowInfo.EMPTY); + classDescriptor, scope, property, KotlinTestUtils.DUMMY_TRACE, DataFlowInfoFactory.EMPTY); assertEquals(expectedPropertyModality, propertyDescriptor.getModality()); } @@ -157,7 +157,7 @@ public class DefaultModalityModifiersTest extends KotlinLiteFixture { List declarations = aClass.getDeclarations(); KtProperty property = (KtProperty) declarations.get(0); PropertyDescriptor propertyDescriptor = descriptorResolver.resolvePropertyDescriptor( - classDescriptor, scope, property, KotlinTestUtils.DUMMY_TRACE, DataFlowInfo.EMPTY); + classDescriptor, scope, property, KotlinTestUtils.DUMMY_TRACE, DataFlowInfoFactory.EMPTY); PropertyAccessorDescriptor propertyAccessor = isGetter ? propertyDescriptor.getGetter() : propertyDescriptor.getSetter(); diff --git a/compiler/tests/org/jetbrains/kotlin/types/KotlinOverloadTest.java b/compiler/tests/org/jetbrains/kotlin/types/KotlinOverloadTest.java index 22550109235..f8eed13c1e7 100644 --- a/compiler/tests/org/jetbrains/kotlin/types/KotlinOverloadTest.java +++ b/compiler/tests/org/jetbrains/kotlin/types/KotlinOverloadTest.java @@ -24,10 +24,9 @@ import org.jetbrains.kotlin.psi.KtNamedFunction; import org.jetbrains.kotlin.psi.KtPsiFactoryKt; import org.jetbrains.kotlin.resolve.FunctionDescriptorResolver; import org.jetbrains.kotlin.resolve.OverloadUtil; -import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; +import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform; import org.jetbrains.kotlin.resolve.scopes.LexicalScope; -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; @@ -173,6 +172,6 @@ public class KotlinOverloadTest extends KotlinLiteFixture { private FunctionDescriptor makeFunction(String funDecl) { KtNamedFunction function = KtPsiFactoryKt.KtPsiFactory(getProject()).createFunction(funDecl); LexicalScope scope = TypeTestUtilsKt.builtInPackageAsLexicalScope(JvmPlatform.INSTANCE.getBuiltIns()); - return functionDescriptorResolver.resolveFunctionDescriptor(root, scope, function, KotlinTestUtils.DUMMY_TRACE, DataFlowInfo.EMPTY); + return functionDescriptorResolver.resolveFunctionDescriptor(root, scope, function, KotlinTestUtils.DUMMY_TRACE, DataFlowInfoFactory.EMPTY); } } diff --git a/compiler/tests/org/jetbrains/kotlin/types/KotlinOverridingTest.java b/compiler/tests/org/jetbrains/kotlin/types/KotlinOverridingTest.java index 7105f3e3266..e4f039d2d62 100644 --- a/compiler/tests/org/jetbrains/kotlin/types/KotlinOverridingTest.java +++ b/compiler/tests/org/jetbrains/kotlin/types/KotlinOverridingTest.java @@ -23,7 +23,7 @@ import org.jetbrains.kotlin.psi.KtNamedFunction; import org.jetbrains.kotlin.psi.KtPsiFactoryKt; import org.jetbrains.kotlin.resolve.FunctionDescriptorResolver; import org.jetbrains.kotlin.resolve.OverridingUtil; -import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; +import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; import org.jetbrains.kotlin.resolve.scopes.LexicalScope; import org.jetbrains.kotlin.test.ConfigurationKind; import org.jetbrains.kotlin.test.KotlinLiteFixture; @@ -168,6 +168,6 @@ public class KotlinOverridingTest extends KotlinLiteFixture { KtNamedFunction function = KtPsiFactoryKt.KtPsiFactory(getProject()).createFunction(funDecl); LexicalScope scope = TypeTestUtilsKt.builtInPackageAsLexicalScope(root.getBuiltIns()); return functionDescriptorResolver.resolveFunctionDescriptor(root, scope, function, - KotlinTestUtils.DUMMY_TRACE, DataFlowInfo.EMPTY); + KotlinTestUtils.DUMMY_TRACE, DataFlowInfoFactory.EMPTY); } } diff --git a/compiler/tests/org/jetbrains/kotlin/types/KotlinTypeCheckerTest.java b/compiler/tests/org/jetbrains/kotlin/types/KotlinTypeCheckerTest.java index 0bead1377fd..23ae2d24d23 100644 --- a/compiler/tests/org/jetbrains/kotlin/types/KotlinTypeCheckerTest.java +++ b/compiler/tests/org/jetbrains/kotlin/types/KotlinTypeCheckerTest.java @@ -32,7 +32,7 @@ import org.jetbrains.kotlin.resolve.BindingContext; import org.jetbrains.kotlin.resolve.BindingTrace; import org.jetbrains.kotlin.resolve.BindingTraceContext; import org.jetbrains.kotlin.resolve.TypeResolver; -import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; +import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; import org.jetbrains.kotlin.resolve.lazy.LazyResolveTestUtil; import org.jetbrains.kotlin.resolve.scopes.LexicalScope; import org.jetbrains.kotlin.resolve.scopes.LexicalScopeImpl; @@ -544,14 +544,14 @@ public class KotlinTypeCheckerTest extends KotlinLiteFixture { private void assertType(String expression, KotlinType expectedType) { Project project = getProject(); KtExpression ktExpression = KtPsiFactoryKt.KtPsiFactory(project).createExpression(expression); - KotlinType type = expressionTypingServices.getType(scopeWithImports, ktExpression, TypeUtils.NO_EXPECTED_TYPE, DataFlowInfo.EMPTY, KotlinTestUtils.DUMMY_TRACE); + KotlinType type = expressionTypingServices.getType(scopeWithImports, ktExpression, TypeUtils.NO_EXPECTED_TYPE, DataFlowInfoFactory.EMPTY, KotlinTestUtils.DUMMY_TRACE); assertTrue(type + " != " + expectedType, type.equals(expectedType)); } private void assertErrorType(String expression) { Project project = getProject(); KtExpression ktExpression = KtPsiFactoryKt.KtPsiFactory(project).createExpression(expression); - KotlinType type = expressionTypingServices.safeGetType(scopeWithImports, ktExpression, TypeUtils.NO_EXPECTED_TYPE, DataFlowInfo.EMPTY, KotlinTestUtils.DUMMY_TRACE); + KotlinType type = expressionTypingServices.safeGetType(scopeWithImports, ktExpression, TypeUtils.NO_EXPECTED_TYPE, DataFlowInfoFactory.EMPTY, KotlinTestUtils.DUMMY_TRACE); assertTrue("Error type expected but " + type + " returned", type.isError()); } @@ -574,7 +574,7 @@ public class KotlinTypeCheckerTest extends KotlinLiteFixture { private void assertType(LexicalScope scope, String expression, String expectedTypeStr) { Project project = getProject(); KtExpression ktExpression = KtPsiFactoryKt.KtPsiFactory(project).createExpression(expression); - KotlinType type = expressionTypingServices.getType(scope, ktExpression, TypeUtils.NO_EXPECTED_TYPE, DataFlowInfo.EMPTY, new BindingTraceContext()); + KotlinType type = expressionTypingServices.getType(scope, ktExpression, TypeUtils.NO_EXPECTED_TYPE, DataFlowInfoFactory.EMPTY, new BindingTraceContext()); KotlinType expectedType = expectedTypeStr == null ? null : makeType(expectedTypeStr); assertEquals(expectedType, type); }