From 279f09ee458e4c2245546d9ae65b04f048bb2a1d Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Thu, 22 Jan 2015 16:34:31 +0300 Subject: [PATCH] Removed method 'hasTypeConstructorMismatchAt' from status Used ConstraintError's instead --- .../jetbrains/kotlin/diagnostics/rendering/Renderers.kt | 8 +++----- .../resolve/calls/inference/ConstraintSystemImpl.kt | 3 --- .../resolve/calls/inference/ConstraintSystemStatus.kt | 9 --------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/Renderers.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/Renderers.kt index 8f2f74b2870..f705323b040 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/Renderers.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/Renderers.kt @@ -188,10 +188,8 @@ public object Renderers { public fun renderTypeConstructorMismatchError( inferenceErrorData: InferenceErrorData, renderer: TabledDescriptorRenderer ): TabledDescriptorRenderer { - val isErrorPosition = Predicate { - (constraintPosition: ConstraintPosition) -> - inferenceErrorData.constraintSystem.getStatus().hasTypeConstructorMismatchAt(constraintPosition) - } + val constraintErrors = (inferenceErrorData.constraintSystem as ConstraintSystemImpl).constraintErrors + val errorPositions = constraintErrors.filter { it is TypeConstructorMismatch }.map { it.constraintPosition } return renderer.table( TabledDescriptorRenderer .newTable() @@ -199,7 +197,7 @@ public object Renderers { .text("cannot be applied to") .functionArgumentTypeList(inferenceErrorData.receiverArgumentType, inferenceErrorData.valueArgumentsTypes, - isErrorPosition)) + { errorPositions.contains(it) })) } diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt index 959b205a78c..1263450de12 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt @@ -71,9 +71,6 @@ public class ConstraintSystemImpl : ConstraintSystem { override fun hasTypeConstructorMismatch() = errors.any { it is TypeConstructorMismatch } - override fun hasTypeConstructorMismatchAt(constraintPosition: ConstraintPosition) = - errors.any { it is TypeConstructorMismatch && it.constraintPosition == constraintPosition } - override fun hasOnlyErrorsFromPosition(constraintPosition: ConstraintPosition): Boolean { if (isSuccessful()) return false if (filterConstraintsOut(constraintPosition).getStatus().isSuccessful()) return true diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemStatus.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemStatus.kt index a80178c13fb..367ec7c1479 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemStatus.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemStatus.kt @@ -65,15 +65,6 @@ public trait ConstraintSystemStatus { */ public fun hasTypeConstructorMismatch(): Boolean - /** - * Returns true if there is type constructor mismatch error at a specific {@code constraintPosition}. - * - * For example, for
fun <R> foo(t: List<R>) {}
in invocation foo(hashSet("s")) - * there is type constructor mismatch: "HashSet<String> cannot be a subtype of List<R>" - * at a constraint position {@code ConstraintPosition.getValueParameterPosition(0)}. - */ - public fun hasTypeConstructorMismatchAt(constraintPosition: ConstraintPosition): Boolean - /** * Returns true if there is type constructor mismatch only in constraintPosition or * constraint system is successful without constraints from this position.