[FE] Add ability to configure PublicDeclaration type approximation configuration
This configuration allows to choose what to do with local and anonymous types
This commit is contained in:
committed by
Space Team
parent
82c39187f6
commit
32f6b71525
+1
-1
@@ -139,7 +139,7 @@ class ResultTypeResolver(
|
||||
}
|
||||
|
||||
private fun KotlinTypeMarker.toPublicType(): KotlinTypeMarker =
|
||||
typeApproximator.approximateToSuperType(this, TypeApproximatorConfiguration.PublicDeclaration) ?: this
|
||||
typeApproximator.approximateToSuperType(this, TypeApproximatorConfiguration.PublicDeclaration.SaveAnonymousTypes) ?: this
|
||||
|
||||
private fun Context.isSuitableType(resultType: KotlinTypeMarker, variableWithConstraints: VariableWithConstraints): Boolean {
|
||||
val filteredConstraints = variableWithConstraints.constraints.filter { isProperTypeForFixation(it.type) }
|
||||
|
||||
+4
-1
@@ -52,12 +52,15 @@ open class TypeApproximatorConfiguration {
|
||||
override val intersectionTypesInContravariantPositions: Boolean get() = true
|
||||
}
|
||||
|
||||
object PublicDeclaration : AllFlexibleSameValue() {
|
||||
open class PublicDeclaration(override val localTypes: Boolean, override val anonymous: Boolean) : AllFlexibleSameValue() {
|
||||
override val allFlexible: Boolean get() = true
|
||||
override val errorType: Boolean get() = true
|
||||
override val definitelyNotNullType: Boolean get() = false
|
||||
override val integerLiteralConstantType: Boolean get() = true
|
||||
override val intersectionTypesInContravariantPositions: Boolean get() = true
|
||||
|
||||
object SaveAnonymousTypes : PublicDeclaration(localTypes = false, anonymous = false)
|
||||
object ApproximateAnonymousTypes : PublicDeclaration(localTypes = false, anonymous = true)
|
||||
}
|
||||
|
||||
sealed class AbstractCapturedTypesApproximation(val approximatedCapturedStatus: CaptureStatus?) :
|
||||
|
||||
Reference in New Issue
Block a user