Removed method 'hasTypeConstructorMismatchAt' from status
Used ConstraintError's instead
This commit is contained in:
@@ -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) }))
|
||||
}
|
||||
|
||||
|
||||
|
||||
-3
@@ -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
|
||||
|
||||
-9
@@ -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 <R> foo(t: List<R>) {}</pre> in invocation <tt>foo(hashSet("s"))</tt>
|
||||
* there is type constructor mismatch: <tt>"HashSet<String> cannot be a subtype of List<R>"</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.
|
||||
|
||||
Reference in New Issue
Block a user