File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -372,6 +372,7 @@ RUN(NAME test_list_07 LABELS cpython llvm c)
372
372
RUN (NAME test_list_08 LABELS cpython llvm c )
373
373
RUN (NAME test_list_09 LABELS cpython llvm c )
374
374
RUN (NAME test_list_10 LABELS cpython llvm c )
375
+ RUN (NAME test_list_11 LABELS cpython llvm c )
375
376
RUN (NAME test_list_section LABELS cpython llvm c )
376
377
RUN (NAME test_list_count LABELS cpython llvm )
377
378
RUN (NAME test_list_index LABELS cpython llvm )
Original file line number Diff line number Diff line change
1
+ from lpython import i32
2
+
3
+ def return_empty_list_of_tuples () -> list [i32 ]:
4
+ return []
5
+
6
+ def main0 ():
7
+ x : list [i32 ] = return_empty_list_of_tuples ()
8
+ print (len (x ))
9
+
10
+ assert len (x ) == 0
11
+
12
+ main0 ()
Original file line number Diff line number Diff line change @@ -6029,15 +6029,18 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
6029
6029
tmp = ASR::make_Return_t (al, x.base .base .loc );
6030
6030
return ;
6031
6031
}
6032
- this ->visit_expr (*x.m_value );
6033
- ASR::expr_t *value = ASRUtils::EXPR (tmp);
6034
6032
ASR::asr_t *return_var_ref = ASR::make_Var_t (al, x.base .base .loc , return_var);
6035
6033
ASR::expr_t *target = ASRUtils::EXPR (return_var_ref);
6036
6034
ASR::ttype_t *target_type = ASRUtils::expr_type (target);
6037
- ASR::ttype_t *value_type = ASRUtils::expr_type (value);
6038
6035
if ( ASR::is_a<ASR::Const_t>(*target_type) ) {
6039
6036
target_type = ASRUtils::get_contained_type (target_type);
6040
6037
}
6038
+ ASR::ttype_t * ann_assign_target_type_copy = ann_assign_target_type;
6039
+ ann_assign_target_type = target_type;
6040
+ this ->visit_expr (*x.m_value );
6041
+ ann_assign_target_type = ann_assign_target_type_copy;
6042
+ ASR::expr_t *value = ASRUtils::EXPR (tmp);
6043
+ ASR::ttype_t *value_type = ASRUtils::expr_type (value);
6041
6044
if ( ASR::is_a<ASR::Const_t>(*value_type) ) {
6042
6045
value_type = ASRUtils::get_contained_type (value_type);
6043
6046
}
You can’t perform that action at this time.
0 commit comments