[NI] Report error from expected type constraint position

This commit is contained in:
Mikhail Zarechenskiy
2017-11-15 11:39:41 +03:00
parent d4d3f237ee
commit ca035bc8b8
@@ -201,6 +201,14 @@ class DiagnosticReporterByTrackingStrategy(
if (reportConstantTypeMismatch(constraintError, deparenthesized)) return
trace.report(Errors.TYPE_MISMATCH.on(deparenthesized, constraintError.upperType, constraintError.lowerType))
}
(position as? ExpectedTypeConstraintPosition)?.let {
val call = it.topLevelCall.psiKotlinCall.psiCall.callElement.safeAs<KtExpression>()
reportIfNonNull(call) {
trace.report(Errors.TYPE_MISMATCH.on(it, constraintError.upperType, constraintError.lowerType))
}
}
(position as? ExplicitTypeParameterConstraintPosition)?.let {
val typeArgumentReference = (it.typeArgument as SimpleTypeArgumentImpl).typeReference
trace.report(UPPER_BOUND_VIOLATED.on(typeArgumentReference, constraintError.upperType, constraintError.lowerType))