FIR checker: make TypeApproximatorConfiguration.capturedType consistent with others

This commit is contained in:
Tianyu Geng
2021-07-21 09:50:13 -07:00
committed by TeamCityServer
parent 758859f198
commit bcf6582af7
2 changed files with 4 additions and 4 deletions
@@ -271,7 +271,7 @@ abstract class AbstractTypeApproximator(
}
val baseSubType = type.lowerType() ?: nothingType()
if (conf.capturedType(ctx, type)) {
if (!conf.capturedType(ctx, type)) {
/**
* Here everything is ok if bounds for this captured type should not be approximated.
* But. If such bounds contains some unauthorized types, then we cannot leave this captured type "as is".
@@ -27,7 +27,7 @@ open class TypeApproximatorConfiguration {
open val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean = { false }
open fun capturedType(ctx: TypeSystemInferenceExtensionContext, type: CapturedTypeMarker): Boolean =
false // true means that this type we can leave as is
true // false means that this type we can leave as is
abstract class AllFlexibleSameValue : TypeApproximatorConfiguration() {
abstract val allFlexible: Boolean
@@ -60,7 +60,7 @@ open class TypeApproximatorConfiguration {
// i.e. will be approximated only approximatedCapturedStatus captured types
override fun capturedType(ctx: TypeSystemInferenceExtensionContext, type: CapturedTypeMarker): Boolean =
type.captureStatus(ctx) != approximatedCapturedStatus
type.captureStatus(ctx) == approximatedCapturedStatus
override val intersection: IntersectionStrategy get() = IntersectionStrategy.ALLOWED
override val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean get() = { true }
@@ -86,7 +86,7 @@ open class TypeApproximatorConfiguration {
override val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean get() = { true }
override val errorType: Boolean get() = true
override fun capturedType(ctx: TypeSystemInferenceExtensionContext, type: CapturedTypeMarker): Boolean = true
override fun capturedType(ctx: TypeSystemInferenceExtensionContext, type: CapturedTypeMarker): Boolean = false
}
object UpperBoundAwareIntersectionTypeApproximator : AllFlexibleSameValue() {