KT-552 For variable unresolved if loop body is not block
=== for(index in 0..9) x[index] = index.byt // <-- index is inresolved here ===
This commit is contained in:
+2
-1
@@ -216,7 +216,8 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
|
|
||||||
JetExpression body = expression.getBody();
|
JetExpression body = expression.getBody();
|
||||||
if (body != null) {
|
if (body != null) {
|
||||||
facade.getType(body, context.replaceScope(loopScope));
|
ExpressionTypingInternals blockLevelVisitor = ExpressionTypingVisitorDispatcher.createForBlock(loopScope);
|
||||||
|
blockLevelVisitor.getType(body, context.replaceScope(loopScope));
|
||||||
}
|
}
|
||||||
|
|
||||||
return DataFlowUtils.checkType(JetStandardClasses.getUnitType(), expression, contextWithExpectedType);
|
return DataFlowUtils.checkType(JetStandardClasses.getUnitType(), expression, contextWithExpectedType);
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// http://youtrack.jetbrains.net/issue/KT-552
|
||||||
|
// KT-552 For variable unresolved if loop body is not block
|
||||||
|
|
||||||
|
fun ff() {
|
||||||
|
var i = 1
|
||||||
|
for (j in 1..10)
|
||||||
|
i += j
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user