Refactoring: noTypeCheckingErrorsInExpression introduced
This commit is contained in:
+9
-1
@@ -448,7 +448,7 @@ public class ControlStructureTypingUtils {
|
|||||||
KtExpression expression = (KtExpression) call.getCallElement();
|
KtExpression expression = (KtExpression) call.getCallElement();
|
||||||
if (status.hasOnlyErrorsDerivedFrom(EXPECTED_TYPE_POSITION) || status.hasConflictingConstraints()
|
if (status.hasOnlyErrorsDerivedFrom(EXPECTED_TYPE_POSITION) || status.hasConflictingConstraints()
|
||||||
|| status.hasTypeInferenceIncorporationError()) { // todo after KT-... remove this line
|
|| status.hasTypeInferenceIncorporationError()) { // todo after KT-... remove this line
|
||||||
if (Boolean.TRUE != expression.accept(checkTypeVisitor, new CheckTypeContext(context.trace, data.expectedType))) {
|
if (noTypeCheckingErrorsInExpression(expression, context.trace, data.expectedType)) {
|
||||||
KtExpression calleeExpression = call.getCalleeExpression();
|
KtExpression calleeExpression = call.getCalleeExpression();
|
||||||
if (calleeExpression instanceof KtWhenExpression || calleeExpression instanceof KtIfExpression) {
|
if (calleeExpression instanceof KtWhenExpression || calleeExpression instanceof KtIfExpression) {
|
||||||
if (status.hasConflictingConstraints() || status.hasTypeInferenceIncorporationError()) {
|
if (status.hasConflictingConstraints() || status.hasTypeInferenceIncorporationError()) {
|
||||||
@@ -463,6 +463,14 @@ public class ControlStructureTypingUtils {
|
|||||||
logError("Expression: " + (parentDeclaration != null ? parentDeclaration.getText() : expression.getText()) +
|
logError("Expression: " + (parentDeclaration != null ? parentDeclaration.getText() : expression.getText()) +
|
||||||
"\nConstraint system status: \n" + ConstraintsUtil.getDebugMessageForStatus(status));
|
"\nConstraint system status: \n" + ConstraintsUtil.getDebugMessageForStatus(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean noTypeCheckingErrorsInExpression(
|
||||||
|
KtExpression expression,
|
||||||
|
@NotNull BindingTrace trace,
|
||||||
|
@NotNull KotlinType expectedType
|
||||||
|
) {
|
||||||
|
return Boolean.TRUE != expression.accept(checkTypeVisitor, new CheckTypeContext(trace, expectedType));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user