Abstract TypeApproximator from NewCapturedType

This commit is contained in:
Simon Ogorodnik
2019-04-08 15:46:57 +03:00
parent 9306f3840f
commit 57a3b1a773
4 changed files with 30 additions and 13 deletions
@@ -481,6 +481,11 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext {
require(constructor is TypeConstructor, constructor::errorMessage)
return ErrorUtils.createErrorTypeWithCustomConstructor(debugName, constructor)
}
override fun TypeConstructorMarker.isCapturedTypeConstructor(): Boolean {
return this is NewCapturedTypeConstructor
}
}
private fun captureFromExpressionInternal(type: UnwrappedType) = captureFromExpression(type)
@@ -22,4 +22,9 @@ fun KotlinTypeMarker.dependsOnTypeParameters(c: TypeSystemInferenceExtensionCont
with(c) {
val typeConstructors = typeParameters.mapTo(mutableSetOf()) { it.getTypeConstructor() }
dependsOnTypeConstructor(c, typeConstructors)
}
fun CapturedTypeMarker.captureStatus(c: TypeSystemInferenceExtensionContext) =
with(c) {
captureStatus()
}
@@ -24,6 +24,7 @@ interface StubTypeMarker : SimpleTypeMarker
interface TypeArgumentListMarker
interface TypeVariableMarker
interface TypeVariableTypeConstructorMarker : TypeConstructorMarker
interface TypeSubstitutorMarker
@@ -88,6 +89,8 @@ interface TypeSystemInferenceExtensionContext : TypeSystemContext, TypeSystemBui
fun TypeConstructorMarker.getApproximatedIntegerLiteralType(): KotlinTypeMarker
fun TypeConstructorMarker.isCapturedTypeConstructor(): Boolean
fun Collection<KotlinTypeMarker>.singleBestRepresentative(): KotlinTypeMarker?
fun KotlinTypeMarker.isUnit(): Boolean