KT-3574 Assertion error when using ?: in for range
#KT-3574 Fixed Do not assert that resolvedCall is non-null, since getRangeAsBinaryCall can return a BinaryCall that doesn't represent a range at all (as specified by the comment in getRangeAsBinaryCall)
This commit is contained in:
@@ -466,12 +466,11 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
RangeCodegenUtil.BinaryCall binaryCall = RangeCodegenUtil.getRangeAsBinaryCall(forExpression);
|
||||
if (binaryCall != null) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall = bindingContext.get(RESOLVED_CALL, binaryCall.op);
|
||||
assert resolvedCall != null;
|
||||
|
||||
CallableDescriptor rangeTo = resolvedCall.getResultingDescriptor();
|
||||
if (RangeCodegenUtil.isOptimizableRangeTo(rangeTo)) {
|
||||
generateForLoop(new ForInRangeLiteralLoopGenerator(forExpression, binaryCall));
|
||||
return StackValue.none();
|
||||
if (resolvedCall != null) {
|
||||
if (RangeCodegenUtil.isOptimizableRangeTo(resolvedCall.getResultingDescriptor())) {
|
||||
generateForLoop(new ForInRangeLiteralLoopGenerator(forExpression, binaryCall));
|
||||
return StackValue.none();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user