[NI] Refactoring: rename NonFixedType -> StubType
This commit is contained in:
+2
-2
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.resolve.calls.model.KotlinCallComponents
|
||||
import org.jetbrains.kotlin.resolve.calls.model.KotlinResolutionCandidate
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedLambdaAtom
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.*
|
||||
import org.jetbrains.kotlin.types.NonFixedType
|
||||
import org.jetbrains.kotlin.types.StubType
|
||||
import org.jetbrains.kotlin.types.TypeConstructor
|
||||
import org.jetbrains.kotlin.types.UnwrappedType
|
||||
import org.jetbrains.kotlin.types.expressions.DoubleColonExpressionResolver
|
||||
@@ -38,7 +38,7 @@ class CoroutineInferenceSession(
|
||||
callComponents: KotlinCallComponents,
|
||||
builtIns: KotlinBuiltIns,
|
||||
private val topLevelCallContext: BasicCallResolutionContext,
|
||||
private val stubsForPostponedVariables: Map<NewTypeVariable, NonFixedType>,
|
||||
private val stubsForPostponedVariables: Map<NewTypeVariable, StubType>,
|
||||
private val trace: BindingTrace,
|
||||
private val kotlinToResolvedCallTransformer: KotlinToResolvedCallTransformer,
|
||||
private val expressionTypingServices: ExpressionTypingServices,
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ class KotlinResolutionCallbacksImpl(
|
||||
receiverType: UnwrappedType?,
|
||||
parameters: List<UnwrappedType>,
|
||||
expectedReturnType: UnwrappedType?,
|
||||
stubsForPostponedVariables: Map<NewTypeVariable, NonFixedType>
|
||||
stubsForPostponedVariables: Map<NewTypeVariable, StubType>
|
||||
): Pair<List<KotlinCallArgument>, InferenceSession?> {
|
||||
val psiCallArgument = lambdaArgument.psiCallArgument as PSIFunctionKotlinCallArgument
|
||||
val outerCallContext = psiCallArgument.outerCallContext
|
||||
|
||||
+2
-3
@@ -12,8 +12,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.model.NewTypeVariable
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.ImplicitScopeTower
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValueWithSmartCastInfo
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.NonFixedType
|
||||
import org.jetbrains.kotlin.types.StubType
|
||||
import org.jetbrains.kotlin.types.UnwrappedType
|
||||
|
||||
// stateless component
|
||||
@@ -37,7 +36,7 @@ interface KotlinResolutionCallbacks {
|
||||
receiverType: UnwrappedType?,
|
||||
parameters: List<UnwrappedType>,
|
||||
expectedReturnType: UnwrappedType?, // null means, that return type is not proper i.e. it depends on some type variables
|
||||
stubsForPostponedVariables: Map<NewTypeVariable, NonFixedType>
|
||||
stubsForPostponedVariables: Map<NewTypeVariable, StubType>
|
||||
): Pair<List<KotlinCallArgument>, InferenceSession?>
|
||||
|
||||
fun bindStubResolvedCallForCandidate(candidate: ResolvedCallAtom)
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.addSubsystemFromArgument
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.*
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
import org.jetbrains.kotlin.types.NonFixedType
|
||||
import org.jetbrains.kotlin.types.StubType
|
||||
import org.jetbrains.kotlin.types.TypeConstructor
|
||||
import org.jetbrains.kotlin.types.UnwrappedType
|
||||
import org.jetbrains.kotlin.types.typeUtil.builtIns
|
||||
@@ -19,8 +19,8 @@ class PostponedArgumentsAnalyzer(
|
||||
private val callableReferenceResolver: CallableReferenceResolver
|
||||
) {
|
||||
interface Context {
|
||||
fun buildCurrentSubstitutor(additionalBindings: Map<TypeConstructor, NonFixedType>): NewTypeSubstitutor
|
||||
fun bindingStubsForPostponedVariables(): Map<NewTypeVariable, NonFixedType>
|
||||
fun buildCurrentSubstitutor(additionalBindings: Map<TypeConstructor, StubType>): NewTypeSubstitutor
|
||||
fun bindingStubsForPostponedVariables(): Map<NewTypeVariable, StubType>
|
||||
|
||||
// type can be proper if it not contains not fixed type variables
|
||||
fun canBeProper(type: UnwrappedType): Boolean
|
||||
|
||||
+1
-2
@@ -20,11 +20,10 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutorByConstructorMap
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.NewTypeVariable
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.types.*
|
||||
|
||||
fun ConstraintStorage.buildCurrentSubstitutor(additionalBindings: Map<TypeConstructor, NonFixedType>): NewTypeSubstitutorByConstructorMap =
|
||||
fun ConstraintStorage.buildCurrentSubstitutor(additionalBindings: Map<TypeConstructor, StubType>): NewTypeSubstitutorByConstructorMap =
|
||||
NewTypeSubstitutorByConstructorMap(fixedTypeVariables.entries.associate { it.key to it.value } + additionalBindings)
|
||||
|
||||
fun ConstraintStorage.buildResultingSubstitutor(): NewTypeSubstitutor {
|
||||
|
||||
+4
-4
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.components.KotlinConstraintS
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.ResultTypeResolver
|
||||
import org.jetbrains.kotlin.resolve.calls.model.KotlinCallDiagnostic
|
||||
import org.jetbrains.kotlin.types.NonFixedType
|
||||
import org.jetbrains.kotlin.types.StubType
|
||||
import org.jetbrains.kotlin.types.TypeConstructor
|
||||
import org.jetbrains.kotlin.types.UnwrappedType
|
||||
import org.jetbrains.kotlin.types.typeUtil.contains
|
||||
@@ -273,14 +273,14 @@ class NewConstraintSystemImpl(
|
||||
return buildCurrentSubstitutor(emptyMap())
|
||||
}
|
||||
|
||||
override fun buildCurrentSubstitutor(additionalBindings: Map<TypeConstructor, NonFixedType>): NewTypeSubstitutor {
|
||||
override fun buildCurrentSubstitutor(additionalBindings: Map<TypeConstructor, StubType>): NewTypeSubstitutor {
|
||||
checkState(State.BUILDING, State.COMPLETION)
|
||||
return storage.buildCurrentSubstitutor(additionalBindings)
|
||||
}
|
||||
|
||||
override fun bindingStubsForPostponedVariables(): Map<NewTypeVariable, NonFixedType> {
|
||||
override fun bindingStubsForPostponedVariables(): Map<NewTypeVariable, StubType> {
|
||||
checkState(State.BUILDING, State.COMPLETION)
|
||||
return storage.postponedTypeVariables.associate { it to NonFixedType(it.freshTypeConstructor, it.defaultType.isMarkedNullable) }
|
||||
return storage.postponedTypeVariables.associate { it to StubType(it.freshTypeConstructor, it.defaultType.isMarkedNullable) }
|
||||
}
|
||||
|
||||
override fun currentStorage(): ConstraintStorage {
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
|
||||
// This type is used as a stub for postponed type variables, which are important for coroutine inference
|
||||
class NonFixedType(
|
||||
class StubType(
|
||||
private val originalTypeVariable: TypeConstructor,
|
||||
override val isMarkedNullable: Boolean,
|
||||
override val constructor: TypeConstructor =
|
||||
@@ -32,7 +32,7 @@ class NonFixedType(
|
||||
return if (newNullability == isMarkedNullable)
|
||||
this
|
||||
else
|
||||
NonFixedType(originalTypeVariable, newNullability, constructor, memberScope)
|
||||
StubType(originalTypeVariable, newNullability, constructor, memberScope)
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
@@ -186,7 +186,7 @@ object NewKotlinTypeChecker : KotlinTypeChecker {
|
||||
return StrictEqualityTypeChecker.strictEqualTypes(subType.makeNullableAsSpecified(false), superType.makeNullableAsSpecified(false))
|
||||
}
|
||||
|
||||
if (subType is NonFixedType || superType is NonFixedType) return true
|
||||
if (subType is StubType || superType is StubType) return true
|
||||
|
||||
if (superType is NewCapturedType && superType.lowerType != null) {
|
||||
when (getLowerCapturedTypePolicy(subType, superType)) {
|
||||
|
||||
Reference in New Issue
Block a user