diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java index f3c71c4b93d..82eb7a4247d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java @@ -65,7 +65,8 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor { @NotNull private DataFlowInfo checkCondition(@NotNull JetScope scope, @Nullable JetExpression condition, ExpressionTypingContext context) { if (condition != null) { - JetTypeInfo typeInfo = facade.getTypeInfo(condition, context.replaceScope(scope)); + JetTypeInfo typeInfo = facade.getTypeInfo(condition, context.replaceScope(scope) + .replaceExpectedType(KotlinBuiltIns.getInstance().getBooleanType())); JetType conditionType = typeInfo.getType(); if (conditionType != null && !isBoolean(conditionType)) {