Minor. Apply 'Simplify if'
This commit is contained in:
+3
-5
@@ -607,16 +607,14 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
context.trace.report(NOT_A_RETURN_LABEL.on(expression, expression.getLabelName()));
|
context.trace.report(NOT_A_RETURN_LABEL.on(expression, expression.getLabelName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnedExpression != null) {
|
if (returnedExpression != null) {
|
||||||
facade.getTypeInfo(returnedExpression, context.replaceExpectedType(expectedType).replaceScope(context.scope)
|
facade.getTypeInfo(returnedExpression, context.replaceExpectedType(expectedType).replaceScope(context.scope)
|
||||||
.replaceContextDependency(INDEPENDENT));
|
.replaceContextDependency(INDEPENDENT));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (expectedType != null &&
|
// for lambda with implicit return type Unit
|
||||||
!noExpectedType(expectedType) &&
|
if (!noExpectedType(expectedType) && !KotlinBuiltIns.isUnit(expectedType) && !isDontCarePlaceholder(expectedType)) {
|
||||||
!KotlinBuiltIns.isUnit(expectedType) &&
|
|
||||||
!isDontCarePlaceholder(expectedType)) // for lambda with implicit return type Unit
|
|
||||||
{
|
|
||||||
context.trace.report(RETURN_TYPE_MISMATCH.on(expression, expectedType));
|
context.trace.report(RETURN_TYPE_MISMATCH.on(expression, expectedType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user