[Misc] Make NewKotlinTypeChecker non-static
This commit is contained in:
committed by
Dmitry Savvinov
parent
4f1e85b468
commit
f026a98403
@@ -60,6 +60,7 @@ public class ArgumentTypeResolver {
|
||||
@NotNull private final ConstantExpressionEvaluator constantExpressionEvaluator;
|
||||
@NotNull private final FunctionPlaceholders functionPlaceholders;
|
||||
@NotNull private final ModuleDescriptor moduleDescriptor;
|
||||
@NotNull private final KotlinTypeChecker kotlinTypeChecker;
|
||||
|
||||
private ExpressionTypingServices expressionTypingServices;
|
||||
private DoubleColonExpressionResolver doubleColonExpressionResolver;
|
||||
@@ -70,7 +71,8 @@ public class ArgumentTypeResolver {
|
||||
@NotNull ReflectionTypes reflectionTypes,
|
||||
@NotNull ConstantExpressionEvaluator constantExpressionEvaluator,
|
||||
@NotNull FunctionPlaceholders functionPlaceholders,
|
||||
@NotNull ModuleDescriptor moduleDescriptor
|
||||
@NotNull ModuleDescriptor moduleDescriptor,
|
||||
@NotNull KotlinTypeChecker kotlinTypeChecker
|
||||
) {
|
||||
this.typeResolver = typeResolver;
|
||||
this.builtIns = builtIns;
|
||||
@@ -78,6 +80,7 @@ public class ArgumentTypeResolver {
|
||||
this.constantExpressionEvaluator = constantExpressionEvaluator;
|
||||
this.functionPlaceholders = functionPlaceholders;
|
||||
this.moduleDescriptor = moduleDescriptor;
|
||||
this.kotlinTypeChecker = kotlinTypeChecker;
|
||||
}
|
||||
|
||||
// component dependency cycle
|
||||
@@ -97,12 +100,11 @@ public class ArgumentTypeResolver {
|
||||
) {
|
||||
if (FunctionPlaceholdersKt.isFunctionPlaceholder(actualType)) {
|
||||
KotlinType functionType = ConstraintSystemBuilderImplKt.createTypeForFunctionPlaceholder(actualType, expectedType);
|
||||
return KotlinTypeChecker.DEFAULT.isSubtypeOf(functionType, expectedType);
|
||||
return kotlinTypeChecker.isSubtypeOf(functionType, expectedType);
|
||||
}
|
||||
return KotlinTypeChecker.DEFAULT.isSubtypeOf(actualType, expectedType);
|
||||
return kotlinTypeChecker.isSubtypeOf(actualType, expectedType);
|
||||
}
|
||||
|
||||
|
||||
public void checkTypesWithNoCallee(
|
||||
@NotNull CallResolutionContext<?> context
|
||||
) {
|
||||
|
||||
+3
-3
@@ -39,8 +39,8 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.TypeUtils.NO_EXPECTED_TYPE
|
||||
import org.jetbrains.kotlin.types.checker.NewKotlinTypeChecker
|
||||
import org.jetbrains.kotlin.types.checker.ClassicTypeCheckerContext
|
||||
import org.jetbrains.kotlin.types.checker.NewKotlinTypeChecker
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices
|
||||
import org.jetbrains.kotlin.types.expressions.KotlinTypeInfo
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
|
||||
@@ -228,7 +228,7 @@ class CoroutineInferenceSupport(
|
||||
forceInferenceForArguments(context) { valueArgument: ValueArgument, kotlinType: KotlinType ->
|
||||
val argumentMatch = resultingCall.getArgumentMapping(valueArgument) as? ArgumentMatch ?: return@forceInferenceForArguments
|
||||
|
||||
with(NewKotlinTypeChecker) {
|
||||
with(NewKotlinTypeChecker.Default) {
|
||||
val parameterType = getEffectiveExpectedType(argumentMatch.valueParameter, valueArgument, context)
|
||||
CoroutineTypeCheckerContext(allowOnlyTrivialConstraints = false).isSubtypeOf(kotlinType.unwrap(), parameterType.unwrap())
|
||||
}
|
||||
@@ -242,7 +242,7 @@ class CoroutineInferenceSupport(
|
||||
false
|
||||
|
||||
resultingCall.extensionReceiver?.let { actualReceiver ->
|
||||
with(NewKotlinTypeChecker) {
|
||||
with(NewKotlinTypeChecker.Default) {
|
||||
CoroutineTypeCheckerContext(allowOnlyTrivialConstraints = allowOnlyTrivialConstraintsForReceiver).isSubtypeOf(
|
||||
actualReceiver.type.unwrap(), extensionReceiver.value.type.unwrap()
|
||||
)
|
||||
|
||||
@@ -62,6 +62,7 @@ public class DataFlowAnalyzer {
|
||||
private final EffectSystem effectSystem;
|
||||
private final DataFlowValueFactory dataFlowValueFactory;
|
||||
private final SmartCastManager smartCastManager;
|
||||
private final KotlinTypeChecker kotlinTypeChecker;
|
||||
|
||||
public DataFlowAnalyzer(
|
||||
@NotNull Iterable<AdditionalTypeChecker> additionalTypeCheckers,
|
||||
@@ -72,7 +73,8 @@ public class DataFlowAnalyzer {
|
||||
@NotNull LanguageVersionSettings languageVersionSettings,
|
||||
@NotNull EffectSystem effectSystem,
|
||||
@NotNull DataFlowValueFactory factory,
|
||||
@NotNull SmartCastManager smartCastManager
|
||||
@NotNull SmartCastManager smartCastManager,
|
||||
@NotNull KotlinTypeChecker kotlinTypeChecker
|
||||
) {
|
||||
this.additionalTypeCheckers = additionalTypeCheckers;
|
||||
this.constantExpressionEvaluator = constantExpressionEvaluator;
|
||||
@@ -83,6 +85,7 @@ public class DataFlowAnalyzer {
|
||||
this.effectSystem = effectSystem;
|
||||
this.dataFlowValueFactory = factory;
|
||||
this.smartCastManager = smartCastManager;
|
||||
this.kotlinTypeChecker = kotlinTypeChecker;
|
||||
}
|
||||
|
||||
// NB: use this method only for functions from 'Any'
|
||||
@@ -285,7 +288,7 @@ public class DataFlowAnalyzer {
|
||||
boolean reportErrorForTypeMismatch
|
||||
) {
|
||||
if (noExpectedType(c.expectedType) || !c.expectedType.getConstructor().isDenotable() ||
|
||||
KotlinTypeChecker.DEFAULT.isSubtypeOf(expressionType, c.expectedType)) {
|
||||
kotlinTypeChecker.isSubtypeOf(expressionType, c.expectedType)) {
|
||||
return expressionType;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user