Optimize ConstraintInjector::isMyTypeVariable
Do not look into the map for constructors that are not type variables
This commit is contained in:
@@ -11,18 +11,17 @@ import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.CapturedType
|
||||
import org.jetbrains.kotlin.resolve.constants.IntegerLiteralTypeConstructor
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.hasExactAnnotation
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.hasNoInferAnnotation
|
||||
import org.jetbrains.kotlin.resolve.constants.IntegerLiteralTypeConstructor
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isExactAnnotation
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.model.*
|
||||
import org.jetbrains.kotlin.types.model.CaptureStatus
|
||||
import org.jetbrains.kotlin.types.typeUtil.asTypeProjection
|
||||
import org.jetbrains.kotlin.types.typeUtil.contains
|
||||
import kotlin.math.max
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.contract
|
||||
import kotlin.math.max
|
||||
|
||||
interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext {
|
||||
override fun TypeConstructorMarker.isDenotable(): Boolean {
|
||||
@@ -376,6 +375,10 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext {
|
||||
errorSupportedOnlyInTypeInference()
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.mayBeTypeVariable(): Boolean {
|
||||
errorSupportedOnlyInTypeInference()
|
||||
}
|
||||
|
||||
override fun CapturedTypeMarker.typeConstructorProjection(): TypeArgumentMarker {
|
||||
require(this is NewCapturedType, this::errorMessage)
|
||||
return this.constructor.projection
|
||||
@@ -563,4 +566,4 @@ fun requireOrDescribe(condition: Boolean, value: Any?) {
|
||||
} else ""
|
||||
"Unexpected: value = '$value'$typeInfo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +122,7 @@ interface TypeSystemInferenceExtensionContext : TypeSystemContext, TypeSystemBui
|
||||
|
||||
fun TypeVariableMarker.freshTypeConstructor(): TypeConstructorMarker
|
||||
|
||||
fun KotlinTypeMarker.mayBeTypeVariable(): Boolean
|
||||
|
||||
fun CapturedTypeMarker.typeConstructorProjection(): TypeArgumentMarker
|
||||
fun CapturedTypeMarker.captureStatus(): CaptureStatus
|
||||
|
||||
Reference in New Issue
Block a user