From e2313978117a382f9e759fa0434eb7c6d3ff1ba0 Mon Sep 17 00:00:00 2001 From: Jack Zhou Date: Fri, 19 Apr 2013 11:29:45 -0400 Subject: [PATCH] Create from usage: Fixed expected type for if-expression. --- .../lang/types/expressions/ControlStructureTypingVisitor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)) {