Unwrap block expressions to report errors on them about not enough type information

^KT-44055 Fixed
This commit is contained in:
Victor Petukhov
2020-12-24 13:47:48 +03:00
parent 4c56962678
commit 9afc13f002
3 changed files with 63 additions and 1 deletions
@@ -461,7 +461,11 @@ class DiagnosticReporterByTrackingStrategy(
is TypeVariableForLambdaReturnType -> "return type of lambda"
else -> error("Unsupported type variable: $typeVariable")
}
trace.reportDiagnosticOnce(NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER.on(expression, typeVariableName))
val unwrappedExpression = if (expression is KtBlockExpression) {
expression.statements.lastOrNull() ?: expression
} else expression
trace.reportDiagnosticOnce(NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER.on(unwrappedExpression, typeVariableName))
}
}