Skip to content

Commit 532893d

Browse files
committed
Set dest_type unconditionally
1 parent 25b4c0e commit 532893d

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,6 +2079,8 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
20792079
} else if ((right_is_int || left_is_int) && op == ASR::binopType::Mul) {
20802080
// string repeat
20812081
int64_t left_int = 0, right_int = 0, dest_len = 0;
2082+
dest_type = ASRUtils::TYPE(ASR::make_Character_t(al,
2083+
loc, 1, 1, nullptr));
20822084
if (right_is_int && ASRUtils::expr_value(right) != nullptr) {
20832085
ASR::Character_t *left_type2 = ASR::down_cast<ASR::Character_t>(
20842086
ASRUtils::type_get_past_array(left_type));
@@ -2087,9 +2089,6 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
20872089
ASRUtils::expr_value(right))->m_n;
20882090
dest_len = left_type2->m_len * right_int;
20892091
if (dest_len < 0) dest_len = 0;
2090-
dest_type = ASR::down_cast<ASR::ttype_t>(
2091-
ASR::make_Character_t(al, loc, left_type2->m_kind,
2092-
dest_len, nullptr));
20932092
} else if (left_is_int && ASRUtils::expr_value(left) != nullptr) {
20942093
ASR::Character_t *right_type2 = ASR::down_cast<ASR::Character_t>(
20952094
ASRUtils::type_get_past_array(right_type));
@@ -2098,13 +2097,6 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
20982097
ASRUtils::expr_value(left))->m_n;
20992098
dest_len = right_type2->m_len * left_int;
21002099
if (dest_len < 0) dest_len = 0;
2101-
dest_type = ASR::down_cast<ASR::ttype_t>(
2102-
ASR::make_Character_t(al, loc, right_type2->m_kind,
2103-
dest_len, nullptr));
2104-
} else if ((left_is_int && ASRUtils::expr_value(left) == nullptr)
2105-
|| (right_is_int && ASRUtils::expr_value(right) == nullptr)) {
2106-
dest_type = ASRUtils::TYPE(ASR::make_Character_t(al,
2107-
loc, 1, 1, nullptr));
21082100
}
21092101

21102102
if (ASRUtils::expr_value(left) != nullptr && ASRUtils::expr_value(right) != nullptr) {

0 commit comments

Comments
 (0)