FIR checker: make TypeApproximatorConfiguration.capturedType consistent with others
This commit is contained in:
committed by
TeamCityServer
parent
758859f198
commit
bcf6582af7
+1
-1
@@ -271,7 +271,7 @@ abstract class AbstractTypeApproximator(
|
|||||||
}
|
}
|
||||||
val baseSubType = type.lowerType() ?: nothingType()
|
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.
|
* 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".
|
* But. If such bounds contains some unauthorized types, then we cannot leave this captured type "as is".
|
||||||
|
|||||||
+3
-3
@@ -27,7 +27,7 @@ open class TypeApproximatorConfiguration {
|
|||||||
|
|
||||||
open val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean = { false }
|
open val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean = { false }
|
||||||
open fun capturedType(ctx: TypeSystemInferenceExtensionContext, type: CapturedTypeMarker): Boolean =
|
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 class AllFlexibleSameValue : TypeApproximatorConfiguration() {
|
||||||
abstract val allFlexible: Boolean
|
abstract val allFlexible: Boolean
|
||||||
@@ -60,7 +60,7 @@ open class TypeApproximatorConfiguration {
|
|||||||
|
|
||||||
// i.e. will be approximated only approximatedCapturedStatus captured types
|
// i.e. will be approximated only approximatedCapturedStatus captured types
|
||||||
override fun capturedType(ctx: TypeSystemInferenceExtensionContext, type: CapturedTypeMarker): Boolean =
|
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 intersection: IntersectionStrategy get() = IntersectionStrategy.ALLOWED
|
||||||
override val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean get() = { true }
|
override val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean get() = { true }
|
||||||
@@ -86,7 +86,7 @@ open class TypeApproximatorConfiguration {
|
|||||||
override val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean get() = { true }
|
override val typeVariable: (TypeVariableTypeConstructorMarker) -> Boolean get() = { true }
|
||||||
override val errorType: 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() {
|
object UpperBoundAwareIntersectionTypeApproximator : AllFlexibleSameValue() {
|
||||||
|
|||||||
Reference in New Issue
Block a user