Create from usage: Fixed expected type for if-expression.

This commit is contained in:
Jack Zhou
2013-04-19 11:29:45 -04:00
committed by Jack Zhou
parent 48c825df06
commit e231397811
@@ -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)) {