Minor. Simplify ConstraintSystemUtilContext::createArgumentConstraintPosition
This commit is contained in:
committed by
teamcityserver
parent
9c7982673b
commit
dac5c31993
+5
-3
@@ -44,9 +44,11 @@ object ConeConstraintSystemUtilContext : ConstraintSystemUtilContext {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <T> createArgumentConstraintPosition(argument: T): ArgumentConstraintPosition<T> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return ConeArgumentConstraintPosition() as ArgumentConstraintPosition<T>
|
||||
override fun createArgumentConstraintPosition(argument: PostponedAtomWithRevisableExpectedType): ArgumentConstraintPosition<*> {
|
||||
require(argument is PostponedResolvedAtom) {
|
||||
"${argument::class}"
|
||||
}
|
||||
return ConeArgumentConstraintPosition(argument.atom)
|
||||
}
|
||||
|
||||
override fun <T> createFixVariableConstraintPosition(variable: TypeVariableMarker, atom: T): FixVariableConstraintPosition<T> {
|
||||
|
||||
+1
-2
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.resolve.calls.inference.model.ArgumentConstraintPosi
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.FixVariableConstraintPosition
|
||||
import org.jetbrains.kotlin.resolve.calls.model.PostponedAtomWithRevisableExpectedType
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeConstructorMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeVariableMarker
|
||||
|
||||
/*
|
||||
@@ -25,7 +24,7 @@ interface ConstraintSystemUtilContext {
|
||||
fun KotlinTypeMarker.refineType(): KotlinTypeMarker
|
||||
|
||||
// PostponedArgumentInputTypesResolver
|
||||
fun <T> createArgumentConstraintPosition(argument: T): ArgumentConstraintPosition<T>
|
||||
fun createArgumentConstraintPosition(argument: PostponedAtomWithRevisableExpectedType): ArgumentConstraintPosition<*>
|
||||
fun <T> createFixVariableConstraintPosition(variable: TypeVariableMarker, atom: T): FixVariableConstraintPosition<T>
|
||||
fun extractLambdaParameterTypesFromDeclaration(declaration: PostponedAtomWithRevisableExpectedType): List<KotlinTypeMarker?>?
|
||||
fun PostponedAtomWithRevisableExpectedType.isAnonymousFunction(): Boolean
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ abstract class DeclaredUpperBoundConstraintPosition<T>(val typeParameter: T) : C
|
||||
override fun toString(): String = "DeclaredUpperBound $typeParameter"
|
||||
}
|
||||
|
||||
abstract class ArgumentConstraintPosition<T>(val argument: T) : ConstraintPosition(), OnlyInputTypeConstraintPosition {
|
||||
abstract class ArgumentConstraintPosition<out T>(val argument: T) : ConstraintPosition(), OnlyInputTypeConstraintPosition {
|
||||
override fun toString(): String = "Argument $argument"
|
||||
}
|
||||
|
||||
|
||||
+3
-6
@@ -5,8 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.calls.inference.components
|
||||
|
||||
import org.jetbrains.kotlin.builtins.*
|
||||
import org.jetbrains.kotlin.builtins.getPureArgumentsForFunctionalTypeOrSubtype
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.resolve.calls.components.CreateFreshVariablesSubstitutor.shouldBeFlexible
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.PostponedArgumentInputTypesResolver.Companion.TYPE_VARIABLE_NAME_FOR_CR_RETURN_TYPE
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.PostponedArgumentInputTypesResolver.Companion.TYPE_VARIABLE_NAME_FOR_LAMBDA_RETURN_TYPE
|
||||
@@ -17,7 +16,6 @@ import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeConstructorMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeVariableMarker
|
||||
import org.jetbrains.kotlin.types.refinement.TypeRefinement
|
||||
import org.jetbrains.kotlin.types.typeUtil.unCapture as unCaptureKotlinType
|
||||
@@ -51,10 +49,9 @@ class ClassicConstraintSystemUtilContext(
|
||||
return kotlinTypeRefiner.refineType(this)
|
||||
}
|
||||
|
||||
override fun <T> createArgumentConstraintPosition(argument: T): ArgumentConstraintPosition<T> {
|
||||
override fun createArgumentConstraintPosition(argument: PostponedAtomWithRevisableExpectedType): ArgumentConstraintPosition<*> {
|
||||
require(argument is ResolvedAtom)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return ArgumentConstraintPositionImpl(argument.atom as KotlinCallArgument) as ArgumentConstraintPosition<T>
|
||||
return ArgumentConstraintPositionImpl(argument.atom as KotlinCallArgument)
|
||||
}
|
||||
|
||||
override fun <T> createFixVariableConstraintPosition(variable: TypeVariableMarker, atom: T): FixVariableConstraintPosition<T> {
|
||||
|
||||
Reference in New Issue
Block a user