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 bf042a4 commit 72d7988Copy full SHA for 72d7988
src/lpython/semantics/python_ast_to_asr.cpp
@@ -3460,7 +3460,8 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
3460
throw SemanticError("slice indices must be integers or None", tmp->loc);
3461
}
3462
ASR::expr_t* val = ASRUtils::expr_value(ASRUtils::EXPR(tmp_step));
3463
- if (val != nullptr && ASR::down_cast<ASR::IntegerConstant_t>(val)->m_n == 0) {
+ int64_t const_value = 1;
3464
+ if (ASRUtils::is_value_constant(val, const_value) && const_value == 0) {
3465
throw SemanticError("slice step cannot be zero", tmp_step->loc);
3466
3467
ai.m_step = ASRUtils::EXPR(tmp);
0 commit comments