Removed method 'hasTypeConstructorMismatchAt' from status

Used ConstraintError's instead
This commit is contained in:
Svetlana Isakova
2015-01-22 16:34:31 +03:00
parent 1d67c1edea
commit 279f09ee45
3 changed files with 3 additions and 17 deletions
@@ -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) }))
}
@@ -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
@@ -65,15 +65,6 @@ public trait ConstraintSystemStatus {
*/
public fun hasTypeConstructorMismatch(): Boolean
/**
* Returns <tt>true</tt> if there is type constructor mismatch error at a specific {@code constraintPosition}.
*
* For example, for <pre>fun &lt;R&gt; foo(t: List&lt;R&gt;) {}</pre> in invocation <tt>foo(hashSet("s"))</tt>
* there is type constructor mismatch: <tt>"HashSet&lt;String&gt; cannot be a subtype of List&lt;R&gt;"</tt>
* at a constraint position {@code ConstraintPosition.getValueParameterPosition(0)}.
*/
public fun hasTypeConstructorMismatchAt(constraintPosition: ConstraintPosition): Boolean
/**
* Returns <tt>true</tt> if there is type constructor mismatch only in constraintPosition or
* constraint system is successful without constraints from this position.