Create from usage: Fixed expected type for if-expression.
This commit is contained in:
+2
-1
@@ -65,7 +65,8 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private DataFlowInfo checkCondition(@NotNull JetScope scope, @Nullable JetExpression condition, ExpressionTypingContext context) {
|
private DataFlowInfo checkCondition(@NotNull JetScope scope, @Nullable JetExpression condition, ExpressionTypingContext context) {
|
||||||
if (condition != null) {
|
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();
|
JetType conditionType = typeInfo.getType();
|
||||||
|
|
||||||
if (conditionType != null && !isBoolean(conditionType)) {
|
if (conditionType != null && !isBoolean(conditionType)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user