We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eb53836 commit 11e97f1Copy full SHA for 11e97f1
src/lpython/semantics/python_ast_to_asr.cpp
@@ -3469,7 +3469,8 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
3469
throw SemanticError("slice indices must be integers or None", tmp->loc);
3470
}
3471
ASR::expr_t* val = ASRUtils::expr_value(ASRUtils::EXPR(tmp_step));
3472
- if (val != nullptr && ASR::down_cast<ASR::IntegerConstant_t>(val)->m_n == 0) {
+ int64_t const_value = 1;
3473
+ if (ASRUtils::is_value_constant(val, const_value) && const_value == 0) {
3474
throw SemanticError("slice step cannot be zero", tmp_step->loc);
3475
3476
ai.m_step = ASRUtils::EXPR(tmp);
0 commit comments