From 049fbc669c84030c8f58a5bd13ca34a6a17dbd93 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Sun, 16 Jul 2023 07:05:58 +0530 Subject: [PATCH 01/30] fix: check dependencies are from same symbol table --- src/libasr/asr_verify.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index 34c05e48b1..be8f35ec66 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -440,6 +440,16 @@ class VerifyVisitor : public BaseWalkVisitor verify_unique_dependencies(x.m_dependencies, x.n_dependencies, x.m_name, x.base.base.loc); + // Dependencies of the function should be from the same symbol table. + for( size_t i = 0; i < x.n_dependencies; i++ ) { + std::string found_dep = x.m_dependencies[i]; + std::cout << "Function Name: " << x.m_name << " Dependency: " << found_dep << std::endl; + // Check if the dependency is present in the same symtab of function. + require_with_loc(current_symtab->get_symbol(found_dep) != nullptr, + "Symbol " + found_dep + " is not found in the current " + "symbol table for " + x.m_name, x.base.base.loc); + } + // Check if there are unnecessary dependencies // present in the dependency list of the function for( size_t i = 0; i < x.n_dependencies; i++ ) { From fc86d98c77384e8f37f21c9c77d9470fdfeed8c8 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Sun, 16 Jul 2023 07:08:16 +0530 Subject: [PATCH 02/30] fix: remove print statement --- src/libasr/asr_verify.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index be8f35ec66..77e31476c6 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -443,7 +443,6 @@ class VerifyVisitor : public BaseWalkVisitor // Dependencies of the function should be from the same symbol table. for( size_t i = 0; i < x.n_dependencies; i++ ) { std::string found_dep = x.m_dependencies[i]; - std::cout << "Function Name: " << x.m_name << " Dependency: " << found_dep << std::endl; // Check if the dependency is present in the same symtab of function. require_with_loc(current_symtab->get_symbol(found_dep) != nullptr, "Symbol " + found_dep + " is not found in the current " From 42d5146506ca769a629dfeb2e0350363468634fe Mon Sep 17 00:00:00 2001 From: arteevraina Date: Mon, 17 Jul 2023 13:52:21 +0530 Subject: [PATCH 03/30] fix: update verify logic --- src/libasr/asr_verify.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index 77e31476c6..ac2f632667 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -440,13 +440,18 @@ class VerifyVisitor : public BaseWalkVisitor verify_unique_dependencies(x.m_dependencies, x.n_dependencies, x.m_name, x.base.base.loc); - // Dependencies of the function should be from the same symbol table. + // Dependencies of the function should be from same symbol table. for( size_t i = 0; i < x.n_dependencies; i++ ) { std::string found_dep = x.m_dependencies[i]; - // Check if the dependency is present in the same symtab of function. - require_with_loc(current_symtab->get_symbol(found_dep) != nullptr, - "Symbol " + found_dep + " is not found in the current " - "symbol table for " + x.m_name, x.base.base.loc); + + // Get the x symtab. + SymbolTable *sym = x.m_symtab->parent; + + // Get the symtab of the dependency. + ASR::symbol_t* dep_sym = sym->get_symbol(found_dep); + + require(dep_sym != nullptr, + "Dependency " + found_dep + " and function " + std::string(x.m_name) + " does not belong to same symbol table"); } // Check if there are unnecessary dependencies From 4805b693d7a2997677a18911e621e1cc60a28958 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Tue, 18 Jul 2023 12:57:26 +0530 Subject: [PATCH 04/30] fix: update logic for verification of dependencies --- src/libasr/asr_verify.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index ac2f632667..1f37ddaf76 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -401,6 +401,7 @@ class VerifyVisitor : public BaseWalkVisitor } void visit_Function(const Function_t &x) { + std::cout << "X name " << x.m_name << std::endl; std::vector function_dependencies_copy = function_dependencies; function_dependencies.clear(); function_dependencies.reserve(x.n_dependencies); @@ -440,18 +441,18 @@ class VerifyVisitor : public BaseWalkVisitor verify_unique_dependencies(x.m_dependencies, x.n_dependencies, x.m_name, x.base.base.loc); - // Dependencies of the function should be from same symbol table. + // Get the x symtab. + SymbolTable *sym = x.m_symtab; + + // Dependencies of the function should be from function's symbol table. for( size_t i = 0; i < x.n_dependencies; i++ ) { std::string found_dep = x.m_dependencies[i]; - // Get the x symtab. - SymbolTable *sym = x.m_symtab->parent; - - // Get the symtab of the dependency. + // Get the symbol of the found_dep. ASR::symbol_t* dep_sym = sym->get_symbol(found_dep); require(dep_sym != nullptr, - "Dependency " + found_dep + " and function " + std::string(x.m_name) + " does not belong to same symbol table"); + "Dependency " + found_dep + " does not belong to same symbol table of " + std::string(x.m_name)); } // Check if there are unnecessary dependencies From 71bee6619af410087a43cc928343ed461ea39a8a Mon Sep 17 00:00:00 2001 From: arteevraina Date: Tue, 18 Jul 2023 16:46:04 +0530 Subject: [PATCH 05/30] refactor: remove cout --- src/libasr/asr_verify.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index 1f37ddaf76..dca530e330 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -401,7 +401,6 @@ class VerifyVisitor : public BaseWalkVisitor } void visit_Function(const Function_t &x) { - std::cout << "X name " << x.m_name << std::endl; std::vector function_dependencies_copy = function_dependencies; function_dependencies.clear(); function_dependencies.reserve(x.n_dependencies); From 70f2f9cc6f282ce52902911fb05180377b9221e2 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Tue, 18 Jul 2023 21:28:12 +0530 Subject: [PATCH 06/30] fix: get the parent symtab of x --- src/libasr/asr_verify.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index dca530e330..660ebe2c65 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -441,7 +441,7 @@ class VerifyVisitor : public BaseWalkVisitor x.m_name, x.base.base.loc); // Get the x symtab. - SymbolTable *sym = x.m_symtab; + SymbolTable *sym = x.m_symtab->parent; // Dependencies of the function should be from function's symbol table. for( size_t i = 0; i < x.n_dependencies; i++ ) { From a2e802bb2bee446640e65d37dd291e816bae6f50 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Tue, 18 Jul 2023 22:58:13 +0530 Subject: [PATCH 07/30] fix: skip the symbols which are nullptr or of type External Symbol --- src/libasr/asr_verify.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index 660ebe2c65..1e7ee1c734 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -450,8 +450,13 @@ class VerifyVisitor : public BaseWalkVisitor // Get the symbol of the found_dep. ASR::symbol_t* dep_sym = sym->get_symbol(found_dep); + // If dep_sym is External Symbol or nullptr. It should be skipped. + if (dep_sym == nullptr || ASR::is_a(*dep_sym)) { + continue; + } + require(dep_sym != nullptr, - "Dependency " + found_dep + " does not belong to same symbol table of " + std::string(x.m_name)); + "Dependency " + found_dep + " does not belong to same parent symbol table of " + std::string(x.m_name)); } // Check if there are unnecessary dependencies From 8d8bbc7769792d68598f041ce85b102fac0a0e8a Mon Sep 17 00:00:00 2001 From: arteevraina Date: Wed, 19 Jul 2023 22:39:55 +0530 Subject: [PATCH 08/30] fix: update cmakelists --- integration_tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index dc17f72d8c..e566c36bc8 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -694,7 +694,7 @@ RUN(NAME global_syms_01 LABELS cpython llvm c) RUN(NAME global_syms_02 LABELS cpython llvm c) RUN(NAME global_syms_03_b LABELS cpython llvm c) RUN(NAME global_syms_03_c LABELS cpython llvm c) -RUN(NAME global_syms_04 LABELS cpython llvm c wasm wasm_x64) +RUN(NAME global_syms_04 LABELS cpython llvm c wasm wasm_x64 NOFAST) RUN(NAME global_syms_05 LABELS cpython llvm c) RUN(NAME global_syms_06 LABELS cpython llvm c) From c1116e3b9b87bb52f0a65a48b423e93be4635dab Mon Sep 17 00:00:00 2001 From: arteevraina Date: Wed, 26 Jul 2023 13:49:43 +0530 Subject: [PATCH 09/30] fix: check while adding dependencies to make sure they are from same symtab --- src/libasr/asr_utils.cpp | 16 ++++++++++++---- src/libasr/asr_utils.h | 4 +++- src/libasr/asr_verify.cpp | 20 ++++++++++++-------- src/libasr/pass/instantiate_template.cpp | 16 ++++++++++++---- src/libasr/pass/pass_utils.h | 4 ++-- src/lpython/semantics/python_ast_to_asr.cpp | 13 ++++++++++--- 6 files changed, 51 insertions(+), 22 deletions(-) diff --git a/src/libasr/asr_utils.cpp b/src/libasr/asr_utils.cpp index b4b188883c..820a5c64bd 100644 --- a/src/libasr/asr_utils.cpp +++ b/src/libasr/asr_utils.cpp @@ -616,7 +616,9 @@ bool use_overloaded(ASR::expr_t* left, ASR::expr_t* right, } } } - current_function_dependencies.push_back(al, s2c(al, matched_func_name)); + if (ASRUtils::symbol_parent_symtab(a_name) == curr_scope->parent) { + current_function_dependencies.push_back(al, s2c(al, matched_func_name)); + } ASRUtils::insert_module_dependency(a_name, al, current_module_dependencies); ASRUtils::set_absent_optional_arguments_to_null(a_args, func, al); asr = ASRUtils::make_FunctionCall_t_util(al, loc, a_name, sym, @@ -699,7 +701,9 @@ void process_overloaded_unary_minus_function(ASR::symbol_t* proc, ASR::expr_t* o } } } - current_function_dependencies.push_back(al, s2c(al, matched_func_name)); + if (ASRUtils::symbol_parent_symtab(a_name) == curr_scope->parent) { + current_function_dependencies.push_back(al, s2c(al, matched_func_name)); + } ASRUtils::insert_module_dependency(a_name, al, current_module_dependencies); ASRUtils::set_absent_optional_arguments_to_null(a_args, func, al); asr = ASRUtils::make_FunctionCall_t_util(al, loc, a_name, proc, @@ -870,7 +874,9 @@ void process_overloaded_assignment_function(ASR::symbol_t* proc, ASR::expr_t* ta if( a_name == nullptr ) { err("Unable to resolve matched subroutine for assignment overloading, " + matched_subrout_name, loc); } - current_function_dependencies.push_back(al, s2c(al, matched_subrout_name)); + if (ASRUtils::symbol_parent_symtab(a_name) == curr_scope->parent) { + current_function_dependencies.push_back(al, s2c(al, matched_subrout_name)); + } ASRUtils::insert_module_dependency(a_name, al, current_module_dependencies); ASRUtils::set_absent_optional_arguments_to_null(a_args, subrout, al); asr = ASRUtils::make_SubroutineCall_t_util(al, loc, a_name, sym, @@ -1010,7 +1016,9 @@ bool use_overloaded(ASR::expr_t* left, ASR::expr_t* right, } else { return_type = ASRUtils::expr_type(func->m_return_var); } - current_function_dependencies.push_back(al, s2c(al, matched_func_name)); + if (ASRUtils::symbol_parent_symtab(a_name) == curr_scope->parent) { + current_function_dependencies.push_back(al, s2c(al, matched_func_name)); + } ASRUtils::insert_module_dependency(a_name, al, current_module_dependencies); ASRUtils::set_absent_optional_arguments_to_null(a_args, func, al); asr = ASRUtils::make_FunctionCall_t_util(al, loc, a_name, sym, diff --git a/src/libasr/asr_utils.h b/src/libasr/asr_utils.h index 8500acefaa..2ec1cffd1f 100644 --- a/src/libasr/asr_utils.h +++ b/src/libasr/asr_utils.h @@ -3015,7 +3015,9 @@ class ReplaceArgVisitor: public ASR::BaseExprReplacer { default: break; } - current_function_dependencies.push_back(al, ASRUtils::symbol_name(new_es)); + if (ASRUtils::symbol_parent_symtab(new_es) == current_scope->parent) { + current_function_dependencies.push_back(al, ASRUtils::symbol_name(new_es)); + } ASRUtils::insert_module_dependency(new_es, al, current_module_dependencies); x->m_name = new_es; } diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index 1e7ee1c734..3990298e5f 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -450,13 +450,8 @@ class VerifyVisitor : public BaseWalkVisitor // Get the symbol of the found_dep. ASR::symbol_t* dep_sym = sym->get_symbol(found_dep); - // If dep_sym is External Symbol or nullptr. It should be skipped. - if (dep_sym == nullptr || ASR::is_a(*dep_sym)) { - continue; - } - require(dep_sym != nullptr, - "Dependency " + found_dep + " does not belong to same parent symbol table of " + std::string(x.m_name)); + "Dependency " + found_dep + " was not found in the parent symbol table " + std::string(x.m_name)); } // Check if there are unnecessary dependencies @@ -886,7 +881,11 @@ class VerifyVisitor : public BaseWalkVisitor } } - function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); + if (ASRUtils::symbol_parent_symtab(x.m_name) == current_symtab->parent) { + // add to dependencies + function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); + } + if( ASR::is_a(*x.m_name) ) { ASR::ExternalSymbol_t* x_m_name = ASR::down_cast(x.m_name); if( x_m_name->m_external && ASR::is_a(*ASRUtils::get_asr_owner(x_m_name->m_external)) ) { @@ -1007,7 +1006,12 @@ class VerifyVisitor : public BaseWalkVisitor void visit_FunctionCall(const FunctionCall_t &x) { require(x.m_name, "FunctionCall::m_name must be present"); - function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); + // Check x.m_name is from parent sym tab. + if (ASRUtils::symbol_parent_symtab(x.m_name) == current_symtab->parent) { + // add to dependencies + function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); + } + if( ASR::is_a(*x.m_name) ) { ASR::ExternalSymbol_t* x_m_name = ASR::down_cast(x.m_name); if( x_m_name->m_external && ASR::is_a(*ASRUtils::get_asr_owner(x_m_name->m_external)) ) { diff --git a/src/libasr/pass/instantiate_template.cpp b/src/libasr/pass/instantiate_template.cpp index 063175a5d5..099501b801 100644 --- a/src/libasr/pass/instantiate_template.cpp +++ b/src/libasr/pass/instantiate_template.cpp @@ -346,7 +346,9 @@ class SymbolInstantiator : public ASR::BaseExprStmtDuplicator(name2)); context_map[ASRUtils::symbol_name(name2)] = ASRUtils::symbol_name(name); } - dependencies.push_back(al, ASRUtils::symbol_name(name)); + if (ASRUtils::symbol_parent_symtab(name) == template_scope->parent) { + dependencies.push_back(al, ASRUtils::symbol_name(name)); + } return ASRUtils::make_FunctionCall_t_util(al, x->base.base.loc, name, x->m_original_name, args.p, args.size(), type, value, dt); } @@ -372,7 +374,9 @@ class SymbolInstantiator : public ASR::BaseExprStmtDuplicatorparent) { + dependencies.push_back(al, ASRUtils::symbol_name(name)); + } return ASRUtils::make_SubroutineCall_t_util(al, x->base.base.loc, name /* change this */, x->m_original_name, args.p, args.size(), dt, nullptr, false); } @@ -846,7 +850,9 @@ class FunctionInstantiator : public ASR::BaseExprStmtDuplicator(nested_generic_func); } - dependencies.push_back(al, ASRUtils::symbol_name(name)); + if (ASRUtils::symbol_parent_symtab(name) == func_scope->parent) { + dependencies.push_back(al, ASRUtils::symbol_name(name)); + } return ASRUtils::make_FunctionCall_t_util(al, x->base.base.loc, name, x->m_original_name, args.p, args.size(), type, value, dt); } @@ -873,7 +879,9 @@ class FunctionInstantiator : public ASR::BaseExprStmtDuplicator(nested_generic_func); } - dependencies.push_back(al, ASRUtils::symbol_name(name)); + if (ASRUtils::symbol_parent_symtab(name) == func_scope->parent) { + dependencies.push_back(al, ASRUtils::symbol_name(name)); + } return ASRUtils::make_SubroutineCall_t_util(al, x->base.base.loc, name /* change this */, x->m_original_name, args.p, args.size(), dt, nullptr, false); } diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index e0f0cf0083..502733a854 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -320,7 +320,7 @@ namespace LCompilers { } void visit_FunctionCall(const ASR::FunctionCall_t& x) { - if( fill_function_dependencies ) { + if( fill_function_dependencies && ASRUtils::symbol_symtab(x.m_name) != nullptr && ASRUtils::symbol_parent_symtab(x.m_name) == ASRUtils::symbol_symtab(x.m_name)->parent) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } if( ASR::is_a(*x.m_name) && @@ -334,7 +334,7 @@ namespace LCompilers { } void visit_SubroutineCall(const ASR::SubroutineCall_t& x) { - if( fill_function_dependencies ) { + if( fill_function_dependencies && ASRUtils::symbol_symtab(x.m_name) != nullptr && ASRUtils::symbol_parent_symtab(x.m_name) == ASRUtils::symbol_symtab(x.m_name)->parent) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } if( ASR::is_a(*x.m_name) && diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 6c66d8ba04..d8f54054a2 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -1284,7 +1284,10 @@ class CommonVisitor : public AST::BaseVisitor { args_new.reserve(al, func->n_args); visit_expr_list_with_cast(func->m_args, func->n_args, args_new, args, !ASRUtils::is_intrinsic_function2(func)); - dependencies.push_back(al, ASRUtils::symbol_name(stemp)); + // Check if it is inside the parent symbol scope. + if(ASRUtils::symbol_parent_symtab(stemp) == func->m_symtab->parent) { + dependencies.push_back(al, ASRUtils::symbol_name(stemp)); + } ASR::asr_t* func_call_asr = ASRUtils::make_FunctionCall_t_util(al, loc, stemp, s_generic, args_new.p, args_new.size(), a_type, value, nullptr); @@ -1310,7 +1313,9 @@ class CommonVisitor : public AST::BaseVisitor { Vec args_new; args_new.reserve(al, func->n_args); visit_expr_list_with_cast(func->m_args, func->n_args, args_new, args); - dependencies.push_back(al, ASRUtils::symbol_name(stemp)); + if(ASRUtils::symbol_parent_symtab(stemp) == func->m_symtab->parent) { + dependencies.push_back(al, ASRUtils::symbol_name(stemp)); + } return ASRUtils::make_SubroutineCall_t_util(al, loc, stemp, s_generic, args_new.p, args_new.size(), nullptr, nullptr, false); } @@ -1565,7 +1570,9 @@ class CommonVisitor : public AST::BaseVisitor { t = pass_instantiate_template(al, subs, rt_subs, ASRUtils::symbol_parent_symtab(func), new_func_name, func); dependencies.erase(s2c(al, func_name)); - dependencies.push_back(al, s2c(al, new_func_name)); + if(ASRUtils::symbol_parent_symtab(func) == current_scope->parent) { + dependencies.push_back(al, s2c(al, new_func_name)); + } return t; } From b531009e449aefdf3e27e510326a638f61b0f71f Mon Sep 17 00:00:00 2001 From: arteevraina Date: Fri, 11 Aug 2023 21:36:16 +0530 Subject: [PATCH 10/30] fix: asr verify passes for callback_01 test --- src/libasr/pass/pass_utils.h | 48 ++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index 502733a854..2fd74392e3 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -255,6 +255,7 @@ namespace LCompilers { bool fill_function_dependencies; bool fill_module_dependencies; bool fill_variable_dependencies; + SymbolTable* current_scope; public: @@ -266,10 +267,13 @@ namespace LCompilers { function_dependencies.n = 0; module_dependencies.n = 0; variable_dependencies.n = 0; + current_scope = nullptr; } void visit_Function(const ASR::Function_t& x) { ASR::Function_t& xx = const_cast(x); + SymbolTable* current_scope_copy = current_scope; + current_scope = xx.m_symtab; SetChar function_dependencies_copy; function_dependencies_copy.from_pointer_n_copy(al, function_dependencies.p, function_dependencies.size()); function_dependencies.n = 0; @@ -284,6 +288,7 @@ namespace LCompilers { function_dependencies_copy.p, function_dependencies_copy.size() ); + current_scope = current_scope_copy; } void visit_Module(const ASR::Module_t& x) { @@ -321,7 +326,25 @@ namespace LCompilers { void visit_FunctionCall(const ASR::FunctionCall_t& x) { if( fill_function_dependencies && ASRUtils::symbol_symtab(x.m_name) != nullptr && ASRUtils::symbol_parent_symtab(x.m_name) == ASRUtils::symbol_symtab(x.m_name)->parent) { - function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); + if (ASR::is_a(*x.m_name)) { + ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); + + // Check is x.m_name is not an argument. + bool is_arg = false; + + for (size_t i=0; in_args; i++) { + ASR::Var_t *arg = ASR::down_cast(f->m_args[i]); + + if (arg->m_v == x.m_name) { + is_arg = true; + break; + } + } + + if (!is_arg) { + function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); + } + } } if( ASR::is_a(*x.m_name) && fill_module_dependencies ) { @@ -335,7 +358,28 @@ namespace LCompilers { void visit_SubroutineCall(const ASR::SubroutineCall_t& x) { if( fill_function_dependencies && ASRUtils::symbol_symtab(x.m_name) != nullptr && ASRUtils::symbol_parent_symtab(x.m_name) == ASRUtils::symbol_symtab(x.m_name)->parent) { - function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); + if (ASR::is_a(*x.m_name)) { + // Get the function type from x. + ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); + + // Check is x.m_name is not an argument. + bool is_arg = false; + + for (size_t i=0; in_args; i++) { + // Cast f->m_args[i] to Var. + ASR::Var_t *arg = ASR::down_cast(f->m_args[i]); + + // Check if x.m_name is an argument. + if (arg->m_v == x.m_name) { + is_arg = true; + break; + } + } + + if (!is_arg) { + function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); + } + } } if( ASR::is_a(*x.m_name) && fill_module_dependencies ) { From 2c436bad8739e2e9f458944b20fdb851650873ff Mon Sep 17 00:00:00 2001 From: arteevraina Date: Sun, 13 Aug 2023 00:07:59 +0530 Subject: [PATCH 11/30] fix: tests relating to external symbols and function dependencies --- src/libasr/pass/pass_utils.h | 20 ++++++++++++++++++++ src/lpython/semantics/python_ast_to_asr.cpp | 11 +++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index 2fd74392e3..6e8a56df83 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -346,6 +346,16 @@ namespace LCompilers { } } } + + if (fill_function_dependencies && ASR::is_a(*x.m_name)) { + ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); + ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); + + if (f->m_symtab->parent == external_symbol->m_parent_symtab) { + function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); + } + } + if( ASR::is_a(*x.m_name) && fill_module_dependencies ) { ASR::ExternalSymbol_t* x_m_name = ASR::down_cast(x.m_name); @@ -381,6 +391,16 @@ namespace LCompilers { } } } + + if (fill_function_dependencies && ASR::is_a(*x.m_name)) { + ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); + ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); + + if (f->m_symtab->parent == external_symbol->m_parent_symtab) { + function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); + } + } + if( ASR::is_a(*x.m_name) && fill_module_dependencies ) { ASR::ExternalSymbol_t* x_m_name = ASR::down_cast(x.m_name); diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index d8f54054a2..92a57ecadf 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -1288,6 +1288,17 @@ class CommonVisitor : public AST::BaseVisitor { if(ASRUtils::symbol_parent_symtab(stemp) == func->m_symtab->parent) { dependencies.push_back(al, ASRUtils::symbol_name(stemp)); } + + // Check if stemp is an External Symbol. + if( ASR::is_a(*stemp) ) { + ASR::ExternalSymbol_t* es = ASR::down_cast(stemp); + if( es->m_external ) { + // Only add dependency if both belong to same parent symbol table. + if(ASRUtils::symbol_parent_symtab(es->m_external) == func->m_symtab->parent) { + dependencies.push_back(al, ASRUtils::symbol_name(stemp)); + } + } + } ASR::asr_t* func_call_asr = ASRUtils::make_FunctionCall_t_util(al, loc, stemp, s_generic, args_new.p, args_new.size(), a_type, value, nullptr); From 6fc8a6dca161adef4fc7b5005feb9d2a7a4cb8b3 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Tue, 15 Aug 2023 22:44:59 +0530 Subject: [PATCH 12/30] fix: condition for checking intrinsic function --- src/lpython/semantics/python_ast_to_asr.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 92a57ecadf..2e3dbf657d 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -1284,21 +1284,24 @@ class CommonVisitor : public AST::BaseVisitor { args_new.reserve(al, func->n_args); visit_expr_list_with_cast(func->m_args, func->n_args, args_new, args, !ASRUtils::is_intrinsic_function2(func)); + // Check if it is inside the parent symbol scope. if(ASRUtils::symbol_parent_symtab(stemp) == func->m_symtab->parent) { dependencies.push_back(al, ASRUtils::symbol_name(stemp)); - } - - // Check if stemp is an External Symbol. - if( ASR::is_a(*stemp) ) { - ASR::ExternalSymbol_t* es = ASR::down_cast(stemp); - if( es->m_external ) { - // Only add dependency if both belong to same parent symbol table. - if(ASRUtils::symbol_parent_symtab(es->m_external) == func->m_symtab->parent) { - dependencies.push_back(al, ASRUtils::symbol_name(stemp)); + } else { + // Check if it is not an Intrinsic Function. + if( !ASRUtils::is_intrinsic_function2(func) ) { + // Check if it is an External Symbol. + if( ASR::is_a(*stemp) ) { + ASR::ExternalSymbol_t* es = ASR::down_cast(stemp); + // Only add dependency if both belong to same parent symbol table. + if(ASRUtils::symbol_parent_symtab(es->m_external) == func->m_symtab->parent) { + dependencies.push_back(al, ASRUtils::symbol_name(stemp)); + } } } } + ASR::asr_t* func_call_asr = ASRUtils::make_FunctionCall_t_util(al, loc, stemp, s_generic, args_new.p, args_new.size(), a_type, value, nullptr); From f1d77ae0280214826b2b18743a77adaa08f4844c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Fri, 18 Aug 2023 10:18:08 -0600 Subject: [PATCH 13/30] Allow global scope dependencies as well --- src/libasr/asr_verify.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index 3990298e5f..7995adf306 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -440,18 +440,30 @@ class VerifyVisitor : public BaseWalkVisitor verify_unique_dependencies(x.m_dependencies, x.n_dependencies, x.m_name, x.base.base.loc); - // Get the x symtab. + // Get the x parent symtab. SymbolTable *sym = x.m_symtab->parent; - // Dependencies of the function should be from function's symbol table. + // Dependencies of the function should be from function's parent symbol table. for( size_t i = 0; i < x.n_dependencies; i++ ) { std::string found_dep = x.m_dependencies[i]; // Get the symbol of the found_dep. ASR::symbol_t* dep_sym = sym->get_symbol(found_dep); - require(dep_sym != nullptr, - "Dependency " + found_dep + " was not found in the parent symbol table " + std::string(x.m_name)); + if (dep_sym == nullptr) { + // The symbol `dep_sym` is not in the parent symbol table. For + // now we allow one exception: it can also be in the global scope. + ASR::symbol_t* dep_sym_global = sym->resolve_symbol(found_dep); + + if (dep_sym_global != nullptr && ASRUtils::symbol_parent_symtab(dep_sym_global)->parent == nullptr) { + // This is a global scope symbol, which we allow for now + } else { + // This is not a global scope symbol and not in the parent symbol table, + // Return an error: + require(dep_sym != nullptr, + "Dependency " + found_dep + " was not found in the parent symbol table " + std::string(x.m_name)); + } + } } // Check if there are unnecessary dependencies @@ -881,7 +893,8 @@ class VerifyVisitor : public BaseWalkVisitor } } - if (ASRUtils::symbol_parent_symtab(x.m_name) == current_symtab->parent) { + if ((ASRUtils::symbol_parent_symtab(x.m_name) == current_symtab->parent) || + (ASRUtils::symbol_parent_symtab(x.m_name)->parent == nullptr)) { // add to dependencies function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); } @@ -1007,7 +1020,8 @@ class VerifyVisitor : public BaseWalkVisitor require(x.m_name, "FunctionCall::m_name must be present"); // Check x.m_name is from parent sym tab. - if (ASRUtils::symbol_parent_symtab(x.m_name) == current_symtab->parent) { + if ((ASRUtils::symbol_parent_symtab(x.m_name) == current_symtab->parent) || + (ASRUtils::symbol_parent_symtab(x.m_name)->parent == nullptr)) { // add to dependencies function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); } From 47d0f5dab8c79c16d95b3a32a1da059225dca88f Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Fri, 25 Aug 2023 11:35:47 +0530 Subject: [PATCH 14/30] Robust check for making sure that dependency isn't defined inside the current scope --- src/libasr/pass/pass_utils.h | 17 ++++++++++------- src/lpython/semantics/python_ast_to_asr.cpp | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index 96005aa2f5..3bfca13d41 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -323,7 +323,10 @@ namespace LCompilers { } void visit_FunctionCall(const ASR::FunctionCall_t& x) { - if( fill_function_dependencies && ASRUtils::symbol_symtab(x.m_name) != nullptr && ASRUtils::symbol_parent_symtab(x.m_name) == ASRUtils::symbol_symtab(x.m_name)->parent) { + if( fill_function_dependencies && + ASRUtils::symbol_symtab(x.m_name) != nullptr && + ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() != + current_scope->get_counter()) { if (ASR::is_a(*x.m_name)) { ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); @@ -346,10 +349,9 @@ namespace LCompilers { } if (fill_function_dependencies && ASR::is_a(*x.m_name)) { - ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); - if (f->m_symtab->parent == external_symbol->m_parent_symtab) { + if (current_scope->get_counter() != external_symbol->m_parent_symtab->get_counter()) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } } @@ -365,7 +367,10 @@ namespace LCompilers { } void visit_SubroutineCall(const ASR::SubroutineCall_t& x) { - if( fill_function_dependencies && ASRUtils::symbol_symtab(x.m_name) != nullptr && ASRUtils::symbol_parent_symtab(x.m_name) == ASRUtils::symbol_symtab(x.m_name)->parent) { + if( fill_function_dependencies && + ASRUtils::symbol_symtab(x.m_name) != nullptr && + ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() != + current_scope->get_counter()) { if (ASR::is_a(*x.m_name)) { // Get the function type from x. ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); @@ -391,10 +396,8 @@ namespace LCompilers { } if (fill_function_dependencies && ASR::is_a(*x.m_name)) { - ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); - - if (f->m_symtab->parent == external_symbol->m_parent_symtab) { + if (current_scope->get_counter() != external_symbol->m_parent_symtab->get_counter()) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } } diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 909dcf1144..7da0b08cc2 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -1620,7 +1620,7 @@ class CommonVisitor : public AST::BaseVisitor { target_scope, target_scope, new_f, f); } dependencies.erase(s2c(al, func_name)); - if(ASRUtils::symbol_parent_symtab(func) == current_scope->parent) { + if(ASRUtils::symbol_parent_symtab(sym) == current_scope->parent) { dependencies.push_back(al, s2c(al, new_func_name)); } return t; From 456071b3ba212cc21fb0a8e7759419e1a6347772 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Sat, 26 Aug 2023 16:40:47 +0530 Subject: [PATCH 15/30] fix: add robust checking using resolve symbol when symbol is nested --- src/libasr/pass/pass_utils.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index 3bfca13d41..c037574d14 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -350,8 +350,9 @@ namespace LCompilers { if (fill_function_dependencies && ASR::is_a(*x.m_name)) { ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); + ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); - if (current_scope->get_counter() != external_symbol->m_parent_symtab->get_counter()) { + if (current_scope->get_counter() != external_symbol->m_parent_symtab->get_counter() && external_symbol->m_parent_symtab->resolve_symbol(f->m_name) == nullptr) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } } From ca261222f242875fb91cf9d6352fa9c3b6335980 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Sat, 26 Aug 2023 20:10:19 +0530 Subject: [PATCH 16/30] fix: improved check by checking only in parent scopes and not in current scopes --- src/libasr/asr_scopes.h | 10 ++++++++++ src/libasr/pass/pass_utils.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libasr/asr_scopes.h b/src/libasr/asr_scopes.h index 79be17498e..35bc8f1f66 100644 --- a/src/libasr/asr_scopes.h +++ b/src/libasr/asr_scopes.h @@ -49,6 +49,16 @@ struct SymbolTable { return scope[name]; } + // Look for symbol in only parent scopes. + // Returns `nullptr` if symbol not found. + ASR::symbol_t* resolve_symbol_parent(const std::string &name) { + if (parent) { + return parent->resolve_symbol(name); + } else { + return nullptr; + } + } + const std::map& get_scope() const { return scope; } diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index c037574d14..84b3c0459d 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -352,7 +352,7 @@ namespace LCompilers { ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); - if (current_scope->get_counter() != external_symbol->m_parent_symtab->get_counter() && external_symbol->m_parent_symtab->resolve_symbol(f->m_name) == nullptr) { + if (current_scope->get_counter() != external_symbol->m_parent_symtab->get_counter() && external_symbol->m_parent_symtab->resolve_symbol_parent(f->m_name) == nullptr) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } } From dd2d3ab53354e50f43d590f9d96d098e5314d2bb Mon Sep 17 00:00:00 2001 From: arteevraina Date: Sun, 27 Aug 2023 20:48:56 +0530 Subject: [PATCH 17/30] fix: improved checks for dependencies in asr verify --- src/libasr/asr_verify.cpp | 4 ++-- src/libasr/pass/pass_utils.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index 0029aec213..f918f11129 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -894,7 +894,7 @@ class VerifyVisitor : public BaseWalkVisitor } } - if ((ASRUtils::symbol_parent_symtab(x.m_name) == current_symtab->parent) || + if ((current_symtab->get_counter() != ASRUtils::symbol_parent_symtab(x.m_name)->get_counter()) || (ASRUtils::symbol_parent_symtab(x.m_name)->parent == nullptr)) { // add to dependencies function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); @@ -1033,7 +1033,7 @@ class VerifyVisitor : public BaseWalkVisitor require(x.m_name, "FunctionCall::m_name must be present"); // Check x.m_name is from parent sym tab. - if ((ASRUtils::symbol_parent_symtab(x.m_name) == current_symtab->parent) || + if ((ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() != current_symtab->get_counter()) || (ASRUtils::symbol_parent_symtab(x.m_name)->parent == nullptr)) { // add to dependencies function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index 84b3c0459d..f41ea2f503 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -352,7 +352,8 @@ namespace LCompilers { ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); - if (current_scope->get_counter() != external_symbol->m_parent_symtab->get_counter() && external_symbol->m_parent_symtab->resolve_symbol_parent(f->m_name) == nullptr) { + if (current_scope->get_counter() != external_symbol->m_parent_symtab->get_counter() + && external_symbol->m_parent_symtab->resolve_symbol_parent(f->m_name) == nullptr) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } } From 681514f66b3ddef927f0360fc9cee8523e4f65e6 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Mon, 28 Aug 2023 11:07:48 +0530 Subject: [PATCH 18/30] Check if external symbol is not nested inside the current_scope --- src/libasr/asr_verify.cpp | 10 +++++----- src/libasr/pass/pass_utils.h | 25 +++++++++++++++++++++---- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index f918f11129..8a33bfed8e 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -479,9 +479,9 @@ class VerifyVisitor : public BaseWalkVisitor // Check if all the dependencies found are // present in the dependency list of the function for( auto& found_dep: function_dependencies ) { - require(present(x.m_dependencies, x.n_dependencies, found_dep), - "Function " + std::string(x.m_name) + " depends on " + found_dep + - " but isn't found in its dependency list."); + // require(present(x.m_dependencies, x.n_dependencies, found_dep), + // "Function " + std::string(x.m_name) + " depends on " + found_dep + + // " but isn't found in its dependency list."); } require(ASRUtils::get_FunctionType(x)->n_arg_types == x.n_args, @@ -899,7 +899,7 @@ class VerifyVisitor : public BaseWalkVisitor // add to dependencies function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); } - + if( ASR::is_a(*x.m_name) ) { ASR::ExternalSymbol_t* x_m_name = ASR::down_cast(x.m_name); if( x_m_name->m_external && ASR::is_a(*ASRUtils::get_asr_owner(x_m_name->m_external)) ) { @@ -1038,7 +1038,7 @@ class VerifyVisitor : public BaseWalkVisitor // add to dependencies function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); } - + if( ASR::is_a(*x.m_name) ) { ASR::ExternalSymbol_t* x_m_name = ASR::down_cast(x.m_name); if( x_m_name->m_external && ASR::is_a(*ASRUtils::get_asr_owner(x_m_name->m_external)) ) { diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index f41ea2f503..682c62c0a9 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -350,10 +350,17 @@ namespace LCompilers { if (fill_function_dependencies && ASR::is_a(*x.m_name)) { ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); - ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); - if (current_scope->get_counter() != external_symbol->m_parent_symtab->get_counter() - && external_symbol->m_parent_symtab->resolve_symbol_parent(f->m_name) == nullptr) { + bool is_present_in_current_scope = false; + SymbolTable* scope = external_symbol->m_parent_symtab; + while( scope != nullptr ) { + if( scope->get_counter() == current_scope->get_counter() ) { + is_present_in_current_scope = true; + break ; + } + scope = scope->parent; + } + if (!is_present_in_current_scope) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } } @@ -399,7 +406,17 @@ namespace LCompilers { if (fill_function_dependencies && ASR::is_a(*x.m_name)) { ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); - if (current_scope->get_counter() != external_symbol->m_parent_symtab->get_counter()) { + + bool is_present_in_current_scope = false; + SymbolTable* scope = external_symbol->m_parent_symtab; + while( scope != nullptr ) { + if( scope->get_counter() == current_scope->get_counter() ) { + is_present_in_current_scope = true; + break ; + } + scope = scope->parent; + } + if (!is_present_in_current_scope) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } } From 433d9448c015d97bd35111ca04ab46203f2f906a Mon Sep 17 00:00:00 2001 From: arteevraina Date: Mon, 28 Aug 2023 11:25:46 +0530 Subject: [PATCH 19/30] fix: applied correct checks in ast to asr --- src/libasr/asr_verify.cpp | 6 +++--- src/lpython/semantics/python_ast_to_asr.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index 8a33bfed8e..a494cdbb45 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -479,9 +479,9 @@ class VerifyVisitor : public BaseWalkVisitor // Check if all the dependencies found are // present in the dependency list of the function for( auto& found_dep: function_dependencies ) { - // require(present(x.m_dependencies, x.n_dependencies, found_dep), - // "Function " + std::string(x.m_name) + " depends on " + found_dep + - // " but isn't found in its dependency list."); + require(present(x.m_dependencies, x.n_dependencies, found_dep), + "Function " + std::string(x.m_name) + " depends on " + found_dep + + " but isn't found in its dependency list."); } require(ASRUtils::get_FunctionType(x)->n_arg_types == x.n_args, diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 7da0b08cc2..02952978df 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -1356,7 +1356,8 @@ class CommonVisitor : public AST::BaseVisitor { Vec args_new; args_new.reserve(al, func->n_args); visit_expr_list_with_cast(func->m_args, func->n_args, args_new, args); - if(ASRUtils::symbol_parent_symtab(stemp) == func->m_symtab->parent) { + + if(ASRUtils::symbol_parent_symtab(stemp)->get_counter() != current_scope->get_counter()) { dependencies.push_back(al, ASRUtils::symbol_name(stemp)); } return ASRUtils::make_SubroutineCall_t_util(al, loc, stemp, From 14632b472c21e2dcc71753e06a96f4b3d5716a14 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Mon, 28 Aug 2023 12:10:11 +0530 Subject: [PATCH 20/30] refactor: added function to check for current scope in asr utils --- src/libasr/asr_utils.h | 11 +++++++++++ src/libasr/pass/pass_utils.h | 23 ++--------------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/libasr/asr_utils.h b/src/libasr/asr_utils.h index f3fefc064e..1c9dcea3b9 100644 --- a/src/libasr/asr_utils.h +++ b/src/libasr/asr_utils.h @@ -544,6 +544,17 @@ static inline std::pair symbol_dependencies(const ASR::symbol_t } } +static inline bool is_present_in_current_scope(ASR::ExternalSymbol_t* external_symbol, SymbolTable* current_scope) { + SymbolTable* scope = external_symbol->m_parent_symtab; + while (scope != nullptr) { + if (scope->get_counter() == current_scope->get_counter()) { + return true; + } + scope = scope->parent; + } + return false; + } + static inline SymbolTable *symbol_parent_symtab(const ASR::symbol_t *f) { switch (f->type) { diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index 682c62c0a9..2378e54c6f 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -350,17 +350,7 @@ namespace LCompilers { if (fill_function_dependencies && ASR::is_a(*x.m_name)) { ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); - - bool is_present_in_current_scope = false; - SymbolTable* scope = external_symbol->m_parent_symtab; - while( scope != nullptr ) { - if( scope->get_counter() == current_scope->get_counter() ) { - is_present_in_current_scope = true; - break ; - } - scope = scope->parent; - } - if (!is_present_in_current_scope) { + if (!ASRUtils::is_present_in_current_scope(external_symbol, current_scope)) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } } @@ -407,16 +397,7 @@ namespace LCompilers { if (fill_function_dependencies && ASR::is_a(*x.m_name)) { ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); - bool is_present_in_current_scope = false; - SymbolTable* scope = external_symbol->m_parent_symtab; - while( scope != nullptr ) { - if( scope->get_counter() == current_scope->get_counter() ) { - is_present_in_current_scope = true; - break ; - } - scope = scope->parent; - } - if (!is_present_in_current_scope) { + if (!ASRUtils::is_present_in_current_scope(external_symbol, current_scope)) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } } From 0491339025df10c62d6c20ed29846bbbc1582e6e Mon Sep 17 00:00:00 2001 From: arteevraina Date: Mon, 28 Aug 2023 12:11:25 +0530 Subject: [PATCH 21/30] refactor: remove unused function --- src/libasr/asr_scopes.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/libasr/asr_scopes.h b/src/libasr/asr_scopes.h index 35bc8f1f66..79be17498e 100644 --- a/src/libasr/asr_scopes.h +++ b/src/libasr/asr_scopes.h @@ -49,16 +49,6 @@ struct SymbolTable { return scope[name]; } - // Look for symbol in only parent scopes. - // Returns `nullptr` if symbol not found. - ASR::symbol_t* resolve_symbol_parent(const std::string &name) { - if (parent) { - return parent->resolve_symbol(name); - } else { - return nullptr; - } - } - const std::map& get_scope() const { return scope; } From d943c5a4082e741dfbea94d43d393bb7e6bf4484 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Mon, 28 Aug 2023 12:14:41 +0530 Subject: [PATCH 22/30] updated references --- tests/reference/asr-callback_01-df40fd5.json | 2 +- tests/reference/asr-callback_01-df40fd5.stdout | 2 +- tests/reference/asr-cast-435c233.json | 2 +- tests/reference/asr-cast-435c233.stdout | 2 +- tests/reference/asr-complex1-f26c460.json | 2 +- tests/reference/asr-complex1-f26c460.stdout | 7 +------ tests/reference/asr-constants1-5828e8a.json | 2 +- tests/reference/asr-constants1-5828e8a.stdout | 10 ++++------ tests/reference/asr-elemental_01-b58df26.json | 2 +- tests/reference/asr-elemental_01-b58df26.stdout | 16 ++++++---------- tests/reference/asr-expr10-efcbb1b.json | 2 +- tests/reference/asr-expr10-efcbb1b.stdout | 2 +- tests/reference/asr-expr13-81bdb5a.json | 2 +- tests/reference/asr-expr13-81bdb5a.stdout | 3 +-- tests/reference/asr-expr7-480ba2f.json | 2 +- tests/reference/asr-expr7-480ba2f.stdout | 4 ++-- tests/reference/asr-expr8-6beda60.json | 2 +- tests/reference/asr-expr8-6beda60.stdout | 2 +- tests/reference/asr-expr_05-3a37324.json | 2 +- tests/reference/asr-expr_05-3a37324.stdout | 8 ++------ .../reference/asr-test_bool_binop-f856ef0.json | 2 +- .../asr-test_bool_binop-f856ef0.stdout | 2 +- .../reference/asr-test_builtin_bin-52ba9fa.json | 2 +- .../asr-test_builtin_bin-52ba9fa.stdout | 2 +- .../asr-test_builtin_bool-330223a.json | 2 +- .../asr-test_builtin_bool-330223a.stdout | 3 +-- .../reference/asr-test_builtin_hex-64bd268.json | 2 +- .../asr-test_builtin_hex-64bd268.stdout | 2 +- .../reference/asr-test_builtin_oct-20b9066.json | 2 +- .../asr-test_builtin_oct-20b9066.stdout | 2 +- .../reference/asr-test_builtin_pow-f02fcda.json | 2 +- .../asr-test_builtin_pow-f02fcda.stdout | 14 +------------- .../asr-test_builtin_round-7417a21.json | 2 +- .../asr-test_builtin_round-7417a21.stdout | 8 +------- .../reference/asr-test_complex_01-a6def58.json | 2 +- .../asr-test_complex_01-a6def58.stdout | 17 +++-------------- .../reference/asr-test_complex_02-782ba2d.json | 2 +- .../asr-test_complex_02-782ba2d.stdout | 2 +- tests/reference/asr-test_max_min-3c2fc51.json | 2 +- tests/reference/asr-test_max_min-3c2fc51.stdout | 6 ++---- tests/reference/asr-test_numpy_03-e600a49.json | 2 +- .../reference/asr-test_numpy_03-e600a49.stdout | 7 +++---- tests/reference/asr-test_pow-3f5d550.json | 2 +- tests/reference/asr-test_pow-3f5d550.stdout | 2 +- .../pass_loop_vectorise-vec_01-be9985e.json | 2 +- .../pass_loop_vectorise-vec_01-be9985e.stdout | 2 +- 46 files changed, 61 insertions(+), 110 deletions(-) diff --git a/tests/reference/asr-callback_01-df40fd5.json b/tests/reference/asr-callback_01-df40fd5.json index bd4b1b73fc..cfd5db0657 100644 --- a/tests/reference/asr-callback_01-df40fd5.json +++ b/tests/reference/asr-callback_01-df40fd5.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-callback_01-df40fd5.stdout", - "stdout_hash": "5be73c5b09034604701853c55fffbdca38993aa3f92782e89a50c91e", + "stdout_hash": "d8283ff4af45372de119998a592b0995335f8d6ada869664e3306a22", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-callback_01-df40fd5.stdout b/tests/reference/asr-callback_01-df40fd5.stdout index 2151b35be2..85ec941f5a 100644 --- a/tests/reference/asr-callback_01-df40fd5.stdout +++ b/tests/reference/asr-callback_01-df40fd5.stdout @@ -506,7 +506,7 @@ [] .false. ) - [func] + [] [(Var 6 func) (Var 6 arg)] [(= diff --git a/tests/reference/asr-cast-435c233.json b/tests/reference/asr-cast-435c233.json index f4296b9da0..c7d3baf6cb 100644 --- a/tests/reference/asr-cast-435c233.json +++ b/tests/reference/asr-cast-435c233.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-cast-435c233.stdout", - "stdout_hash": "fe198b3570faed74e1d6babc91b93c715f90a21cf5e19b40351e3299", + "stdout_hash": "b796518cebf6205e08787dcc403476d51dd5147dc5e10a24c4381310", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-cast-435c233.stdout b/tests/reference/asr-cast-435c233.stdout index 3227a8b72f..eacffb151a 100644 --- a/tests/reference/asr-cast-435c233.stdout +++ b/tests/reference/asr-cast-435c233.stdout @@ -126,7 +126,7 @@ [] .false. ) - [list] + [] [] [(= (Var 3 s) diff --git a/tests/reference/asr-complex1-f26c460.json b/tests/reference/asr-complex1-f26c460.json index d6c3fb93a9..39af4633f8 100644 --- a/tests/reference/asr-complex1-f26c460.json +++ b/tests/reference/asr-complex1-f26c460.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-complex1-f26c460.stdout", - "stdout_hash": "f9bf5d60924825871eda0b6077447ff9650625d0d1f15c94f16ec0e6", + "stdout_hash": "79c039ef8f2b16c8518e689aaaf252a4dd5048a6a08df68a4453e7a8", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex1-f26c460.stdout b/tests/reference/asr-complex1-f26c460.stdout index 0f2e21219f..8dbcf88e64 100644 --- a/tests/reference/asr-complex1-f26c460.stdout +++ b/tests/reference/asr-complex1-f26c460.stdout @@ -368,12 +368,7 @@ [] .false. ) - [complex@__lpython_overloaded_0__complex - complex@__lpython_overloaded_1__complex - complex@__lpython_overloaded_5__complex - complex@__lpython_overloaded_2__complex - complex@__lpython_overloaded_9__complex - complex@__lpython_overloaded_13__complex] + [] [] [(= (Var 3 c) diff --git a/tests/reference/asr-constants1-5828e8a.json b/tests/reference/asr-constants1-5828e8a.json index b6b29d17c1..a941d972a0 100644 --- a/tests/reference/asr-constants1-5828e8a.json +++ b/tests/reference/asr-constants1-5828e8a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-constants1-5828e8a.stdout", - "stdout_hash": "6a720ac727aa279e50caba080213442c089fcaaf28297bbbb524c825", + "stdout_hash": "0fa8ae62e9e27ea07bf0b0afccb810077ffa18387e0395df6cbca44f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-constants1-5828e8a.stdout b/tests/reference/asr-constants1-5828e8a.stdout index 21cf100828..4324a2598f 100644 --- a/tests/reference/asr-constants1-5828e8a.stdout +++ b/tests/reference/asr-constants1-5828e8a.stdout @@ -80,7 +80,7 @@ [] .false. ) - [complex@__lpython_overloaded_5__complex] + [] [] [(= (Var 5 a) @@ -306,7 +306,7 @@ [] .false. ) - [complex@__lpython_overloaded_9__complex] + [] [] [(= (Var 7 a) @@ -510,9 +510,7 @@ [] .false. ) - [bin - oct - hex] + [] [] [(= (Var 3 b) @@ -846,7 +844,7 @@ [] .false. ) - [divmod] + [] [] [(= (Var 12 a) diff --git a/tests/reference/asr-elemental_01-b58df26.json b/tests/reference/asr-elemental_01-b58df26.json index b08b7d9464..4e025ef919 100644 --- a/tests/reference/asr-elemental_01-b58df26.json +++ b/tests/reference/asr-elemental_01-b58df26.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-elemental_01-b58df26.stdout", - "stdout_hash": "6fd3b9bf7ded59e56672127135e71ffe94a3e2715eb5ae6c1d77ea82", + "stdout_hash": "99b5ab9296973238ee886d719c9a92dd54eabd54f7536dda58ba767a", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-elemental_01-b58df26.stdout b/tests/reference/asr-elemental_01-b58df26.stdout index 2f65df2e15..ad9ea8667f 100644 --- a/tests/reference/asr-elemental_01-b58df26.stdout +++ b/tests/reference/asr-elemental_01-b58df26.stdout @@ -190,8 +190,7 @@ [] .false. ) - [cos@__lpython_overloaded_0__cos - verify2d] + [verify2d] [] [(DoLoop () @@ -811,9 +810,7 @@ [] .false. ) - [sin@__lpython_overloaded_1__sin - verify1d - sin@__lpython_overloaded_0__sin + [verify1d verifynd] [] [(DoLoop @@ -1591,8 +1588,7 @@ [] .false. ) - [sin@__lpython_overloaded_1__sin - cos@__lpython_overloaded_1__cos] + [] [] [(= (Var 209 eps) @@ -2117,7 +2113,7 @@ [] .false. ) - [sin@__lpython_overloaded_1__sin] + [] [(Var 200 array) (Var 200 result) (Var 200 size)] @@ -2949,7 +2945,7 @@ [] .false. ) - [cos@__lpython_overloaded_0__cos] + [] [(Var 202 array) (Var 202 result) (Var 202 size1) @@ -3324,7 +3320,7 @@ [] .false. ) - [sin@__lpython_overloaded_0__sin] + [] [(Var 201 array) (Var 201 result) (Var 201 size1) diff --git a/tests/reference/asr-expr10-efcbb1b.json b/tests/reference/asr-expr10-efcbb1b.json index c77869c746..fecda65a06 100644 --- a/tests/reference/asr-expr10-efcbb1b.json +++ b/tests/reference/asr-expr10-efcbb1b.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr10-efcbb1b.stdout", - "stdout_hash": "8d59a0da990fca6c3f4717bca20d997e03a1f71c1e8396901d4bb9a3", + "stdout_hash": "c7c960bbb2727dc2a772b647860ed67a02542f54cdd7928d44c1dd4b", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr10-efcbb1b.stdout b/tests/reference/asr-expr10-efcbb1b.stdout index a662166f43..a936e9e07c 100644 --- a/tests/reference/asr-expr10-efcbb1b.stdout +++ b/tests/reference/asr-expr10-efcbb1b.stdout @@ -170,7 +170,7 @@ [] .false. ) - [complex@__lpython_overloaded_13__complex] + [] [] [(= (Var 3 a) diff --git a/tests/reference/asr-expr13-81bdb5a.json b/tests/reference/asr-expr13-81bdb5a.json index ac05d7a0e8..7752434737 100644 --- a/tests/reference/asr-expr13-81bdb5a.json +++ b/tests/reference/asr-expr13-81bdb5a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr13-81bdb5a.stdout", - "stdout_hash": "ba567d1ba586da87a4eb2b60316b7db71bd4d8a027883e15e496456d", + "stdout_hash": "70c21d0c64fa54ca205d047bd2e84dc8a4c38a9c30a48c76feb39fe0", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr13-81bdb5a.stdout b/tests/reference/asr-expr13-81bdb5a.stdout index c852d45ed4..5f2d88102e 100644 --- a/tests/reference/asr-expr13-81bdb5a.stdout +++ b/tests/reference/asr-expr13-81bdb5a.stdout @@ -74,8 +74,7 @@ [] .false. ) - [complex@__lpython_overloaded_9__complex - complex@__lpython_overloaded_5__complex] + [] [] [(= (Var 3 a) diff --git a/tests/reference/asr-expr7-480ba2f.json b/tests/reference/asr-expr7-480ba2f.json index e1285c0211..bace0003e6 100644 --- a/tests/reference/asr-expr7-480ba2f.json +++ b/tests/reference/asr-expr7-480ba2f.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr7-480ba2f.stdout", - "stdout_hash": "1f6e6f0d3e5dac3d97e184b853cc86c06b31e6b797035f7db5f85bec", + "stdout_hash": "4e6ab2ecae35cc108c6a70080a969503e16aff1308a7247287f7b58b", "stderr": "asr-expr7-480ba2f.stderr", "stderr_hash": "6e9790ac88db1a9ead8f64a91ba8a6605de67167037908a74b77be0c", "returncode": 0 diff --git a/tests/reference/asr-expr7-480ba2f.stdout b/tests/reference/asr-expr7-480ba2f.stdout index 3683fbb6f9..fc4b95685e 100644 --- a/tests/reference/asr-expr7-480ba2f.stdout +++ b/tests/reference/asr-expr7-480ba2f.stdout @@ -165,7 +165,7 @@ [] .false. ) - [pow@__lpython_overloaded_0__pow] + [] [] [(= (Var 3 a) @@ -300,7 +300,7 @@ [] .false. ) - [pow@__lpython_overloaded_0__pow] + [] [(Var 4 a) (Var 4 b)] [(= diff --git a/tests/reference/asr-expr8-6beda60.json b/tests/reference/asr-expr8-6beda60.json index 2f5fd7dded..19675b338a 100644 --- a/tests/reference/asr-expr8-6beda60.json +++ b/tests/reference/asr-expr8-6beda60.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr8-6beda60.stdout", - "stdout_hash": "58473e829ded62de31415f3bcf5eb28fc2584c5b738f3e46cc886db9", + "stdout_hash": "b71e5e452186a67fd2b8826a216a5fb4979402ddf063b7c87b7e7c73", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr8-6beda60.stdout b/tests/reference/asr-expr8-6beda60.stdout index 316316c101..9b5040e2e0 100644 --- a/tests/reference/asr-expr8-6beda60.stdout +++ b/tests/reference/asr-expr8-6beda60.stdout @@ -112,7 +112,7 @@ [] .false. ) - [_lpython_floordiv@__lpython_overloaded_10___lpython_floordiv] + [] [] [(= (Var 3 x) diff --git a/tests/reference/asr-expr_05-3a37324.json b/tests/reference/asr-expr_05-3a37324.json index adb113e146..1d76c56b4f 100644 --- a/tests/reference/asr-expr_05-3a37324.json +++ b/tests/reference/asr-expr_05-3a37324.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr_05-3a37324.stdout", - "stdout_hash": "e568b4fb4b9a08389b8d7639ee6e08ad43ec2b8086a7486598ffd92b", + "stdout_hash": "c8f99e38c1bc40d70719a82988fa1e66dd9cf4a19c6e74e134d1c5fc", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr_05-3a37324.stdout b/tests/reference/asr-expr_05-3a37324.stdout index 90bdf0425d..3f7a8cc50b 100644 --- a/tests/reference/asr-expr_05-3a37324.stdout +++ b/tests/reference/asr-expr_05-3a37324.stdout @@ -307,11 +307,7 @@ .false. ) [test_multiply - test_mod - _mod@__lpython_overloaded_2___mod - _mod@__lpython_overloaded_9___mod - _mod@__lpython_overloaded_4___mod - _lpython_floordiv@__lpython_overloaded_5___lpython_floordiv] + test_mod] [] [(= (Var 5 a) @@ -1512,7 +1508,7 @@ [] .false. ) - [_mod@__lpython_overloaded_2___mod] + [] [(Var 4 a) (Var 4 b)] [(= diff --git a/tests/reference/asr-test_bool_binop-f856ef0.json b/tests/reference/asr-test_bool_binop-f856ef0.json index 81d9de49c5..446e75fc3e 100644 --- a/tests/reference/asr-test_bool_binop-f856ef0.json +++ b/tests/reference/asr-test_bool_binop-f856ef0.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_bool_binop-f856ef0.stdout", - "stdout_hash": "f0780ca86a1b917cbac3f32e74d91a56a81e45a6c5cceaf0428744b8", + "stdout_hash": "c5e0ecc9ff081961a546fab314b4f0b4ef23f28cf9a79fa0738832e8", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_bool_binop-f856ef0.stdout b/tests/reference/asr-test_bool_binop-f856ef0.stdout index 8dc488d7eb..ce80ec7151 100644 --- a/tests/reference/asr-test_bool_binop-f856ef0.stdout +++ b/tests/reference/asr-test_bool_binop-f856ef0.stdout @@ -148,7 +148,7 @@ [] .false. ) - [_lpython_floordiv@__lpython_overloaded_10___lpython_floordiv] + [] [] [(= (Var 3 i) diff --git a/tests/reference/asr-test_builtin_bin-52ba9fa.json b/tests/reference/asr-test_builtin_bin-52ba9fa.json index 3f3f01d9d5..468e016685 100644 --- a/tests/reference/asr-test_builtin_bin-52ba9fa.json +++ b/tests/reference/asr-test_builtin_bin-52ba9fa.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_bin-52ba9fa.stdout", - "stdout_hash": "35fd706bf737b8dc604b612a080f41a5d136dc302de1705b051e8173", + "stdout_hash": "680a99f17aa2515fddea6789550d97efb096e60d40d7cfbbca25ed78", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_bin-52ba9fa.stdout b/tests/reference/asr-test_builtin_bin-52ba9fa.stdout index 67398b0d41..ee0adb1aef 100644 --- a/tests/reference/asr-test_builtin_bin-52ba9fa.stdout +++ b/tests/reference/asr-test_builtin_bin-52ba9fa.stdout @@ -90,7 +90,7 @@ [] .false. ) - [bin] + [] [] [(= (Var 3 i) diff --git a/tests/reference/asr-test_builtin_bool-330223a.json b/tests/reference/asr-test_builtin_bool-330223a.json index e3bfcadf08..7ce135b0b7 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.json +++ b/tests/reference/asr-test_builtin_bool-330223a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_bool-330223a.stdout", - "stdout_hash": "af74c45e877a75d102e9fee40ee41450ec37afbb80135a31b7d85cd7", + "stdout_hash": "4e0d3c43fbcf3717c01c8616c9f217603cbcc6a3984c981e3b74a12d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_bool-330223a.stdout b/tests/reference/asr-test_builtin_bool-330223a.stdout index 82dedc7788..923adef0ba 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.stdout +++ b/tests/reference/asr-test_builtin_bool-330223a.stdout @@ -254,8 +254,7 @@ [] .false. ) - [complex@__lpython_overloaded_9__complex - complex@__lpython_overloaded_13__complex] + [] [] [(= (Var 3 a) diff --git a/tests/reference/asr-test_builtin_hex-64bd268.json b/tests/reference/asr-test_builtin_hex-64bd268.json index 3791e5039c..feba465a23 100644 --- a/tests/reference/asr-test_builtin_hex-64bd268.json +++ b/tests/reference/asr-test_builtin_hex-64bd268.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_hex-64bd268.stdout", - "stdout_hash": "b93da13f9a14f24cb5e78a4787b832ca1cdbf9a71383df5618d0f68f", + "stdout_hash": "3f4f44611183abd194b2792d9f0e144450a3f7f30361c5d122f84f39", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_hex-64bd268.stdout b/tests/reference/asr-test_builtin_hex-64bd268.stdout index 24970732f8..bf71f40b7a 100644 --- a/tests/reference/asr-test_builtin_hex-64bd268.stdout +++ b/tests/reference/asr-test_builtin_hex-64bd268.stdout @@ -90,7 +90,7 @@ [] .false. ) - [hex] + [] [] [(= (Var 3 i) diff --git a/tests/reference/asr-test_builtin_oct-20b9066.json b/tests/reference/asr-test_builtin_oct-20b9066.json index f3b631271b..d70654e853 100644 --- a/tests/reference/asr-test_builtin_oct-20b9066.json +++ b/tests/reference/asr-test_builtin_oct-20b9066.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_oct-20b9066.stdout", - "stdout_hash": "b8f9b2a1b3725db48a5116069cb07add8d72c2bb020d1098cea2416c", + "stdout_hash": "c6c2ff06fab4580bb9871dd8dcf9af2e0b87c9ce0eb361ff2a57d895", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_oct-20b9066.stdout b/tests/reference/asr-test_builtin_oct-20b9066.stdout index 2af0c1ebf5..01a6b828eb 100644 --- a/tests/reference/asr-test_builtin_oct-20b9066.stdout +++ b/tests/reference/asr-test_builtin_oct-20b9066.stdout @@ -90,7 +90,7 @@ [] .false. ) - [oct] + [] [] [(= (Var 3 i) diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.json b/tests/reference/asr-test_builtin_pow-f02fcda.json index 91386137d8..49b5aabf5b 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.json +++ b/tests/reference/asr-test_builtin_pow-f02fcda.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_pow-f02fcda.stdout", - "stdout_hash": "86fd31e26dc71b764870beccd023c01728fa926e21e792467b972dac", + "stdout_hash": "6d6bc4f51e62cd286fb18a6cd953e67589e860701933845e9d3d7a93", "stderr": "asr-test_builtin_pow-f02fcda.stderr", "stderr_hash": "859ce76c74748f2d32c7eab92cfbba789a78d4cbf5818646b99806ea", "returncode": 0 diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.stdout b/tests/reference/asr-test_builtin_pow-f02fcda.stdout index dbdee2fdcf..92d28e72a4 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.stdout +++ b/tests/reference/asr-test_builtin_pow-f02fcda.stdout @@ -502,19 +502,7 @@ [] .false. ) - [pow@__lpython_overloaded_0__pow - pow@__lpython_overloaded_1__pow - pow@__lpython_overloaded_2__pow - pow@__lpython_overloaded_4__pow - pow@__lpython_overloaded_5__pow - pow@__lpython_overloaded_8__pow - pow@__lpython_overloaded_3__pow - pow@__lpython_overloaded_6__pow - pow@__lpython_overloaded_7__pow - pow@__lpython_overloaded_11__pow - pow@__lpython_overloaded_10__pow - complex@__lpython_overloaded_9__complex - pow@__lpython_overloaded_9__pow] + [] [] [(= (Var 3 eps) diff --git a/tests/reference/asr-test_builtin_round-7417a21.json b/tests/reference/asr-test_builtin_round-7417a21.json index 11182f4822..925f7b9462 100644 --- a/tests/reference/asr-test_builtin_round-7417a21.json +++ b/tests/reference/asr-test_builtin_round-7417a21.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_round-7417a21.stdout", - "stdout_hash": "17378338ac36a654f02894d1712968c68bdd257e6716d9bc6435e741", + "stdout_hash": "9783dd9ac31b0b0e1d92dd60fc5ef0508abc51e3e164ad2dde50cd2f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_round-7417a21.stdout b/tests/reference/asr-test_builtin_round-7417a21.stdout index 09b080ffcd..dae4f0c1c2 100644 --- a/tests/reference/asr-test_builtin_round-7417a21.stdout +++ b/tests/reference/asr-test_builtin_round-7417a21.stdout @@ -256,13 +256,7 @@ [] .false. ) - [round@__lpython_overloaded_0__round - round@__lpython_overloaded_1__round - round@__lpython_overloaded_2__round - round@__lpython_overloaded_4__round - round@__lpython_overloaded_5__round - round@__lpython_overloaded_3__round - round@__lpython_overloaded_6__round] + [] [] [(= (Var 3 f) diff --git a/tests/reference/asr-test_complex_01-a6def58.json b/tests/reference/asr-test_complex_01-a6def58.json index 93dbd3520d..4e2cbb2713 100644 --- a/tests/reference/asr-test_complex_01-a6def58.json +++ b/tests/reference/asr-test_complex_01-a6def58.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_complex_01-a6def58.stdout", - "stdout_hash": "3014b21f4eacfbd2e80338fa6d2ede719f2fcb2a282208a82b690d05", + "stdout_hash": "89bff22ae4011a3d7199f258c1230931393646158c734711e48625cc", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_complex_01-a6def58.stdout b/tests/reference/asr-test_complex_01-a6def58.stdout index 7b5bdd50b7..cbeeb55c05 100644 --- a/tests/reference/asr-test_complex_01-a6def58.stdout +++ b/tests/reference/asr-test_complex_01-a6def58.stdout @@ -359,16 +359,7 @@ [] .false. ) - [complex@__lpython_overloaded_5__complex - complex@__lpython_overloaded_9__complex - complex@__lpython_overloaded_13__complex - complex@__lpython_overloaded_14__complex - complex@__lpython_overloaded_6__complex - complex@__lpython_overloaded_7__complex - complex@__lpython_overloaded_8__complex - complex@__lpython_overloaded_11__complex - complex@__lpython_overloaded_10__complex - complex@__lpython_overloaded_12__complex] + [] [] [(= (Var 4 x) @@ -1097,7 +1088,7 @@ [] .false. ) - [complex@__lpython_overloaded_9__complex] + [] [] [(= (Var 6 c) @@ -1297,9 +1288,7 @@ [] .false. ) - [complex@__lpython_overloaded_13__complex - complex@__lpython_overloaded_9__complex - complex@__lpython_overloaded_5__complex] + [] [] [(= (Var 5 c) diff --git a/tests/reference/asr-test_complex_02-782ba2d.json b/tests/reference/asr-test_complex_02-782ba2d.json index 742c8f2111..fd7bedcb1d 100644 --- a/tests/reference/asr-test_complex_02-782ba2d.json +++ b/tests/reference/asr-test_complex_02-782ba2d.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_complex_02-782ba2d.stdout", - "stdout_hash": "3f0a840a1eb752387e2049015be0637113191365ad20e7451d46d059", + "stdout_hash": "25b57ce3115249491b17231131595fe5b6e48450a5a0ae64d953c1c6", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_complex_02-782ba2d.stdout b/tests/reference/asr-test_complex_02-782ba2d.stdout index 0235c9b205..1f57a7352a 100644 --- a/tests/reference/asr-test_complex_02-782ba2d.stdout +++ b/tests/reference/asr-test_complex_02-782ba2d.stdout @@ -182,7 +182,7 @@ [] .false. ) - [complex@__lpython_overloaded_9__complex] + [] [] [(= (Var 3 x) diff --git a/tests/reference/asr-test_max_min-3c2fc51.json b/tests/reference/asr-test_max_min-3c2fc51.json index e3b8a49d99..c71358dc79 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.json +++ b/tests/reference/asr-test_max_min-3c2fc51.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_max_min-3c2fc51.stdout", - "stdout_hash": "881f7e396fc973454dd4b027af902eb829651c88f89246e0e79bf1f1", + "stdout_hash": "1528703065b1073e870964b86d45523ed1123524863c4912564680aa", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_max_min-3c2fc51.stdout b/tests/reference/asr-test_max_min-3c2fc51.stdout index abd9844b3f..06ce816e8e 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.stdout +++ b/tests/reference/asr-test_max_min-3c2fc51.stdout @@ -199,8 +199,7 @@ [] .false. ) - [max@__lpython_overloaded_2__max - max@__lpython_overloaded_3__max] + [] [] [(= (Var 4 d) @@ -368,8 +367,7 @@ [] .false. ) - [max@__lpython_overloaded_0__max - max@__lpython_overloaded_1__max] + [] [] [(= (Var 3 a) diff --git a/tests/reference/asr-test_numpy_03-e600a49.json b/tests/reference/asr-test_numpy_03-e600a49.json index ddbf4a99ac..1e2ec95303 100644 --- a/tests/reference/asr-test_numpy_03-e600a49.json +++ b/tests/reference/asr-test_numpy_03-e600a49.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_numpy_03-e600a49.stdout", - "stdout_hash": "835121cdfc4e1a33435c47fa2170d19d4a0dfc986b2a72dbbd6e944f", + "stdout_hash": "f9d11eb296b4182cab856ec02b28ee98918b9e1b269be0f6edb61512", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_numpy_03-e600a49.stdout b/tests/reference/asr-test_numpy_03-e600a49.stdout index e481348c05..407f5e803b 100644 --- a/tests/reference/asr-test_numpy_03-e600a49.stdout +++ b/tests/reference/asr-test_numpy_03-e600a49.stdout @@ -372,7 +372,7 @@ [] .false. ) - [_lpython_floordiv@__lpython_overloaded_6___lpython_floordiv] + [] [(Var 201 d)] [(= (Var 201 eps) @@ -1217,7 +1217,7 @@ [] .false. ) - [_lpython_floordiv@__lpython_overloaded_6___lpython_floordiv] + [] [(Var 200 a)] [(= (Var 200 eps) @@ -1708,8 +1708,7 @@ [] .false. ) - [_lpython_floordiv@__lpython_overloaded_6___lpython_floordiv - test_nd_to_1d + [test_nd_to_1d test_1d_to_nd] [] [(DoLoop diff --git a/tests/reference/asr-test_pow-3f5d550.json b/tests/reference/asr-test_pow-3f5d550.json index aed3b871ee..9d32f64cc9 100644 --- a/tests/reference/asr-test_pow-3f5d550.json +++ b/tests/reference/asr-test_pow-3f5d550.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_pow-3f5d550.stdout", - "stdout_hash": "ad18bd130c410404f1e423b3ce7d48b9833b31c9f959d13046ed0262", + "stdout_hash": "ee91c6b4a0299dd257cae7818490c801373f63341a6fc11f3b716282", "stderr": "asr-test_pow-3f5d550.stderr", "stderr_hash": "3d950301563cce75654f28bf41f6f53428ed1f5ae997774345f374a3", "returncode": 0 diff --git a/tests/reference/asr-test_pow-3f5d550.stdout b/tests/reference/asr-test_pow-3f5d550.stdout index 5960281a2d..3d639f3fd4 100644 --- a/tests/reference/asr-test_pow-3f5d550.stdout +++ b/tests/reference/asr-test_pow-3f5d550.stdout @@ -84,7 +84,7 @@ [] .false. ) - [pow@__lpython_overloaded_0__pow] + [] [] [(Print () diff --git a/tests/reference/pass_loop_vectorise-vec_01-be9985e.json b/tests/reference/pass_loop_vectorise-vec_01-be9985e.json index 9384826e82..9fb6bfa0c7 100644 --- a/tests/reference/pass_loop_vectorise-vec_01-be9985e.json +++ b/tests/reference/pass_loop_vectorise-vec_01-be9985e.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "pass_loop_vectorise-vec_01-be9985e.stdout", - "stdout_hash": "1450eb1e82f1e03ee2c1ab8cf46b7cc5fb4a44df5af0d598b3779df3", + "stdout_hash": "101a47d3da8a68eb9745cbf5a532ff0688025248968f7bfd20283f4c", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/pass_loop_vectorise-vec_01-be9985e.stdout b/tests/reference/pass_loop_vectorise-vec_01-be9985e.stdout index e5181704df..30873e53d1 100644 --- a/tests/reference/pass_loop_vectorise-vec_01-be9985e.stdout +++ b/tests/reference/pass_loop_vectorise-vec_01-be9985e.stdout @@ -352,7 +352,7 @@ [] .false. ) - [vector_copy_f64f64i32@IntrinsicOptimization] + [] [] [(DoLoop () From b1d00d4291f6d03b367a7ab0721301dd070845e9 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Mon, 28 Aug 2023 20:47:38 +0530 Subject: [PATCH 23/30] remove nofast --- integration_tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index 8a7c1c83a9..a02636a0a9 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -779,7 +779,7 @@ RUN(NAME global_syms_01 LABELS cpython llvm c) RUN(NAME global_syms_02 LABELS cpython llvm c) RUN(NAME global_syms_03_b LABELS cpython llvm c) RUN(NAME global_syms_03_c LABELS cpython llvm c) -RUN(NAME global_syms_04 LABELS cpython llvm c wasm wasm_x64 NOFAST) +RUN(NAME global_syms_04 LABELS cpython llvm c wasm wasm_x64) RUN(NAME global_syms_05 LABELS cpython llvm c) RUN(NAME global_syms_06 LABELS cpython llvm c) From f1e1c2f86d7af14dde8794ee9d43f209bb574490 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Sat, 2 Sep 2023 18:44:53 +0530 Subject: [PATCH 24/30] refactor: function call & subroutine call dependencies --- src/libasr/pass/pass_utils.h | 95 ++++++++++++++---------------------- 1 file changed, 37 insertions(+), 58 deletions(-) diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index 7fac956de1..f21d05137d 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -319,35 +319,14 @@ namespace LCompilers { } void visit_FunctionCall(const ASR::FunctionCall_t& x) { - if( fill_function_dependencies && - ASRUtils::symbol_symtab(x.m_name) != nullptr && - ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() != - current_scope->get_counter()) { - if (ASR::is_a(*x.m_name)) { - ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); - - // Check is x.m_name is not an argument. - bool is_arg = false; - - for (size_t i=0; in_args; i++) { - ASR::Var_t *arg = ASR::down_cast(f->m_args[i]); - - if (arg->m_v == x.m_name) { - is_arg = true; - break; - } - } - - if (!is_arg) { + if (fill_function_dependencies) { + if (ASR::is_a(*x.m_name)) { + ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); + if (!ASRUtils::is_present_in_current_scope(external_symbol, current_scope)) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } - } - } - - if (fill_function_dependencies && ASR::is_a(*x.m_name)) { - ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); - if (!ASRUtils::is_present_in_current_scope(external_symbol, current_scope)) { - function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); + } else if (ASR::is_a(*x.m_name)) { + process_dependency(x.m_name, function_dependencies, current_scope); } } @@ -362,39 +341,14 @@ namespace LCompilers { } void visit_SubroutineCall(const ASR::SubroutineCall_t& x) { - if( fill_function_dependencies && - ASRUtils::symbol_symtab(x.m_name) != nullptr && - ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() != - current_scope->get_counter()) { - if (ASR::is_a(*x.m_name)) { - // Get the function type from x. - ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); - - // Check is x.m_name is not an argument. - bool is_arg = false; - - for (size_t i=0; in_args; i++) { - // Cast f->m_args[i] to Var. - ASR::Var_t *arg = ASR::down_cast(f->m_args[i]); - - // Check if x.m_name is an argument. - if (arg->m_v == x.m_name) { - is_arg = true; - break; - } - } - - if (!is_arg) { + if (fill_function_dependencies) { + if (ASR::is_a(*x.m_name)) { + ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); + if (!ASRUtils::is_present_in_current_scope(external_symbol, current_scope)) { function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } - } - } - - if (fill_function_dependencies && ASR::is_a(*x.m_name)) { - ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); - - if (!ASRUtils::is_present_in_current_scope(external_symbol, current_scope)) { - function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); + } else if (ASR::is_a(*x.m_name)) { + process_dependency(x.m_name, function_dependencies, current_scope); } } @@ -414,6 +368,31 @@ namespace LCompilers { visit_stmt(*(block->m_body[i])); } } + + void process_dependency(const ASR::symbol_t *x, SetChar& function_dependencies, SymbolTable* current_scope) { + if (ASRUtils::symbol_symtab(x) != nullptr && + ASRUtils::symbol_parent_symtab(x)->get_counter() != + current_scope->get_counter()) { + + ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); + + // Check is x.m_name is not an argument. + bool is_arg = false; + + for (size_t i=0; in_args; i++) { + ASR::Var_t *arg = ASR::down_cast(f->m_args[i]); + + if (arg->m_v == x) { + is_arg = true; + break; + } + } + + if (!is_arg) { + function_dependencies.push_back(al, ASRUtils::symbol_name(x)); + } + } + } }; namespace ReplacerUtils { From 261c187207455fa4ab7798a88cf58692b83d76a8 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Wed, 4 Oct 2023 16:08:33 +0530 Subject: [PATCH 25/30] feat: sync libasr --- src/libasr/asr_verify.cpp | 48 ++++++++++++++---------- src/libasr/pass/instantiate_template.cpp | 4 +- src/libasr/pass/pass_utils.h | 2 +- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index a494cdbb45..5ca6ab49f0 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -449,7 +449,7 @@ class VerifyVisitor : public BaseWalkVisitor std::string found_dep = x.m_dependencies[i]; // Get the symbol of the found_dep. - ASR::symbol_t* dep_sym = sym->get_symbol(found_dep); + ASR::symbol_t* dep_sym = sym->resolve_symbol(found_dep); if (dep_sym == nullptr) { // The symbol `dep_sym` is not in the parent symbol table. For @@ -462,7 +462,7 @@ class VerifyVisitor : public BaseWalkVisitor // This is not a global scope symbol and not in the parent symbol table, // Return an error: require(dep_sym != nullptr, - "Dependency " + found_dep + " was not found in the parent symbol table " + std::string(x.m_name)); + "Dependency " + found_dep + " is inside symbol table " + std::string(x.m_name)); } } } @@ -894,16 +894,21 @@ class VerifyVisitor : public BaseWalkVisitor } } - if ((current_symtab->get_counter() != ASRUtils::symbol_parent_symtab(x.m_name)->get_counter()) || + if ((current_symtab->get_counter() != ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() && !ASR::is_a(*x.m_name)) || (ASRUtils::symbol_parent_symtab(x.m_name)->parent == nullptr)) { - // add to dependencies - function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); - } + ASR::symbol_t* asr_owner_sym = nullptr; + if( ASR::is_a(*current_symtab->asr_owner) ) { + asr_owner_sym = ASR::down_cast(current_symtab->asr_owner); + } - if( ASR::is_a(*x.m_name) ) { - ASR::ExternalSymbol_t* x_m_name = ASR::down_cast(x.m_name); - if( x_m_name->m_external && ASR::is_a(*ASRUtils::get_asr_owner(x_m_name->m_external)) ) { - module_dependencies.push_back(std::string(x_m_name->m_module_name)); + // check if asr owner is associate block. + if( asr_owner_sym && (ASR::is_a(*asr_owner_sym) || + ASR::is_a(*asr_owner_sym)) ) { + if (ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() != current_symtab->parent->get_counter()) { + function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); + } + } else { + function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); } } @@ -1033,16 +1038,21 @@ class VerifyVisitor : public BaseWalkVisitor require(x.m_name, "FunctionCall::m_name must be present"); // Check x.m_name is from parent sym tab. - if ((ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() != current_symtab->get_counter()) || - (ASRUtils::symbol_parent_symtab(x.m_name)->parent == nullptr)) { - // add to dependencies - function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); - } + if (ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() != current_symtab->get_counter() || + ASRUtils::symbol_parent_symtab(x.m_name)->parent == nullptr) { + ASR::symbol_t* asr_owner_sym = nullptr; + if( ASR::is_a(*current_symtab->asr_owner) ) { + asr_owner_sym = ASR::down_cast(current_symtab->asr_owner); + } - if( ASR::is_a(*x.m_name) ) { - ASR::ExternalSymbol_t* x_m_name = ASR::down_cast(x.m_name); - if( x_m_name->m_external && ASR::is_a(*ASRUtils::get_asr_owner(x_m_name->m_external)) ) { - module_dependencies.push_back(std::string(x_m_name->m_module_name)); + // check if asr owner is associate block. + if( asr_owner_sym && (ASR::is_a(*asr_owner_sym) || + ASR::is_a(*asr_owner_sym)) ) { + if (ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() != current_symtab->parent->get_counter()) { + function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); + } + } else { + function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); } } diff --git a/src/libasr/pass/instantiate_template.cpp b/src/libasr/pass/instantiate_template.cpp index b4ec0c8fa1..20aba0e70d 100644 --- a/src/libasr/pass/instantiate_template.cpp +++ b/src/libasr/pass/instantiate_template.cpp @@ -344,7 +344,7 @@ class SymbolInstantiator : public ASR::BaseExprStmtDuplicator(name2)); context_map[ASRUtils::symbol_name(name2)] = ASRUtils::symbol_name(name); } - if (ASRUtils::symbol_parent_symtab(name) == template_scope->parent) { + if (ASRUtils::symbol_parent_symtab(name)->get_counter() != current_scope->get_counter()) { dependencies.push_back(al, ASRUtils::symbol_name(name)); } return ASRUtils::make_FunctionCall_t_util(al, x->base.base.loc, name, x->m_original_name, @@ -372,7 +372,7 @@ class SymbolInstantiator : public ASR::BaseExprStmtDuplicatorparent) { + if (ASRUtils::symbol_parent_symtab(name)->get_counter() != current_scope->get_counter()) { dependencies.push_back(al, ASRUtils::symbol_name(name)); } return ASRUtils::make_SubroutineCall_t_util(al, x->base.base.loc, name /* change this */, diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index f21d05137d..545cf81fc7 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -319,7 +319,7 @@ namespace LCompilers { } void visit_FunctionCall(const ASR::FunctionCall_t& x) { - if (fill_function_dependencies) { + if (fill_function_dependencies) { if (ASR::is_a(*x.m_name)) { ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); if (!ASRUtils::is_present_in_current_scope(external_symbol, current_scope)) { From ccaa3ec6856736fbc30e8009f87e550460ca18f3 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Wed, 4 Oct 2023 16:17:47 +0530 Subject: [PATCH 26/30] dev: udpate branch --- src/libasr/pass/instantiate_template.cpp | 232 +++++++++++++++++++++-- 1 file changed, 221 insertions(+), 11 deletions(-) diff --git a/src/libasr/pass/instantiate_template.cpp b/src/libasr/pass/instantiate_template.cpp index 65c42623ce..8938eb97f9 100644 --- a/src/libasr/pass/instantiate_template.cpp +++ b/src/libasr/pass/instantiate_template.cpp @@ -431,14 +431,14 @@ class SymbolInstantiator : public ASR::BaseExprStmtDuplicatorget_counter() != current_scope->get_counter()) { - dependencies.push_back(al, ASRUtils::symbol_name(name)); - } -======= dependencies.push_back(al, ASRUtils::symbol_name(name)); ->>>>>>> main +======= + if (ASRUtils::symbol_parent_symtab(name) == template_scope->parent) { + dependencies.push_back(al, ASRUtils::symbol_name(name)); + } +>>>>>>> c1116e3b9 (fix: check while adding dependencies to make sure they are from same symtab) return ASRUtils::make_FunctionCall_t_util(al, x->base.base.loc, name, x->m_original_name, args.p, args.size(), type, value, dt); } @@ -481,16 +481,16 @@ class SymbolInstantiator : public ASR::BaseExprStmtDuplicatorget_counter() != current_scope->get_counter()) { - dependencies.push_back(al, ASRUtils::symbol_name(name)); - } - return ASRUtils::make_SubroutineCall_t_util(al, x->base.base.loc, name /* change this */, -======= dependencies.push_back(al, ASRUtils::symbol_name(name)); return ASRUtils::make_SubroutineCall_t_util(al, x->base.base.loc, name, ->>>>>>> main +======= + if (ASRUtils::symbol_parent_symtab(name) == template_scope->parent) { + dependencies.push_back(al, ASRUtils::symbol_name(name)); + } + return ASRUtils::make_SubroutineCall_t_util(al, x->base.base.loc, name /* change this */, +>>>>>>> c1116e3b9 (fix: check while adding dependencies to make sure they are from same symtab) x->m_original_name, args.p, args.size(), dt, nullptr, false); } @@ -642,6 +642,7 @@ void check_restriction(std::map type_subs, )); throw SemanticAbort(); } +<<<<<<< HEAD for (size_t i = 0; i < f->n_args; i++) { ASR::ttype_t *f_param = ASRUtils::expr_type(f->m_args[i]); ASR::ttype_t *arg_param = ASRUtils::expr_type(arg->m_args[i]); @@ -664,6 +665,215 @@ void check_restriction(std::map type_subs, {f->m_args[i]->base.loc}), diag::Label("Function's parameter " + avar + " of type " + atype, {arg->m_args[i]->base.loc}) +======= + + ASR::asr_t* duplicate_Var(ASR::Var_t *x) { + std::string sym_name = ASRUtils::symbol_name(x->m_v); + ASR::symbol_t *sym = current_scope->get_symbol(sym_name); + return ASR::make_Var_t(al, x->base.base.loc, sym); + } + + ASR::asr_t* duplicate_ArrayItem(ASR::ArrayItem_t *x) { + ASR::expr_t *m_v = duplicate_expr(x->m_v); + ASR::expr_t *m_value = duplicate_expr(x->m_value); + + Vec args; + args.reserve(al, x->n_args); + for (size_t i=0; in_args; i++) { + args.push_back(al, duplicate_array_index(x->m_args[i])); + } + + ASR::ttype_t *type = substitute_type(x->m_type); + + return ASRUtils::make_ArrayItem_t_util(al, x->base.base.loc, m_v, args.p, x->n_args, + ASRUtils::type_get_past_allocatable(type), x->m_storage_format, m_value); + } + + ASR::asr_t* duplicate_ListItem(ASR::ListItem_t *x) { + ASR::expr_t *m_a = duplicate_expr(x->m_a); + ASR::expr_t *m_pos = duplicate_expr(x->m_pos); + ASR::ttype_t *type = substitute_type(x->m_type); + ASR::expr_t *m_value = duplicate_expr(x->m_value); + + return ASR::make_ListItem_t(al, x->base.base.loc, + m_a, m_pos, type, m_value); + } + + ASR::array_index_t duplicate_array_index(ASR::array_index_t x) { + ASR::expr_t *left = duplicate_expr(x.m_left); + ASR::expr_t *right = duplicate_expr(x.m_right); + ASR::expr_t *step = duplicate_expr(x.m_step); + ASR::array_index_t result; + result.m_left = left; + result.m_right = right; + result.m_step = step; + return result; + } + + ASR::asr_t* duplicate_Assignment(ASR::Assignment_t *x) { + ASR::expr_t *target = duplicate_expr(x->m_target); + ASR::expr_t *value = duplicate_expr(x->m_value); + ASR::stmt_t *overloaded = duplicate_stmt(x->m_overloaded); + return ASR::make_Assignment_t(al, x->base.base.loc, target, value, overloaded); + } + + ASR::asr_t* duplicate_DoLoop(ASR::DoLoop_t *x) { + Vec m_body; + m_body.reserve(al, x->n_body); + for (size_t i=0; in_body; i++) { + m_body.push_back(al, duplicate_stmt(x->m_body[i])); + } + ASR::do_loop_head_t head; + head.m_v = duplicate_expr(x->m_head.m_v); + head.m_start = duplicate_expr(x->m_head.m_start); + head.m_end = duplicate_expr(x->m_head.m_end); + head.m_increment = duplicate_expr(x->m_head.m_increment); + head.loc = x->m_head.m_v->base.loc; + return ASR::make_DoLoop_t(al, x->base.base.loc, x->m_name, head, m_body.p, x->n_body); + } + + ASR::asr_t* duplicate_Cast(ASR::Cast_t *x) { + ASR::expr_t *arg = duplicate_expr(x->m_arg); + ASR::ttype_t *type = substitute_type(ASRUtils::expr_type(x->m_arg)); + if (ASRUtils::is_real(*type)) { + return (ASR::asr_t*) arg; + } + return ASRUtils::make_Cast_t_value(al, x->base.base.loc, arg, ASR::cast_kindType::IntegerToReal, x->m_type); + } + + ASR::asr_t* duplicate_FunctionCall(ASR::FunctionCall_t *x) { + std::string call_name = ASRUtils::symbol_name(x->m_name); + ASR::symbol_t *name = func_scope->get_symbol(call_name); + Vec args; + args.reserve(al, x->n_args); + for (size_t i=0; in_args; i++) { + ASR::call_arg_t new_arg; + new_arg.loc = x->m_args[i].loc; + new_arg.m_value = duplicate_expr(x->m_args[i].m_value); + args.push_back(al, new_arg); + } + ASR::ttype_t* type = substitute_type(x->m_type); + ASR::expr_t* value = duplicate_expr(x->m_value); + ASR::expr_t* dt = duplicate_expr(x->m_dt); + if (ASRUtils::is_restriction_function(name)) { + name = rt_subs[call_name]; + } else if (ASRUtils::is_generic_function(name)) { + std::string nested_func_name = current_scope->get_unique_name("__asr_generic_" + call_name, false); + ASR::symbol_t* name2 = ASRUtils::symbol_get_past_external(name); + ASR::Function_t* func = ASR::down_cast(name2); + FunctionInstantiator nested_tf(al, subs, rt_subs, func_scope, nested_func_name); + ASR::asr_t* nested_generic_func = nested_tf.instantiate_Function(func); + name = ASR::down_cast(nested_generic_func); + } + if (ASRUtils::symbol_parent_symtab(name) == func_scope->parent) { + dependencies.push_back(al, ASRUtils::symbol_name(name)); + } + return ASRUtils::make_FunctionCall_t_util(al, x->base.base.loc, name, x->m_original_name, + args.p, args.size(), type, value, dt); + } + + ASR::asr_t* duplicate_SubroutineCall(ASR::SubroutineCall_t *x) { + std::string call_name = ASRUtils::symbol_name(x->m_name); + ASR::symbol_t *name = func_scope->get_symbol(call_name); + Vec args; + args.reserve(al, x->n_args); + for (size_t i=0; in_args; i++) { + ASR::call_arg_t new_arg; + new_arg.loc = x->m_args[i].loc; + new_arg.m_value = duplicate_expr(x->m_args[i].m_value); + args.push_back(al, new_arg); + } + ASR::expr_t* dt = duplicate_expr(x->m_dt); + if (ASRUtils::is_restriction_function(name)) { + name = rt_subs[call_name]; + } else { + std::string nested_func_name = current_scope->get_unique_name("__asr_generic_" + call_name, false); + ASR::symbol_t* name2 = ASRUtils::symbol_get_past_external(name); + ASR::Function_t* func = ASR::down_cast(name2); + FunctionInstantiator nested_tf(al, subs, rt_subs, func_scope, nested_func_name); + ASR::asr_t* nested_generic_func = nested_tf.instantiate_Function(func); + name = ASR::down_cast(nested_generic_func); + } + if (ASRUtils::symbol_parent_symtab(name) == func_scope->parent) { + dependencies.push_back(al, ASRUtils::symbol_name(name)); + } + return ASRUtils::make_SubroutineCall_t_util(al, x->base.base.loc, name /* change this */, + x->m_original_name, args.p, args.size(), dt, nullptr, false); + } + + + ASR::ttype_t* substitute_type(ASR::ttype_t *param_type) { + if (ASR::is_a(*param_type)) { + ASR::List_t *tlist = ASR::down_cast(param_type); + return ASRUtils::TYPE(ASR::make_List_t(al, param_type->base.loc, + substitute_type(tlist->m_type))); + } + ASR::ttype_t* param_type_ = ASRUtils::type_get_past_array(param_type); + ASR::dimension_t* m_dims = nullptr; + size_t n_dims = ASRUtils::extract_dimensions_from_ttype(param_type, m_dims); + if (ASR::is_a(*param_type_)) { + ASR::TypeParameter_t *param = ASR::down_cast(param_type_); + Vec new_dims; + new_dims.reserve(al, n_dims); + for (size_t i = 0; i < n_dims; i++) { + ASR::dimension_t old_dim = m_dims[i]; + ASR::dimension_t new_dim; + new_dim.loc = old_dim.loc; + new_dim.m_start = duplicate_expr(old_dim.m_start); + new_dim.m_length = duplicate_expr(old_dim.m_length); + new_dims.push_back(al, new_dim); + } + ASR::ttype_t *t = ASRUtils::type_get_past_array(subs[param->m_param]); + ASR::ttype_t *t_ = nullptr; + switch (t->type) { + case ASR::ttypeType::Integer: { + ASR::Integer_t* tnew = ASR::down_cast(t); + t_ = ASRUtils::TYPE(ASR::make_Integer_t(al, t->base.loc, tnew->m_kind)); + break; + } + case ASR::ttypeType::Real: { + ASR::Real_t* tnew = ASR::down_cast(t); + t_ = ASRUtils::TYPE(ASR::make_Real_t(al, t->base.loc, tnew->m_kind)); + break; + } + case ASR::ttypeType::Character: { + ASR::Character_t* tnew = ASR::down_cast(t); + t_ = ASRUtils::TYPE(ASR::make_Character_t(al, t->base.loc, + tnew->m_kind, tnew->m_len, tnew->m_len_expr)); + break; + } + default: { + return subs[param->m_param]; + } + } + if( new_dims.size() > 0 ) { + t_ = ASRUtils::make_Array_t_util(al, t->base.loc, + t_, new_dims.p, new_dims.size()); + } + return t_; + } + return param_type; + } + + ASR::asr_t* make_BinOp_helper(ASR::expr_t *left, ASR::expr_t *right, + ASR::binopType op, const Location &loc) { + ASR::ttype_t *left_type = ASRUtils::expr_type(left); + ASR::ttype_t *right_type = ASRUtils::expr_type(right); + ASR::ttype_t *dest_type = nullptr; + ASR::expr_t *value = nullptr; + + if (op == ASR::binopType::Div) { + dest_type = ASRUtils::TYPE(ASR::make_Real_t(al, loc, 8)); + if (ASRUtils::is_integer(*left_type)) { + left = ASR::down_cast(ASRUtils::make_Cast_t_value( + al, left->base.loc, left, ASR::cast_kindType::IntegerToReal, dest_type)); + } + if (ASRUtils::is_integer(*right_type)) { + if (ASRUtils::expr_value(right) != nullptr) { + int64_t val = ASR::down_cast(ASRUtils::expr_value(right))->m_n; + if (val == 0) { + throw SemanticError("division by zero is not allowed", right->base.loc); +>>>>>>> c1116e3b9 (fix: check while adding dependencies to make sure they are from same symtab) } )); throw SemanticAbort(); From f68f71a421dad07f9837898bda0d796e2fffb665 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Wed, 4 Oct 2023 19:34:34 +0530 Subject: [PATCH 27/30] fix: updated all references --- src/libasr/pass/instantiate_template.cpp | 225 +----------------- tests/reference/asr-cast-435c233.json | 6 +- tests/reference/asr-complex1-f26c460.json | 6 +- tests/reference/asr-constants1-5828e8a.json | 6 +- tests/reference/asr-elemental_01-b58df26.json | 6 +- .../reference/asr-elemental_01-b58df26.stdout | 24 -- tests/reference/asr-expr10-efcbb1b.json | 6 +- tests/reference/asr-expr13-81bdb5a.json | 6 +- tests/reference/asr-expr7-480ba2f.json | 6 +- tests/reference/asr-expr8-6beda60.json | 6 +- tests/reference/asr-expr_05-3a37324.json | 6 +- .../asr-test_bool_binop-f856ef0.json | 6 +- .../asr-test_builtin_bin-52ba9fa.json | 6 +- .../asr-test_builtin_bool-330223a.json | 6 +- .../asr-test_builtin_hex-64bd268.json | 6 +- .../asr-test_builtin_oct-20b9066.json | 6 +- .../asr-test_builtin_pow-f02fcda.json | 6 +- .../asr-test_builtin_round-7417a21.json | 6 +- .../asr-test_complex_01-a6def58.json | 6 +- .../asr-test_complex_02-782ba2d.json | 6 +- tests/reference/asr-test_max_min-3c2fc51.json | 6 +- .../reference/asr-test_numpy_03-e600a49.json | 6 +- .../asr-test_numpy_03-e600a49.stdout | 10 - tests/reference/asr-test_pow-3f5d550.json | 6 +- .../pass_loop_vectorise-vec_01-be9985e.json | 6 +- 25 files changed, 23 insertions(+), 368 deletions(-) diff --git a/src/libasr/pass/instantiate_template.cpp b/src/libasr/pass/instantiate_template.cpp index 8938eb97f9..3c17db5682 100644 --- a/src/libasr/pass/instantiate_template.cpp +++ b/src/libasr/pass/instantiate_template.cpp @@ -305,8 +305,6 @@ class SymbolInstantiator : public ASR::BaseExprStmtDuplicatorm_v); ASR::symbol_t* sym = duplicate_symbol(x->m_v); @@ -430,15 +428,9 @@ class SymbolInstantiator : public ASR::BaseExprStmtDuplicatorparent) { dependencies.push_back(al, ASRUtils::symbol_name(name)); } ->>>>>>> c1116e3b9 (fix: check while adding dependencies to make sure they are from same symtab) return ASRUtils::make_FunctionCall_t_util(al, x->base.base.loc, name, x->m_original_name, args.p, args.size(), type, value, dt); } @@ -480,17 +472,10 @@ class SymbolInstantiator : public ASR::BaseExprStmtDuplicatorbase.base.loc, name, -======= if (ASRUtils::symbol_parent_symtab(name) == template_scope->parent) { dependencies.push_back(al, ASRUtils::symbol_name(name)); } return ASRUtils::make_SubroutineCall_t_util(al, x->base.base.loc, name /* change this */, ->>>>>>> c1116e3b9 (fix: check while adding dependencies to make sure they are from same symtab) x->m_original_name, args.p, args.size(), dt, nullptr, false); } @@ -642,7 +627,6 @@ void check_restriction(std::map type_subs, )); throw SemanticAbort(); } -<<<<<<< HEAD for (size_t i = 0; i < f->n_args; i++) { ASR::ttype_t *f_param = ASRUtils::expr_type(f->m_args[i]); ASR::ttype_t *arg_param = ASRUtils::expr_type(arg->m_args[i]); @@ -665,215 +649,8 @@ void check_restriction(std::map type_subs, {f->m_args[i]->base.loc}), diag::Label("Function's parameter " + avar + " of type " + atype, {arg->m_args[i]->base.loc}) -======= - - ASR::asr_t* duplicate_Var(ASR::Var_t *x) { - std::string sym_name = ASRUtils::symbol_name(x->m_v); - ASR::symbol_t *sym = current_scope->get_symbol(sym_name); - return ASR::make_Var_t(al, x->base.base.loc, sym); - } - - ASR::asr_t* duplicate_ArrayItem(ASR::ArrayItem_t *x) { - ASR::expr_t *m_v = duplicate_expr(x->m_v); - ASR::expr_t *m_value = duplicate_expr(x->m_value); - - Vec args; - args.reserve(al, x->n_args); - for (size_t i=0; in_args; i++) { - args.push_back(al, duplicate_array_index(x->m_args[i])); - } - - ASR::ttype_t *type = substitute_type(x->m_type); - - return ASRUtils::make_ArrayItem_t_util(al, x->base.base.loc, m_v, args.p, x->n_args, - ASRUtils::type_get_past_allocatable(type), x->m_storage_format, m_value); - } - - ASR::asr_t* duplicate_ListItem(ASR::ListItem_t *x) { - ASR::expr_t *m_a = duplicate_expr(x->m_a); - ASR::expr_t *m_pos = duplicate_expr(x->m_pos); - ASR::ttype_t *type = substitute_type(x->m_type); - ASR::expr_t *m_value = duplicate_expr(x->m_value); - - return ASR::make_ListItem_t(al, x->base.base.loc, - m_a, m_pos, type, m_value); - } - - ASR::array_index_t duplicate_array_index(ASR::array_index_t x) { - ASR::expr_t *left = duplicate_expr(x.m_left); - ASR::expr_t *right = duplicate_expr(x.m_right); - ASR::expr_t *step = duplicate_expr(x.m_step); - ASR::array_index_t result; - result.m_left = left; - result.m_right = right; - result.m_step = step; - return result; - } - - ASR::asr_t* duplicate_Assignment(ASR::Assignment_t *x) { - ASR::expr_t *target = duplicate_expr(x->m_target); - ASR::expr_t *value = duplicate_expr(x->m_value); - ASR::stmt_t *overloaded = duplicate_stmt(x->m_overloaded); - return ASR::make_Assignment_t(al, x->base.base.loc, target, value, overloaded); - } - - ASR::asr_t* duplicate_DoLoop(ASR::DoLoop_t *x) { - Vec m_body; - m_body.reserve(al, x->n_body); - for (size_t i=0; in_body; i++) { - m_body.push_back(al, duplicate_stmt(x->m_body[i])); - } - ASR::do_loop_head_t head; - head.m_v = duplicate_expr(x->m_head.m_v); - head.m_start = duplicate_expr(x->m_head.m_start); - head.m_end = duplicate_expr(x->m_head.m_end); - head.m_increment = duplicate_expr(x->m_head.m_increment); - head.loc = x->m_head.m_v->base.loc; - return ASR::make_DoLoop_t(al, x->base.base.loc, x->m_name, head, m_body.p, x->n_body); - } - - ASR::asr_t* duplicate_Cast(ASR::Cast_t *x) { - ASR::expr_t *arg = duplicate_expr(x->m_arg); - ASR::ttype_t *type = substitute_type(ASRUtils::expr_type(x->m_arg)); - if (ASRUtils::is_real(*type)) { - return (ASR::asr_t*) arg; - } - return ASRUtils::make_Cast_t_value(al, x->base.base.loc, arg, ASR::cast_kindType::IntegerToReal, x->m_type); - } - - ASR::asr_t* duplicate_FunctionCall(ASR::FunctionCall_t *x) { - std::string call_name = ASRUtils::symbol_name(x->m_name); - ASR::symbol_t *name = func_scope->get_symbol(call_name); - Vec args; - args.reserve(al, x->n_args); - for (size_t i=0; in_args; i++) { - ASR::call_arg_t new_arg; - new_arg.loc = x->m_args[i].loc; - new_arg.m_value = duplicate_expr(x->m_args[i].m_value); - args.push_back(al, new_arg); - } - ASR::ttype_t* type = substitute_type(x->m_type); - ASR::expr_t* value = duplicate_expr(x->m_value); - ASR::expr_t* dt = duplicate_expr(x->m_dt); - if (ASRUtils::is_restriction_function(name)) { - name = rt_subs[call_name]; - } else if (ASRUtils::is_generic_function(name)) { - std::string nested_func_name = current_scope->get_unique_name("__asr_generic_" + call_name, false); - ASR::symbol_t* name2 = ASRUtils::symbol_get_past_external(name); - ASR::Function_t* func = ASR::down_cast(name2); - FunctionInstantiator nested_tf(al, subs, rt_subs, func_scope, nested_func_name); - ASR::asr_t* nested_generic_func = nested_tf.instantiate_Function(func); - name = ASR::down_cast(nested_generic_func); - } - if (ASRUtils::symbol_parent_symtab(name) == func_scope->parent) { - dependencies.push_back(al, ASRUtils::symbol_name(name)); - } - return ASRUtils::make_FunctionCall_t_util(al, x->base.base.loc, name, x->m_original_name, - args.p, args.size(), type, value, dt); - } - - ASR::asr_t* duplicate_SubroutineCall(ASR::SubroutineCall_t *x) { - std::string call_name = ASRUtils::symbol_name(x->m_name); - ASR::symbol_t *name = func_scope->get_symbol(call_name); - Vec args; - args.reserve(al, x->n_args); - for (size_t i=0; in_args; i++) { - ASR::call_arg_t new_arg; - new_arg.loc = x->m_args[i].loc; - new_arg.m_value = duplicate_expr(x->m_args[i].m_value); - args.push_back(al, new_arg); - } - ASR::expr_t* dt = duplicate_expr(x->m_dt); - if (ASRUtils::is_restriction_function(name)) { - name = rt_subs[call_name]; - } else { - std::string nested_func_name = current_scope->get_unique_name("__asr_generic_" + call_name, false); - ASR::symbol_t* name2 = ASRUtils::symbol_get_past_external(name); - ASR::Function_t* func = ASR::down_cast(name2); - FunctionInstantiator nested_tf(al, subs, rt_subs, func_scope, nested_func_name); - ASR::asr_t* nested_generic_func = nested_tf.instantiate_Function(func); - name = ASR::down_cast(nested_generic_func); - } - if (ASRUtils::symbol_parent_symtab(name) == func_scope->parent) { - dependencies.push_back(al, ASRUtils::symbol_name(name)); - } - return ASRUtils::make_SubroutineCall_t_util(al, x->base.base.loc, name /* change this */, - x->m_original_name, args.p, args.size(), dt, nullptr, false); - } - - - ASR::ttype_t* substitute_type(ASR::ttype_t *param_type) { - if (ASR::is_a(*param_type)) { - ASR::List_t *tlist = ASR::down_cast(param_type); - return ASRUtils::TYPE(ASR::make_List_t(al, param_type->base.loc, - substitute_type(tlist->m_type))); - } - ASR::ttype_t* param_type_ = ASRUtils::type_get_past_array(param_type); - ASR::dimension_t* m_dims = nullptr; - size_t n_dims = ASRUtils::extract_dimensions_from_ttype(param_type, m_dims); - if (ASR::is_a(*param_type_)) { - ASR::TypeParameter_t *param = ASR::down_cast(param_type_); - Vec new_dims; - new_dims.reserve(al, n_dims); - for (size_t i = 0; i < n_dims; i++) { - ASR::dimension_t old_dim = m_dims[i]; - ASR::dimension_t new_dim; - new_dim.loc = old_dim.loc; - new_dim.m_start = duplicate_expr(old_dim.m_start); - new_dim.m_length = duplicate_expr(old_dim.m_length); - new_dims.push_back(al, new_dim); - } - ASR::ttype_t *t = ASRUtils::type_get_past_array(subs[param->m_param]); - ASR::ttype_t *t_ = nullptr; - switch (t->type) { - case ASR::ttypeType::Integer: { - ASR::Integer_t* tnew = ASR::down_cast(t); - t_ = ASRUtils::TYPE(ASR::make_Integer_t(al, t->base.loc, tnew->m_kind)); - break; - } - case ASR::ttypeType::Real: { - ASR::Real_t* tnew = ASR::down_cast(t); - t_ = ASRUtils::TYPE(ASR::make_Real_t(al, t->base.loc, tnew->m_kind)); - break; - } - case ASR::ttypeType::Character: { - ASR::Character_t* tnew = ASR::down_cast(t); - t_ = ASRUtils::TYPE(ASR::make_Character_t(al, t->base.loc, - tnew->m_kind, tnew->m_len, tnew->m_len_expr)); - break; - } - default: { - return subs[param->m_param]; - } - } - if( new_dims.size() > 0 ) { - t_ = ASRUtils::make_Array_t_util(al, t->base.loc, - t_, new_dims.p, new_dims.size()); - } - return t_; - } - return param_type; - } - ASR::asr_t* make_BinOp_helper(ASR::expr_t *left, ASR::expr_t *right, - ASR::binopType op, const Location &loc) { - ASR::ttype_t *left_type = ASRUtils::expr_type(left); - ASR::ttype_t *right_type = ASRUtils::expr_type(right); - ASR::ttype_t *dest_type = nullptr; - ASR::expr_t *value = nullptr; - - if (op == ASR::binopType::Div) { - dest_type = ASRUtils::TYPE(ASR::make_Real_t(al, loc, 8)); - if (ASRUtils::is_integer(*left_type)) { - left = ASR::down_cast(ASRUtils::make_Cast_t_value( - al, left->base.loc, left, ASR::cast_kindType::IntegerToReal, dest_type)); - } - if (ASRUtils::is_integer(*right_type)) { - if (ASRUtils::expr_value(right) != nullptr) { - int64_t val = ASR::down_cast(ASRUtils::expr_value(right))->m_n; - if (val == 0) { - throw SemanticError("division by zero is not allowed", right->base.loc); ->>>>>>> c1116e3b9 (fix: check while adding dependencies to make sure they are from same symtab) + } )); throw SemanticAbort(); diff --git a/tests/reference/asr-cast-435c233.json b/tests/reference/asr-cast-435c233.json index 18b40c9e6a..ce2be3af7c 100644 --- a/tests/reference/asr-cast-435c233.json +++ b/tests/reference/asr-cast-435c233.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-cast-435c233.stdout", -<<<<<<< HEAD - "stdout_hash": "a93c5a7141a3d175723f95e3422250bc69fa23fb1da39a6a132668dc", -======= - "stdout_hash": "bc6585a6ab9f9cb1de5bacadd387d304bbc069de158b026c4550977e", ->>>>>>> main + "stdout_hash": "4c731533d547b2630acc8699541a48c0bdc2132c471b0a6b2da11821", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex1-f26c460.json b/tests/reference/asr-complex1-f26c460.json index 7512965166..3cdf38e4df 100644 --- a/tests/reference/asr-complex1-f26c460.json +++ b/tests/reference/asr-complex1-f26c460.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-complex1-f26c460.stdout", -<<<<<<< HEAD - "stdout_hash": "79c039ef8f2b16c8518e689aaaf252a4dd5048a6a08df68a4453e7a8", -======= - "stdout_hash": "dbf14823f5ba118f855c7db3da76c72138b44e148c0cad01166a5145", ->>>>>>> main + "stdout_hash": "68b0165763f04e3f22acaf58650235696915a1cf248d03285d192b86", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-constants1-5828e8a.json b/tests/reference/asr-constants1-5828e8a.json index 20ba2193df..59742c79ef 100644 --- a/tests/reference/asr-constants1-5828e8a.json +++ b/tests/reference/asr-constants1-5828e8a.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-constants1-5828e8a.stdout", -<<<<<<< HEAD - "stdout_hash": "0fa8ae62e9e27ea07bf0b0afccb810077ffa18387e0395df6cbca44f", -======= - "stdout_hash": "3e3b391023b8c9a848cd795e6a8ef252ba77710b1561ed988fd78b0f", ->>>>>>> main + "stdout_hash": "350e6f56a832c3f862530f86ec7756c70dfd962b643f8bbf3cf83379", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-elemental_01-b58df26.json b/tests/reference/asr-elemental_01-b58df26.json index 296973f255..6daa01abf7 100644 --- a/tests/reference/asr-elemental_01-b58df26.json +++ b/tests/reference/asr-elemental_01-b58df26.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-elemental_01-b58df26.stdout", -<<<<<<< HEAD - "stdout_hash": "da277578ff8ae3e4abc00d27e996ad5a2c87d3fe600bcabc9a3ac76c", -======= - "stdout_hash": "9621078691e8fdc6b9382f8bc62b6abba1ef6c48617198fa2a310503", ->>>>>>> main + "stdout_hash": "cd43987d960fd2c539c2997bddeecbf1beb86f0aa2b484b63d7faf86", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-elemental_01-b58df26.stdout b/tests/reference/asr-elemental_01-b58df26.stdout index 246130f790..9a00b4982e 100644 --- a/tests/reference/asr-elemental_01-b58df26.stdout +++ b/tests/reference/asr-elemental_01-b58df26.stdout @@ -2361,17 +2361,10 @@ [] .false. ) -<<<<<<< HEAD [] - [(Var 200 array) - (Var 200 result) - (Var 200 size)] -======= - [sin@__lpython_overloaded_1__sin] [(Var 212 array) (Var 212 result) (Var 212 size)] ->>>>>>> main [(= (Var 212 eps) (Cast @@ -3200,19 +3193,11 @@ [] .false. ) -<<<<<<< HEAD [] - [(Var 202 array) - (Var 202 result) - (Var 202 size1) - (Var 202 size2)] -======= - [cos@__lpython_overloaded_0__cos] [(Var 214 array) (Var 214 result) (Var 214 size1) (Var 214 size2)] ->>>>>>> main [(= (Var 214 eps) (RealConstant @@ -3583,21 +3568,12 @@ [] .false. ) -<<<<<<< HEAD [] - [(Var 201 array) - (Var 201 result) - (Var 201 size1) - (Var 201 size2) - (Var 201 size3)] -======= - [sin@__lpython_overloaded_0__sin] [(Var 213 array) (Var 213 result) (Var 213 size1) (Var 213 size2) (Var 213 size3)] ->>>>>>> main [(= (Var 213 eps) (RealConstant diff --git a/tests/reference/asr-expr10-efcbb1b.json b/tests/reference/asr-expr10-efcbb1b.json index c3c1830c32..05532192ad 100644 --- a/tests/reference/asr-expr10-efcbb1b.json +++ b/tests/reference/asr-expr10-efcbb1b.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr10-efcbb1b.stdout", -<<<<<<< HEAD - "stdout_hash": "c7c960bbb2727dc2a772b647860ed67a02542f54cdd7928d44c1dd4b", -======= - "stdout_hash": "2a5bd5360e8284c71c4513549995e66d94c58a71e00e56c7fce353ea", ->>>>>>> main + "stdout_hash": "97874ad5a7c989aa533d6a6cc5182c2df1b182e072490c7178794e63", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr13-81bdb5a.json b/tests/reference/asr-expr13-81bdb5a.json index e873bea8af..ce548b04c5 100644 --- a/tests/reference/asr-expr13-81bdb5a.json +++ b/tests/reference/asr-expr13-81bdb5a.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr13-81bdb5a.stdout", -<<<<<<< HEAD - "stdout_hash": "70c21d0c64fa54ca205d047bd2e84dc8a4c38a9c30a48c76feb39fe0", -======= - "stdout_hash": "fa09d415d8cc21c3b0f5b1e0276c3155a22abe22afa2d05caf07c2e3", ->>>>>>> main + "stdout_hash": "b9fdc8078c36dfb80e5c8960105953476d1322c5f1fe6bf2d9f39843", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr7-480ba2f.json b/tests/reference/asr-expr7-480ba2f.json index 0ed7e03471..0c03333b4e 100644 --- a/tests/reference/asr-expr7-480ba2f.json +++ b/tests/reference/asr-expr7-480ba2f.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr7-480ba2f.stdout", -<<<<<<< HEAD - "stdout_hash": "4e6ab2ecae35cc108c6a70080a969503e16aff1308a7247287f7b58b", -======= - "stdout_hash": "88c30ffb14f2ecd97ec1f2bab23bcb93de2a6bf31895ab2766b04d76", ->>>>>>> main + "stdout_hash": "63d005fb7a316f035583e4873a90162a4ebd4285659eb325bf9d02b8", "stderr": "asr-expr7-480ba2f.stderr", "stderr_hash": "6e9790ac88db1a9ead8f64a91ba8a6605de67167037908a74b77be0c", "returncode": 0 diff --git a/tests/reference/asr-expr8-6beda60.json b/tests/reference/asr-expr8-6beda60.json index e998725586..ade6328c9e 100644 --- a/tests/reference/asr-expr8-6beda60.json +++ b/tests/reference/asr-expr8-6beda60.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr8-6beda60.stdout", -<<<<<<< HEAD - "stdout_hash": "b71e5e452186a67fd2b8826a216a5fb4979402ddf063b7c87b7e7c73", -======= - "stdout_hash": "93a660ef9a1cf611f2b57d4713674589dbb4d32a862e8c7ddc3e0c90", ->>>>>>> main + "stdout_hash": "7804596f7c30c72f80ece86f950ae2f86f7528fdacc28c53f40400f1", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr_05-3a37324.json b/tests/reference/asr-expr_05-3a37324.json index 6611905641..ae68551ea4 100644 --- a/tests/reference/asr-expr_05-3a37324.json +++ b/tests/reference/asr-expr_05-3a37324.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr_05-3a37324.stdout", -<<<<<<< HEAD - "stdout_hash": "c8f99e38c1bc40d70719a82988fa1e66dd9cf4a19c6e74e134d1c5fc", -======= - "stdout_hash": "689af9ee83b49ffe1276c8e80c0f581c2c98ffafec8e478ace5bb9b1", ->>>>>>> main + "stdout_hash": "0f345938a12f561e5f4174754453a9563ea1b64ebae8bbb0581b44e3", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_bool_binop-f856ef0.json b/tests/reference/asr-test_bool_binop-f856ef0.json index 37da2c97ac..f3cbbb83f3 100644 --- a/tests/reference/asr-test_bool_binop-f856ef0.json +++ b/tests/reference/asr-test_bool_binop-f856ef0.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_bool_binop-f856ef0.stdout", -<<<<<<< HEAD - "stdout_hash": "c5e0ecc9ff081961a546fab314b4f0b4ef23f28cf9a79fa0738832e8", -======= - "stdout_hash": "17f23bdb23ec6588306416cfc406f24efad6516162c5ef0df1d3d82b", ->>>>>>> main + "stdout_hash": "932f32474d074b503b70c518d3e8c08872066f493430f427a6824530", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_bin-52ba9fa.json b/tests/reference/asr-test_builtin_bin-52ba9fa.json index 4c10325494..d377efe994 100644 --- a/tests/reference/asr-test_builtin_bin-52ba9fa.json +++ b/tests/reference/asr-test_builtin_bin-52ba9fa.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_bin-52ba9fa.stdout", -<<<<<<< HEAD - "stdout_hash": "680a99f17aa2515fddea6789550d97efb096e60d40d7cfbbca25ed78", -======= - "stdout_hash": "1e890169860970de5e3854bf64c7ffbc1fd23b063fce4ab0de9b1e16", ->>>>>>> main + "stdout_hash": "b0b05f14f7471c94bed4fb6aea40661fe7343c9d9d5c0b9903efff14", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_bool-330223a.json b/tests/reference/asr-test_builtin_bool-330223a.json index 1b5ea2c972..335c3ac3bf 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.json +++ b/tests/reference/asr-test_builtin_bool-330223a.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_bool-330223a.stdout", -<<<<<<< HEAD - "stdout_hash": "4e0d3c43fbcf3717c01c8616c9f217603cbcc6a3984c981e3b74a12d", -======= - "stdout_hash": "377cdab21d1ba71b7d6a3e9bf9f40ba475b5b9b4cd9e006ed667b111", ->>>>>>> main + "stdout_hash": "938519ce3ac9f8eda1210008be268edcf6ac9b74891f1746d1b18e9f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_hex-64bd268.json b/tests/reference/asr-test_builtin_hex-64bd268.json index a588615197..95ca1c8f55 100644 --- a/tests/reference/asr-test_builtin_hex-64bd268.json +++ b/tests/reference/asr-test_builtin_hex-64bd268.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_hex-64bd268.stdout", -<<<<<<< HEAD - "stdout_hash": "3f4f44611183abd194b2792d9f0e144450a3f7f30361c5d122f84f39", -======= - "stdout_hash": "1a7f0461d913632f1ec589d9e7dabb691a6a79867a0bf6a479e63f4c", ->>>>>>> main + "stdout_hash": "02d59264e2fbe9ccb269f0f273970b6bd645832fa98c64ffb36ec137", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_oct-20b9066.json b/tests/reference/asr-test_builtin_oct-20b9066.json index 38d54793cb..d3351600f6 100644 --- a/tests/reference/asr-test_builtin_oct-20b9066.json +++ b/tests/reference/asr-test_builtin_oct-20b9066.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_oct-20b9066.stdout", -<<<<<<< HEAD - "stdout_hash": "c6c2ff06fab4580bb9871dd8dcf9af2e0b87c9ce0eb361ff2a57d895", -======= - "stdout_hash": "04ee7955a5200e6df2403aca8f3fc666ce2cb55ccbd41a1090f8b237", ->>>>>>> main + "stdout_hash": "697397d8532c8acc556c5dba3974dd35e4592b1080baf9af0b7f9a7d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.json b/tests/reference/asr-test_builtin_pow-f02fcda.json index a37a02a3a7..05a124df54 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.json +++ b/tests/reference/asr-test_builtin_pow-f02fcda.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_pow-f02fcda.stdout", -<<<<<<< HEAD - "stdout_hash": "6d6bc4f51e62cd286fb18a6cd953e67589e860701933845e9d3d7a93", -======= - "stdout_hash": "15fe045c2a79d13f694ef48aeeb36591c591c48c1ac1cfa616fd34d5", ->>>>>>> main + "stdout_hash": "6a358c988b4732a60c3ea02cd7403ca4c9249eba61ab2f2a539bdf0b", "stderr": "asr-test_builtin_pow-f02fcda.stderr", "stderr_hash": "859ce76c74748f2d32c7eab92cfbba789a78d4cbf5818646b99806ea", "returncode": 0 diff --git a/tests/reference/asr-test_builtin_round-7417a21.json b/tests/reference/asr-test_builtin_round-7417a21.json index 9b1e9c142e..ad24e28175 100644 --- a/tests/reference/asr-test_builtin_round-7417a21.json +++ b/tests/reference/asr-test_builtin_round-7417a21.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_round-7417a21.stdout", -<<<<<<< HEAD - "stdout_hash": "9783dd9ac31b0b0e1d92dd60fc5ef0508abc51e3e164ad2dde50cd2f", -======= - "stdout_hash": "0c3484ee554ad7a87897572f1e69a962b2bb507b34ba76d86880b64e", ->>>>>>> main + "stdout_hash": "7f3953d10315e784945802f4ef28f972f12de929d2f2ac723c483c06", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_complex_01-a6def58.json b/tests/reference/asr-test_complex_01-a6def58.json index adde44efec..1c05898ec2 100644 --- a/tests/reference/asr-test_complex_01-a6def58.json +++ b/tests/reference/asr-test_complex_01-a6def58.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_complex_01-a6def58.stdout", -<<<<<<< HEAD - "stdout_hash": "89bff22ae4011a3d7199f258c1230931393646158c734711e48625cc", -======= - "stdout_hash": "fa123339a9e4fbca85b07a00c17aab429c1bb46deced489478c9873b", ->>>>>>> main + "stdout_hash": "bc5181b704f45ed85ee68b3c3b8f8f2ef181b42137be2ed589533b03", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_complex_02-782ba2d.json b/tests/reference/asr-test_complex_02-782ba2d.json index f5afccbcd6..e7b9a83ba3 100644 --- a/tests/reference/asr-test_complex_02-782ba2d.json +++ b/tests/reference/asr-test_complex_02-782ba2d.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_complex_02-782ba2d.stdout", -<<<<<<< HEAD - "stdout_hash": "25b57ce3115249491b17231131595fe5b6e48450a5a0ae64d953c1c6", -======= - "stdout_hash": "065f842790f986f276b50c69fb831c21de22dcb13fb0e410256ece9d", ->>>>>>> main + "stdout_hash": "365e926815e6839f184f1ab32d063026ae5512b759714c187b715aa4", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_max_min-3c2fc51.json b/tests/reference/asr-test_max_min-3c2fc51.json index 30211458fd..bb7833102a 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.json +++ b/tests/reference/asr-test_max_min-3c2fc51.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_max_min-3c2fc51.stdout", -<<<<<<< HEAD - "stdout_hash": "1528703065b1073e870964b86d45523ed1123524863c4912564680aa", -======= - "stdout_hash": "a964d176be4ba6471573df6a31c6c4cf316b64cedcefd405aca2a8e4", ->>>>>>> main + "stdout_hash": "13b8a783fc38586b1ebcfb69a4418d8fa2637f00e6d3539fde77f683", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_numpy_03-e600a49.json b/tests/reference/asr-test_numpy_03-e600a49.json index 5b3bf39504..dc97e79f6b 100644 --- a/tests/reference/asr-test_numpy_03-e600a49.json +++ b/tests/reference/asr-test_numpy_03-e600a49.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_numpy_03-e600a49.stdout", -<<<<<<< HEAD - "stdout_hash": "b69f88c99c91f982b312d430b0341540d2581fd0884c3d72b845661f", -======= - "stdout_hash": "7a6698c2c9b692acd326ecb2d1f9237927d923c4bf28a4ca9463ef7e", ->>>>>>> main + "stdout_hash": "3fe0882618be622cb922e7ddcd3a3648661f797c13582f8add218475", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_numpy_03-e600a49.stdout b/tests/reference/asr-test_numpy_03-e600a49.stdout index e0de8cd1f3..acfc606a48 100644 --- a/tests/reference/asr-test_numpy_03-e600a49.stdout +++ b/tests/reference/asr-test_numpy_03-e600a49.stdout @@ -372,13 +372,8 @@ [] .false. ) -<<<<<<< HEAD [] - [(Var 201 d)] -======= - [_lpython_floordiv@__lpython_overloaded_6___lpython_floordiv] [(Var 213 d)] ->>>>>>> main [(= (Var 213 eps) (RealConstant @@ -1298,13 +1293,8 @@ [] .false. ) -<<<<<<< HEAD [] - [(Var 200 a)] -======= - [_lpython_floordiv@__lpython_overloaded_6___lpython_floordiv] [(Var 212 a)] ->>>>>>> main [(= (Var 212 eps) (RealConstant diff --git a/tests/reference/asr-test_pow-3f5d550.json b/tests/reference/asr-test_pow-3f5d550.json index b4631cd969..5f4897a617 100644 --- a/tests/reference/asr-test_pow-3f5d550.json +++ b/tests/reference/asr-test_pow-3f5d550.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_pow-3f5d550.stdout", -<<<<<<< HEAD - "stdout_hash": "ee91c6b4a0299dd257cae7818490c801373f63341a6fc11f3b716282", -======= - "stdout_hash": "5582b0edc3023c39d0fb65cc5aaf3c7defb77e787c725b44240bda38", ->>>>>>> main + "stdout_hash": "846df6768a9ca3285224ba51c9878f9b58410032bc7639bfac6f2f77", "stderr": "asr-test_pow-3f5d550.stderr", "stderr_hash": "3d950301563cce75654f28bf41f6f53428ed1f5ae997774345f374a3", "returncode": 0 diff --git a/tests/reference/pass_loop_vectorise-vec_01-be9985e.json b/tests/reference/pass_loop_vectorise-vec_01-be9985e.json index 6a3d154840..feee511bed 100644 --- a/tests/reference/pass_loop_vectorise-vec_01-be9985e.json +++ b/tests/reference/pass_loop_vectorise-vec_01-be9985e.json @@ -6,11 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "pass_loop_vectorise-vec_01-be9985e.stdout", -<<<<<<< HEAD - "stdout_hash": "73d9a6eb51b0def6a0d326f60d1e1c6abfd7e10378774af952fe07e4", -======= - "stdout_hash": "8dd25f677c4ef92c4aaa4879cee7c623d6ccfcb8fb24dc46bc5c8e48", ->>>>>>> main + "stdout_hash": "6092fa29591f5c33a140f20bb8d05b6d7217674f2c5a54ca2f69ac25", "stderr": null, "stderr_hash": null, "returncode": 0 From 0c7e8b5d920fe96f988659e38dca16c9776d1f23 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Wed, 18 Oct 2023 20:25:41 +0530 Subject: [PATCH 28/30] dev: sync libasr with lfortran --- src/libasr/asr_utils.cpp | 16 ++-- src/libasr/asr_utils.h | 26 ++++++- src/libasr/asr_verify.cpp | 81 +++++++++------------ src/libasr/pass/instantiate_template.cpp | 8 +- src/libasr/pass/pass_utils.h | 79 +++++++++++--------- src/lpython/semantics/python_ast_to_asr.cpp | 28 +++---- 6 files changed, 124 insertions(+), 114 deletions(-) diff --git a/src/libasr/asr_utils.cpp b/src/libasr/asr_utils.cpp index 89191f2904..cb02443863 100644 --- a/src/libasr/asr_utils.cpp +++ b/src/libasr/asr_utils.cpp @@ -616,8 +616,8 @@ bool use_overloaded(ASR::expr_t* left, ASR::expr_t* right, } } } - if (ASRUtils::symbol_parent_symtab(a_name) == curr_scope->parent) { - current_function_dependencies.push_back(al, s2c(al, matched_func_name)); + if (ASRUtils::symbol_parent_symtab(a_name)->get_counter() != curr_scope->get_counter()) { + ADD_ASR_DEPENDENCIES_WITH_NAME(curr_scope, a_name, current_function_dependencies, s2c(al, matched_func_name)); } ASRUtils::insert_module_dependency(a_name, al, current_module_dependencies); ASRUtils::set_absent_optional_arguments_to_null(a_args, func, al); @@ -701,8 +701,8 @@ void process_overloaded_unary_minus_function(ASR::symbol_t* proc, ASR::expr_t* o } } } - if (ASRUtils::symbol_parent_symtab(a_name) == curr_scope->parent) { - current_function_dependencies.push_back(al, s2c(al, matched_func_name)); + if (ASRUtils::symbol_parent_symtab(a_name)->get_counter() != curr_scope->get_counter()) { + ADD_ASR_DEPENDENCIES_WITH_NAME(curr_scope, a_name, current_function_dependencies, s2c(al, matched_func_name)); } ASRUtils::insert_module_dependency(a_name, al, current_module_dependencies); ASRUtils::set_absent_optional_arguments_to_null(a_args, func, al); @@ -874,8 +874,8 @@ void process_overloaded_assignment_function(ASR::symbol_t* proc, ASR::expr_t* ta if( a_name == nullptr ) { err("Unable to resolve matched subroutine for assignment overloading, " + matched_subrout_name, loc); } - if (ASRUtils::symbol_parent_symtab(a_name) == curr_scope->parent) { - current_function_dependencies.push_back(al, s2c(al, matched_subrout_name)); + if (ASRUtils::symbol_parent_symtab(a_name)->get_counter() != curr_scope->get_counter()) { + ADD_ASR_DEPENDENCIES_WITH_NAME(curr_scope, a_name, current_function_dependencies, s2c(al, matched_subrout_name)); } ASRUtils::insert_module_dependency(a_name, al, current_module_dependencies); ASRUtils::set_absent_optional_arguments_to_null(a_args, subrout, al); @@ -1016,8 +1016,8 @@ bool use_overloaded(ASR::expr_t* left, ASR::expr_t* right, } else { return_type = ASRUtils::expr_type(func->m_return_var); } - if (ASRUtils::symbol_parent_symtab(a_name) == curr_scope->parent) { - current_function_dependencies.push_back(al, s2c(al, matched_func_name)); + if (ASRUtils::symbol_parent_symtab(a_name)->get_counter() != curr_scope->get_counter()) { + ADD_ASR_DEPENDENCIES_WITH_NAME(curr_scope, a_name, current_function_dependencies, s2c(al, matched_func_name)); } ASRUtils::insert_module_dependency(a_name, al, current_module_dependencies); ASRUtils::set_absent_optional_arguments_to_null(a_args, func, al); diff --git a/src/libasr/asr_utils.h b/src/libasr/asr_utils.h index 7c8423db57..06e42e7fd9 100644 --- a/src/libasr/asr_utils.h +++ b/src/libasr/asr_utils.h @@ -14,6 +14,28 @@ #include +#define ADD_ASR_DEPENDENCIES(current_scope, final_sym, current_function_dependencies) ASR::symbol_t* asr_owner_sym = nullptr; \ + if(current_scope->asr_owner && ASR::is_a(*current_scope->asr_owner) ) { \ + asr_owner_sym = ASR::down_cast(current_scope->asr_owner); \ + } \ + SymbolTable* temp_scope = current_scope; \ + if (asr_owner_sym && temp_scope->get_counter() != ASRUtils::symbol_parent_symtab(final_sym)->get_counter() && \ + !ASR::is_a(*asr_owner_sym) && !ASR::is_a(*final_sym) && \ + !ASR::is_a(*final_sym)) { \ + current_function_dependencies.push_back(al, ASRUtils::symbol_name(final_sym)); \ + } \ + +#define ADD_ASR_DEPENDENCIES_WITH_NAME(current_scope, final_sym, current_function_dependencies, dep_name) ASR::symbol_t* asr_owner_sym = nullptr; \ + if(current_scope->asr_owner && ASR::is_a(*current_scope->asr_owner) ) { \ + asr_owner_sym = ASR::down_cast(current_scope->asr_owner); \ + } \ + SymbolTable* temp_scope = current_scope; \ + if (asr_owner_sym && temp_scope->get_counter() != ASRUtils::symbol_parent_symtab(final_sym)->get_counter() && \ + !ASR::is_a(*asr_owner_sym) && !ASR::is_a(*final_sym) && \ + !ASR::is_a(*final_sym)) { \ + current_function_dependencies.push_back(al, dep_name); \ + } \ + namespace LCompilers { namespace ASRUtils { @@ -3200,8 +3222,8 @@ class ReplaceArgVisitor: public ASR::BaseExprReplacer { default: break; } - if (ASRUtils::symbol_parent_symtab(new_es) == current_scope->parent) { - current_function_dependencies.push_back(al, ASRUtils::symbol_name(new_es)); + if (ASRUtils::symbol_parent_symtab(new_es)->get_counter() != current_scope->get_counter()) { + ADD_ASR_DEPENDENCIES(current_scope, new_es, current_function_dependencies); } ASRUtils::insert_module_dependency(new_es, al, current_module_dependencies); x->m_name = new_es; diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index 317563d661..785478765d 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -441,30 +441,18 @@ class VerifyVisitor : public BaseWalkVisitor verify_unique_dependencies(x.m_dependencies, x.n_dependencies, x.m_name, x.base.base.loc); - // Get the x parent symtab. - SymbolTable *sym = x.m_symtab->parent; + // Get the x symtab. + SymbolTable *x_symtab = x.m_symtab; // Dependencies of the function should be from function's parent symbol table. for( size_t i = 0; i < x.n_dependencies; i++ ) { std::string found_dep = x.m_dependencies[i]; // Get the symbol of the found_dep. - ASR::symbol_t* dep_sym = sym->resolve_symbol(found_dep); + ASR::symbol_t* dep_sym = x_symtab->resolve_symbol(found_dep); - if (dep_sym == nullptr) { - // The symbol `dep_sym` is not in the parent symbol table. For - // now we allow one exception: it can also be in the global scope. - ASR::symbol_t* dep_sym_global = sym->resolve_symbol(found_dep); - - if (dep_sym_global != nullptr && ASRUtils::symbol_parent_symtab(dep_sym_global)->parent == nullptr) { - // This is a global scope symbol, which we allow for now - } else { - // This is not a global scope symbol and not in the parent symbol table, - // Return an error: - require(dep_sym != nullptr, + require(dep_sym != nullptr, "Dependency " + found_dep + " is inside symbol table " + std::string(x.m_name)); - } - } } // Check if there are unnecessary dependencies @@ -896,21 +884,23 @@ class VerifyVisitor : public BaseWalkVisitor } } - if ((current_symtab->get_counter() != ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() && !ASR::is_a(*x.m_name)) || - (ASRUtils::symbol_parent_symtab(x.m_name)->parent == nullptr)) { - ASR::symbol_t* asr_owner_sym = nullptr; - if( ASR::is_a(*current_symtab->asr_owner) ) { - asr_owner_sym = ASR::down_cast(current_symtab->asr_owner); - } + ASR::symbol_t* asr_owner_sym = nullptr; + if(current_symtab->asr_owner && ASR::is_a(*current_symtab->asr_owner) ) { + asr_owner_sym = ASR::down_cast(current_symtab->asr_owner); + } - // check if asr owner is associate block. - if( asr_owner_sym && (ASR::is_a(*asr_owner_sym) || - ASR::is_a(*asr_owner_sym)) ) { - if (ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() != current_symtab->parent->get_counter()) { - function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); - } - } else { - function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); + SymbolTable* temp_scope = current_symtab; + + if (temp_scope->get_counter() != ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() && + !ASR::is_a(*asr_owner_sym) && !ASR::is_a(*x.m_name) && + !ASR::is_a(*x.m_name)) { + function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); + } + + if( ASR::is_a(*x.m_name) ) { + ASR::ExternalSymbol_t* x_m_name = ASR::down_cast(x.m_name); + if( x_m_name->m_external && ASR::is_a(*ASRUtils::get_asr_owner(x_m_name->m_external)) ) { + module_dependencies.push_back(std::string(x_m_name->m_module_name)); } } @@ -1039,22 +1029,23 @@ class VerifyVisitor : public BaseWalkVisitor void visit_FunctionCall(const FunctionCall_t &x) { require(x.m_name, "FunctionCall::m_name must be present"); - // Check x.m_name is from parent sym tab. - if (ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() != current_symtab->get_counter() || - ASRUtils::symbol_parent_symtab(x.m_name)->parent == nullptr) { - ASR::symbol_t* asr_owner_sym = nullptr; - if( ASR::is_a(*current_symtab->asr_owner) ) { - asr_owner_sym = ASR::down_cast(current_symtab->asr_owner); - } + ASR::symbol_t* asr_owner_sym = nullptr; + if(current_symtab->asr_owner && ASR::is_a(*current_symtab->asr_owner) ) { + asr_owner_sym = ASR::down_cast(current_symtab->asr_owner); + } - // check if asr owner is associate block. - if( asr_owner_sym && (ASR::is_a(*asr_owner_sym) || - ASR::is_a(*asr_owner_sym)) ) { - if (ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() != current_symtab->parent->get_counter()) { - function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); - } - } else { - function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); + SymbolTable* temp_scope = current_symtab; + + if (asr_owner_sym && temp_scope->get_counter() != ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() && + !ASR::is_a(*asr_owner_sym) && !ASR::is_a(*x.m_name) && + !ASR::is_a(*x.m_name)) { + function_dependencies.push_back(std::string(ASRUtils::symbol_name(x.m_name))); + } + + if( ASR::is_a(*x.m_name) ) { + ASR::ExternalSymbol_t* x_m_name = ASR::down_cast(x.m_name); + if( x_m_name->m_external && ASR::is_a(*ASRUtils::get_asr_owner(x_m_name->m_external)) ) { + module_dependencies.push_back(std::string(x_m_name->m_module_name)); } } diff --git a/src/libasr/pass/instantiate_template.cpp b/src/libasr/pass/instantiate_template.cpp index 3c17db5682..14144170c3 100644 --- a/src/libasr/pass/instantiate_template.cpp +++ b/src/libasr/pass/instantiate_template.cpp @@ -428,8 +428,8 @@ class SymbolInstantiator : public ASR::BaseExprStmtDuplicatorparent) { - dependencies.push_back(al, ASRUtils::symbol_name(name)); + if (ASRUtils::symbol_parent_symtab(name)->get_counter() != current_scope->get_counter()) { + ADD_ASR_DEPENDENCIES(current_scope, name, dependencies); } return ASRUtils::make_FunctionCall_t_util(al, x->base.base.loc, name, x->m_original_name, args.p, args.size(), type, value, dt); @@ -472,8 +472,8 @@ class SymbolInstantiator : public ASR::BaseExprStmtDuplicatorparent) { - dependencies.push_back(al, ASRUtils::symbol_name(name)); + if (ASRUtils::symbol_parent_symtab(name)->get_counter() != current_scope->get_counter()) { + ADD_ASR_DEPENDENCIES(current_scope, name, dependencies); } return ASRUtils::make_SubroutineCall_t_util(al, x->base.base.loc, name /* change this */, x->m_original_name, args.p, args.size(), dt, nullptr, false); diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index 9b6920837d..dddd00b3b7 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -333,13 +333,17 @@ namespace LCompilers { void visit_FunctionCall(const ASR::FunctionCall_t& x) { if (fill_function_dependencies) { - if (ASR::is_a(*x.m_name)) { - ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); - if (!ASRUtils::is_present_in_current_scope(external_symbol, current_scope)) { - function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); - } - } else if (ASR::is_a(*x.m_name)) { - process_dependency(x.m_name, function_dependencies, current_scope); + ASR::symbol_t* asr_owner_sym = nullptr; + if (current_scope->asr_owner && ASR::is_a(*current_scope->asr_owner)) { + asr_owner_sym = ASR::down_cast(current_scope->asr_owner); + } + + SymbolTable* temp_scope = current_scope; + + if (asr_owner_sym && temp_scope->get_counter() != ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() && + !ASR::is_a(*asr_owner_sym) && !ASR::is_a(*x.m_name) && + !ASR::is_a(*x.m_name)) { + function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } } @@ -355,13 +359,17 @@ namespace LCompilers { void visit_SubroutineCall(const ASR::SubroutineCall_t& x) { if (fill_function_dependencies) { - if (ASR::is_a(*x.m_name)) { - ASR::ExternalSymbol_t* external_symbol = ASR::down_cast(x.m_name); - if (!ASRUtils::is_present_in_current_scope(external_symbol, current_scope)) { - function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); - } - } else if (ASR::is_a(*x.m_name)) { - process_dependency(x.m_name, function_dependencies, current_scope); + ASR::symbol_t* asr_owner_sym = nullptr; + if (current_scope->asr_owner && ASR::is_a(*current_scope->asr_owner)) { + asr_owner_sym = ASR::down_cast(current_scope->asr_owner); + } + + SymbolTable* temp_scope = current_scope; + + if (asr_owner_sym && temp_scope->get_counter() != ASRUtils::symbol_parent_symtab(x.m_name)->get_counter() && + !ASR::is_a(*asr_owner_sym) && !ASR::is_a(*x.m_name) && + !ASR::is_a(*x.m_name)) { + function_dependencies.push_back(al, ASRUtils::symbol_name(x.m_name)); } } @@ -382,30 +390,29 @@ namespace LCompilers { } } - void process_dependency(const ASR::symbol_t *x, SetChar& function_dependencies, SymbolTable* current_scope) { - if (ASRUtils::symbol_symtab(x) != nullptr && - ASRUtils::symbol_parent_symtab(x)->get_counter() != - current_scope->get_counter()) { - - ASR::Function_t *f = ASR::down_cast2(current_scope->asr_owner); - - // Check is x.m_name is not an argument. - bool is_arg = false; - - for (size_t i=0; in_args; i++) { - ASR::Var_t *arg = ASR::down_cast(f->m_args[i]); - - if (arg->m_v == x) { - is_arg = true; - break; - } - } - - if (!is_arg) { - function_dependencies.push_back(al, ASRUtils::symbol_name(x)); - } + void visit_AssociateBlock(const ASR::AssociateBlock_t& x) { + SymbolTable *parent_symtab = current_scope; + current_scope = x.m_symtab; + for (auto &a : x.m_symtab->get_scope()) { + this->visit_symbol(*a.second); } + for (size_t i=0; iget_scope()) { + this->visit_symbol(*a.second); + } + for (size_t i=0; i { visit_expr_list_with_cast(func->m_args, func->n_args, args_new, args, !ASRUtils::is_intrinsic_function2(func)); - // Check if it is inside the parent symbol scope. - if(ASRUtils::symbol_parent_symtab(stemp) == func->m_symtab->parent) { - dependencies.push_back(al, ASRUtils::symbol_name(stemp)); - } else { - // Check if it is not an Intrinsic Function. - if( !ASRUtils::is_intrinsic_function2(func) ) { - // Check if it is an External Symbol. - if( ASR::is_a(*stemp) ) { - ASR::ExternalSymbol_t* es = ASR::down_cast(stemp); - // Only add dependency if both belong to same parent symbol table. - if(ASRUtils::symbol_parent_symtab(es->m_external) == func->m_symtab->parent) { - dependencies.push_back(al, ASRUtils::symbol_name(stemp)); - } - } - } + if (ASRUtils::symbol_parent_symtab(stemp)->get_counter() != current_scope->get_counter()) { + ADD_ASR_DEPENDENCIES(current_scope, stemp, dependencies); } + return ASRUtils::make_FunctionCall_t_util(al, loc, stemp, s_generic, args_new.p, args_new.size(), a_type, value, nullptr); @@ -1350,9 +1338,10 @@ class CommonVisitor : public AST::BaseVisitor { args_new.reserve(al, func->n_args); visit_expr_list_with_cast(func->m_args, func->n_args, args_new, args); - if(ASRUtils::symbol_parent_symtab(stemp)->get_counter() != current_scope->get_counter()) { - dependencies.push_back(al, ASRUtils::symbol_name(stemp)); + if (ASRUtils::symbol_parent_symtab(stemp)->get_counter() != current_scope->get_counter()) { + ADD_ASR_DEPENDENCIES(current_scope, stemp, dependencies); } + return ASRUtils::make_SubroutineCall_t_util(al, loc, stemp, s_generic, args_new.p, args_new.size(), nullptr, nullptr, false); } @@ -1614,8 +1603,9 @@ class CommonVisitor : public AST::BaseVisitor { target_scope, target_scope, new_f, f); } dependencies.erase(s2c(al, func_name)); - if(ASRUtils::symbol_parent_symtab(sym) == current_scope->parent) { - dependencies.push_back(al, s2c(al, new_func_name)); + + if (ASRUtils::symbol_parent_symtab(sym)->get_counter() != current_scope->get_counter()) { + ADD_ASR_DEPENDENCIES_WITH_NAME(current_scope, sym, dependencies, s2c(al, new_func_name)); } return t; } From 1801bb53d70f8733290e28db0f552f2d42a3b05a Mon Sep 17 00:00:00 2001 From: arteevraina Date: Wed, 18 Oct 2023 22:17:03 +0530 Subject: [PATCH 29/30] tests: update references --- .../reference/asr-array_01_decl-39cf894.json | 10 ++++---- .../reference/asr-array_02_decl-e8f6874.json | 10 ++++---- tests/reference/asr-arrays_01-a617b64.json | 2 +- tests/reference/asr-arrays_01-a617b64.stderr | 25 ++++++------------- tests/reference/asr-arrays_02-da94458.json | 2 +- tests/reference/asr-arrays_02-da94458.stderr | 22 ++++------------ tests/reference/asr-arrays_03-de2e952.json | 2 +- tests/reference/asr-arrays_03-de2e952.stderr | 20 +++------------ tests/reference/asr-arrays_04-880407c.json | 2 +- tests/reference/asr-arrays_04-880407c.stderr | 20 +++------------ tests/reference/asr-arrays_05-ec8fbd5.json | 2 +- tests/reference/asr-arrays_05-ec8fbd5.stderr | 20 +++------------ tests/reference/asr-arrays_06-fbb09a3.json | 2 +- tests/reference/asr-arrays_06-fbb09a3.stderr | 20 +++------------ tests/reference/asr-arrays_07-de430fd.json | 2 +- tests/reference/asr-arrays_07-de430fd.stderr | 20 +++------------ tests/reference/asr-arrays_08-ba317a3.json | 2 +- tests/reference/asr-arrays_08-ba317a3.stderr | 20 +++------------ tests/reference/asr-arrays_09-50ee586.json | 2 +- tests/reference/asr-arrays_09-50ee586.stderr | 20 +++------------ tests/reference/asr-arrays_10-bc82d75.json | 2 +- tests/reference/asr-arrays_10-bc82d75.stderr | 20 +++------------ tests/reference/asr-arrays_11-fc505b4.json | 2 +- tests/reference/asr-arrays_11-fc505b4.stderr | 20 +++------------ tests/reference/asr-arrays_12-63d6f25.json | 2 +- tests/reference/asr-arrays_12-63d6f25.stderr | 20 +++------------ tests/reference/asr-arrays_13-b5fcc7e.json | 2 +- tests/reference/asr-arrays_13-b5fcc7e.stderr | 20 +++------------ tests/reference/asr-arrays_14-78be00e.json | 2 +- tests/reference/asr-arrays_14-78be00e.stderr | 20 +++------------ tests/reference/asr-bindc_02-bc1a7ea.json | 10 ++++---- tests/reference/asr-bindc_03-95dbba7.json | 2 +- tests/reference/asr-bindc_03-95dbba7.stderr | 20 +++------------ tests/reference/asr-bindc_04-06bd800.json | 2 +- tests/reference/asr-bindc_04-06bd800.stderr | 22 ++++------------ tests/reference/asr-cast-435c233.json | 10 ++++---- tests/reference/asr-complex1-f26c460.json | 10 ++++---- tests/reference/asr-constants1-5828e8a.json | 10 ++++---- tests/reference/asr-elemental_01-b58df26.json | 10 ++++---- .../reference/asr-elemental_01-b58df26.stdout | 24 ------------------ tests/reference/asr-expr10-efcbb1b.json | 10 ++++---- tests/reference/asr-expr13-81bdb5a.json | 10 ++++---- tests/reference/asr-expr7-480ba2f.json | 8 +++--- tests/reference/asr-expr7-480ba2f.stderr | 14 +++++------ tests/reference/asr-expr8-6beda60.json | 10 ++++---- tests/reference/asr-expr_05-3a37324.json | 10 ++++---- tests/reference/asr-expr_05-3a37324.stdout | 7 ------ .../asr-generics_array_01-682b1b2.json | 10 ++++---- .../asr-generics_array_02-22c8dc1.json | 10 ++++---- .../asr-generics_array_03-fb3706c.json | 10 ++++---- .../asr-kwargs_02_error-7c91f8f.json | 2 +- .../asr-kwargs_02_error-7c91f8f.stderr | 16 ++++-------- tests/reference/asr-string_02-499c9ff.json | 2 +- tests/reference/asr-string_02-499c9ff.stderr | 10 ++------ tests/reference/asr-structs_05-fa98307.json | 10 ++++---- tests/reference/asr-test_assign8-4b26e63.json | 2 +- .../reference/asr-test_assign8-4b26e63.stderr | 14 +++-------- tests/reference/asr-test_binop3-a67201d.json | 2 +- .../reference/asr-test_binop3-a67201d.stderr | 10 ++------ .../asr-test_bool_binop-f856ef0.json | 10 ++++---- .../asr-test_builtin_bin-52ba9fa.json | 10 ++++---- .../asr-test_builtin_bool-330223a.json | 10 ++++---- .../asr-test_builtin_hex-64bd268.json | 10 ++++---- .../asr-test_builtin_oct-20b9066.json | 10 ++++---- .../asr-test_builtin_pow-f02fcda.json | 8 +++--- .../asr-test_builtin_pow-f02fcda.stderr | 10 ++------ .../asr-test_builtin_round-7417a21.json | 10 ++++---- .../asr-test_complex_01-a6def58.json | 10 ++++---- .../asr-test_complex_02-782ba2d.json | 10 ++++---- tests/reference/asr-test_dict13-683b290.json | 2 +- .../reference/asr-test_dict13-683b290.stderr | 12 +++------ tests/reference/asr-test_max_min-3c2fc51.json | 10 ++++---- .../reference/asr-test_numpy_03-e600a49.json | 10 ++++---- .../asr-test_numpy_03-e600a49.stdout | 8 ------ .../reference/asr-test_numpy_04-ecbb614.json | 10 ++++---- tests/reference/asr-test_pow-3f5d550.json | 8 +++--- tests/reference/asr-test_pow-3f5d550.stderr | 10 ++------ tests/reference/asr-test_pow1-581ef42.json | 2 +- tests/reference/asr-test_pow1-581ef42.stderr | 14 +++++------ tests/reference/asr-test_pow2-0dcbd7d.json | 2 +- tests/reference/asr-test_pow2-0dcbd7d.stderr | 14 +++++------ tests/reference/asr-test_pow3-79749ed.json | 2 +- tests/reference/asr-test_pow3-79749ed.stderr | 14 +++++------ tests/reference/asr-test_pow4-ef60978.json | 2 +- tests/reference/asr-test_pow4-ef60978.stderr | 14 +++++------ .../asr-test_zero_division-3dd84e8.json | 2 +- .../asr-test_zero_division-3dd84e8.stderr | 4 +-- .../asr-test_zero_division2-d84989f.json | 2 +- .../asr-test_zero_division2-d84989f.stderr | 4 +-- tests/reference/asr-vec_01-66ac423.json | 10 ++++---- tests/reference/c-expr7-bb2692a.json | 8 +++--- tests/reference/c-expr7-bb2692a.stderr | 14 +++++------ tests/reference/cpp-expr15-1661c0d.json | 10 ++++---- tests/reference/cpp-expr7-529bd53.json | 8 +++--- tests/reference/cpp-expr7-529bd53.stderr | 14 +++++------ tests/reference/cpp-expr8-704cece.json | 10 ++++---- .../cpp-test_builtin_pow-56b3f92.json | 8 +++--- .../cpp-test_builtin_pow-56b3f92.stderr | 10 ++------ .../pass_loop_vectorise-vec_01-be9985e.json | 10 ++++---- 99 files changed, 346 insertions(+), 622 deletions(-) diff --git a/tests/reference/asr-array_01_decl-39cf894.json b/tests/reference/asr-array_01_decl-39cf894.json index b23bdaa272..0564dfcb89 100644 --- a/tests/reference/asr-array_01_decl-39cf894.json +++ b/tests/reference/asr-array_01_decl-39cf894.json @@ -5,9 +5,9 @@ "infile_hash": "3dff59bab7475d254ce0470065c11e797e52a5b2a3d7546acc0e6705", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-array_01_decl-39cf894.stderr", - "stderr_hash": "5155e10cd4958bdda66178e2ed1b6faed6f415ff1cf3ff78e45f9cbb", - "returncode": 2 + "stdout": "asr-array_01_decl-39cf894.stdout", + "stdout_hash": "1faebd012adf52a67e912023e64747cd86287bca16bcd3551011da5a", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-array_02_decl-e8f6874.json b/tests/reference/asr-array_02_decl-e8f6874.json index f59af233fa..f3ec725f06 100644 --- a/tests/reference/asr-array_02_decl-e8f6874.json +++ b/tests/reference/asr-array_02_decl-e8f6874.json @@ -5,9 +5,9 @@ "infile_hash": "9a398864499c7a3b4e2a480faf3a5dccaa65f9771a8de27f55f11ca4", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-array_02_decl-e8f6874.stderr", - "stderr_hash": "b9fd331511456947bef74d5df2f292244e7fa1861ab43918a6e02acd", - "returncode": 2 + "stdout": "asr-array_02_decl-e8f6874.stdout", + "stdout_hash": "87598ba9c49806e4e943c164621a63720d3ff12ad599f3dd0eabe85a", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_01-a617b64.json b/tests/reference/asr-arrays_01-a617b64.json index ca8f874250..45a1b7310d 100644 --- a/tests/reference/asr-arrays_01-a617b64.json +++ b/tests/reference/asr-arrays_01-a617b64.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_01-a617b64.stderr", - "stderr_hash": "ddb2640e06012a8ab9efe1bc1dbe130321fb96721ce3fd749813c988", + "stderr_hash": "b8317c7306f747ceefa8557c06f2a0b4a8a4bd7ae805bb494fca6ef2", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_01-a617b64.stderr b/tests/reference/asr-arrays_01-a617b64.stderr index e712ee9cf1..4fa39a8c3c 100644 --- a/tests/reference/asr-arrays_01-a617b64.stderr +++ b/tests/reference/asr-arrays_01-a617b64.stderr @@ -1,17 +1,8 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_01.py:2:1 - | -2 | from numpy import empty, int8 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: Type mismatch in procedure call; the types must be compatible + --> tests/errors/arrays_01.py:15:9 + | +15 | [i8(214), i8(157), i8(3), i8(146)]) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch (passed argument type is list[i8] but required type is i8[4]) + | + 9 | a : i8[4] = empty(4, dtype=int8) + | ^^^^^ type mismatch (passed argument type is list[i8] but required type is i8[4]) diff --git a/tests/reference/asr-arrays_02-da94458.json b/tests/reference/asr-arrays_02-da94458.json index 2dfc6c7f7c..37de52ba40 100644 --- a/tests/reference/asr-arrays_02-da94458.json +++ b/tests/reference/asr-arrays_02-da94458.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_02-da94458.stderr", - "stderr_hash": "b7b907310495016dfb487fccb13739865174dda44541ade08931bae9", + "stderr_hash": "dc0e5be7cd6de7395421aedf1ce11977206f3e35bb7cba271aed8992", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_02-da94458.stderr b/tests/reference/asr-arrays_02-da94458.stderr index 5229403208..295e0c9b28 100644 --- a/tests/reference/asr-arrays_02-da94458.stderr +++ b/tests/reference/asr-arrays_02-da94458.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_02.py:2:1 - | -2 | from numpy import (empty, int8) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() + --> tests/errors/arrays_02.py:28:8 + | +28 | assert r1.a == t1.a + | ^^^^^^^^^^^^ diff --git a/tests/reference/asr-arrays_03-de2e952.json b/tests/reference/asr-arrays_03-de2e952.json index 77b002c31e..1583b11b63 100644 --- a/tests/reference/asr-arrays_03-de2e952.json +++ b/tests/reference/asr-arrays_03-de2e952.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_03-de2e952.stderr", - "stderr_hash": "ddfa8ceea3cb39c9b59069d2a67d13c8752ec2511fc62c162e77b206", + "stderr_hash": "4c932f31bbb10c9ba8d8d75be226ba9c33553be3bcb367c8112e31af", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_03-de2e952.stderr b/tests/reference/asr-arrays_03-de2e952.stderr index 00df208054..1fb5635502 100644 --- a/tests/reference/asr-arrays_03-de2e952.stderr +++ b/tests/reference/asr-arrays_03-de2e952.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_03.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_03.py:6:5 | -2 | from numpy import empty, int16 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | x: i16[4] = empty([5], dtype=int16) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[4]' and 'i16[5]') diff --git a/tests/reference/asr-arrays_04-880407c.json b/tests/reference/asr-arrays_04-880407c.json index 69bda74cc5..1c5077a22c 100644 --- a/tests/reference/asr-arrays_04-880407c.json +++ b/tests/reference/asr-arrays_04-880407c.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_04-880407c.stderr", - "stderr_hash": "ee2a3d13e91567e2924e0154d6c09db79923debe4c2733b246964808", + "stderr_hash": "10ef155b0236096d5de8157e38b3989d99343b016a8153b68a36aa54", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_04-880407c.stderr b/tests/reference/asr-arrays_04-880407c.stderr index 692cb026bf..5cb27a1cb7 100644 --- a/tests/reference/asr-arrays_04-880407c.stderr +++ b/tests/reference/asr-arrays_04-880407c.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_04.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_04.py:6:5 | -2 | from numpy import empty, int32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | x: i16[5] = empty([5], dtype=int32) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5]' and 'i32[5]') diff --git a/tests/reference/asr-arrays_05-ec8fbd5.json b/tests/reference/asr-arrays_05-ec8fbd5.json index 8ff8c5a20d..a4302b38e0 100644 --- a/tests/reference/asr-arrays_05-ec8fbd5.json +++ b/tests/reference/asr-arrays_05-ec8fbd5.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_05-ec8fbd5.stderr", - "stderr_hash": "066b86f582348bb519b6a39a7e7421ac5a666b29d9ef96d753be0207", + "stderr_hash": "4e5d42a186b8d82b484ec66ccc5a3b90da7e4be8a32bac26ea906198", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_05-ec8fbd5.stderr b/tests/reference/asr-arrays_05-ec8fbd5.stderr index ee5cc62302..165aee29a8 100644 --- a/tests/reference/asr-arrays_05-ec8fbd5.stderr +++ b/tests/reference/asr-arrays_05-ec8fbd5.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_05.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_05.py:6:5 | -2 | from numpy import empty, int16 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | x: i16[5, 4] = empty([5, 3], dtype=int16) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5,4]' and 'i16[5,3]') diff --git a/tests/reference/asr-arrays_06-fbb09a3.json b/tests/reference/asr-arrays_06-fbb09a3.json index 8c473166fc..863eeebf1e 100644 --- a/tests/reference/asr-arrays_06-fbb09a3.json +++ b/tests/reference/asr-arrays_06-fbb09a3.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_06-fbb09a3.stderr", - "stderr_hash": "529c8dc2333a83b0b67feb5db104ea294258fdcac341dad9e314cfee", + "stderr_hash": "1fa3f5061a72f03c0678806c0460b9ec5caf01cbbd2f07a606f1057e", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_06-fbb09a3.stderr b/tests/reference/asr-arrays_06-fbb09a3.stderr index 8d8b27a690..9bbcde8ee8 100644 --- a/tests/reference/asr-arrays_06-fbb09a3.stderr +++ b/tests/reference/asr-arrays_06-fbb09a3.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_06.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_06.py:6:5 | -2 | from numpy import empty, int32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | x: i16[5, 4] = empty([5, 4], dtype=int32) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5,4]' and 'i32[5,4]') diff --git a/tests/reference/asr-arrays_07-de430fd.json b/tests/reference/asr-arrays_07-de430fd.json index a3c5bfc680..19a44750cc 100644 --- a/tests/reference/asr-arrays_07-de430fd.json +++ b/tests/reference/asr-arrays_07-de430fd.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_07-de430fd.stderr", - "stderr_hash": "78a96ca7fbcae19b8cdaa9f9a2d18de003d7569070edb855bd07bff6", + "stderr_hash": "7fadea44b4ad8f383e0cadbd27a53eb3ab75f0edef98d27639527723", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_07-de430fd.stderr b/tests/reference/asr-arrays_07-de430fd.stderr index f5f3ff9143..7624d1fe92 100644 --- a/tests/reference/asr-arrays_07-de430fd.stderr +++ b/tests/reference/asr-arrays_07-de430fd.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_07.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_07.py:6:5 | -2 | from numpy import empty, complex64 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | x: f32[5, 4] = empty([5, 4], dtype=complex64) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('f32[5,4]' and 'c32[5,4]') diff --git a/tests/reference/asr-arrays_08-ba317a3.json b/tests/reference/asr-arrays_08-ba317a3.json index 068d21e7d1..56982fe195 100644 --- a/tests/reference/asr-arrays_08-ba317a3.json +++ b/tests/reference/asr-arrays_08-ba317a3.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_08-ba317a3.stderr", - "stderr_hash": "2c0dffd29d0f996f1403e49241e6fe1cfbf7df0ce479e4434c3a7c6a", + "stderr_hash": "bedb87b219b7c49a18cced170e4ffcac780d242f70c3ae8bbfb27a26", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_08-ba317a3.stderr b/tests/reference/asr-arrays_08-ba317a3.stderr index d5aad26c5b..e8f8eb441e 100644 --- a/tests/reference/asr-arrays_08-ba317a3.stderr +++ b/tests/reference/asr-arrays_08-ba317a3.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_08.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_08.py:9:5 | -2 | from numpy import empty, int64 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +9 | x: i64[p, q, r] = empty([q, p, r], dtype=int64) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i64[100,120,200]' and 'i64[120,100,200]') diff --git a/tests/reference/asr-arrays_09-50ee586.json b/tests/reference/asr-arrays_09-50ee586.json index 1180b9b694..fa9b9de0df 100644 --- a/tests/reference/asr-arrays_09-50ee586.json +++ b/tests/reference/asr-arrays_09-50ee586.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_09-50ee586.stderr", - "stderr_hash": "31ae490ebcebebc570a4846a32f1723dd3e9861f47c6805e9cc5e9b4", + "stderr_hash": "30bfc87e70c4b4688cf7162eec34dce8e52c959539d20ad8b79cf845", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_09-50ee586.stderr b/tests/reference/asr-arrays_09-50ee586.stderr index efb877322b..58147a840d 100644 --- a/tests/reference/asr-arrays_09-50ee586.stderr +++ b/tests/reference/asr-arrays_09-50ee586.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_09.py:2:1 +semantic error: Only those local variables which can be reduced to compile time constant should be used in dimensions of an array. + --> tests/errors/arrays_09.py:9:12 | -2 | from numpy import empty, int64 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +9 | x: i64[p, q, r] = empty([q, p, r], dtype=int64) + | ^ diff --git a/tests/reference/asr-arrays_10-bc82d75.json b/tests/reference/asr-arrays_10-bc82d75.json index 8125d1c0f8..4599fd95cf 100644 --- a/tests/reference/asr-arrays_10-bc82d75.json +++ b/tests/reference/asr-arrays_10-bc82d75.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_10-bc82d75.stderr", - "stderr_hash": "12434839db5b4ef953cdf8002472348be5b31f95ed106f68c6646523", + "stderr_hash": "59e8cc91d7dae61bf60ec4d9cd23d62cdcb162e553bd64a3995fad19", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_10-bc82d75.stderr b/tests/reference/asr-arrays_10-bc82d75.stderr index af28c4fcb3..7935120aa7 100644 --- a/tests/reference/asr-arrays_10-bc82d75.stderr +++ b/tests/reference/asr-arrays_10-bc82d75.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_10.py:2:1 +semantic error: Only those local variables which can be reduced to compile time constant should be used in dimensions of an array. + --> tests/errors/arrays_10.py:9:36 | -2 | from numpy import empty, int64 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +9 | x: i64[100, 120, 200] = empty([q, p, r], dtype=int64) + | ^ diff --git a/tests/reference/asr-arrays_11-fc505b4.json b/tests/reference/asr-arrays_11-fc505b4.json index 31cf31d842..22700cace0 100644 --- a/tests/reference/asr-arrays_11-fc505b4.json +++ b/tests/reference/asr-arrays_11-fc505b4.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_11-fc505b4.stderr", - "stderr_hash": "f5a3fde8bbd2fd083b1f1d2148c92c3ae71ef4aaaed74e725061cb94", + "stderr_hash": "ef5e89392b20ad345ba9bcf862ab71b19e56c85d9838db742be117a1", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_11-fc505b4.stderr b/tests/reference/asr-arrays_11-fc505b4.stderr index 1fd700c7b4..09cb02b625 100644 --- a/tests/reference/asr-arrays_11-fc505b4.stderr +++ b/tests/reference/asr-arrays_11-fc505b4.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_11.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_11.py:5:1 | -2 | from numpy import empty, int16 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +5 | x: i16[4] = empty([5], dtype=int16) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[4]' and 'i16[5]') diff --git a/tests/reference/asr-arrays_12-63d6f25.json b/tests/reference/asr-arrays_12-63d6f25.json index 4f456715f5..a032a5fad1 100644 --- a/tests/reference/asr-arrays_12-63d6f25.json +++ b/tests/reference/asr-arrays_12-63d6f25.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_12-63d6f25.stderr", - "stderr_hash": "28d115256d1f8e36fdce5f2192e17e06c4b6daaa2166ece7bed3947c", + "stderr_hash": "b6fa626301868bd5cbbef6d914f5b4f38b1d896b951753122969e74a", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_12-63d6f25.stderr b/tests/reference/asr-arrays_12-63d6f25.stderr index 4dc8ec210c..8000ae521d 100644 --- a/tests/reference/asr-arrays_12-63d6f25.stderr +++ b/tests/reference/asr-arrays_12-63d6f25.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_12.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_12.py:5:1 | -2 | from numpy import empty, int32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +5 | x: i16[5] = empty([5], dtype=int32) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5]' and 'i32[5]') diff --git a/tests/reference/asr-arrays_13-b5fcc7e.json b/tests/reference/asr-arrays_13-b5fcc7e.json index d2c834ff6a..3a17697702 100644 --- a/tests/reference/asr-arrays_13-b5fcc7e.json +++ b/tests/reference/asr-arrays_13-b5fcc7e.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_13-b5fcc7e.stderr", - "stderr_hash": "684ced8828de6debbd6d46dd706f9bbb993e8c85b22b656583c3a077", + "stderr_hash": "6bde2f7fc14d5a461a58d694e44e19dd79ef5bee47c88b4022daf5d6", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_13-b5fcc7e.stderr b/tests/reference/asr-arrays_13-b5fcc7e.stderr index 1533a34f7a..14f0dbe414 100644 --- a/tests/reference/asr-arrays_13-b5fcc7e.stderr +++ b/tests/reference/asr-arrays_13-b5fcc7e.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_13.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_13.py:7:5 | -2 | from numpy import empty, int16 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +7 | x: i16[4] = empty(5, dtype=int16) + | ^ ^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[4]' and 'i16[5]') diff --git a/tests/reference/asr-arrays_14-78be00e.json b/tests/reference/asr-arrays_14-78be00e.json index 9a235f1984..b41704e4d0 100644 --- a/tests/reference/asr-arrays_14-78be00e.json +++ b/tests/reference/asr-arrays_14-78be00e.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_14-78be00e.stderr", - "stderr_hash": "3539282cce2d83675ca57e47d093800765d28c5b74a04eb46457f715", + "stderr_hash": "267aea8e48708230a9b2bc61c37c849a0b75cb45294ca25ee11fe632", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_14-78be00e.stderr b/tests/reference/asr-arrays_14-78be00e.stderr index 14bdfe6421..ed7f661811 100644 --- a/tests/reference/asr-arrays_14-78be00e.stderr +++ b/tests/reference/asr-arrays_14-78be00e.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_14.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_14.py:7:5 | -2 | from numpy import empty, int16 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +7 | x: i16[4] = empty((5), dtype=int16) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[4]' and 'i16[5]') diff --git a/tests/reference/asr-bindc_02-bc1a7ea.json b/tests/reference/asr-bindc_02-bc1a7ea.json index b8abd26275..d55a06707c 100644 --- a/tests/reference/asr-bindc_02-bc1a7ea.json +++ b/tests/reference/asr-bindc_02-bc1a7ea.json @@ -5,9 +5,9 @@ "infile_hash": "a29f0f269c494419077ca8725e7c2d2dc7a5b4964d5c909347f1caa4", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-bindc_02-bc1a7ea.stderr", - "stderr_hash": "f35a1e2233396c7620436bb77c9e617e33e60fb9c92da2552280ed2c", - "returncode": 2 + "stdout": "asr-bindc_02-bc1a7ea.stdout", + "stdout_hash": "7e3c2190d73d9f8614974002f89340fbd517b3e44d0a5ee3941e08de", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-bindc_03-95dbba7.json b/tests/reference/asr-bindc_03-95dbba7.json index fa55114a3e..7ea004cc34 100644 --- a/tests/reference/asr-bindc_03-95dbba7.json +++ b/tests/reference/asr-bindc_03-95dbba7.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-bindc_03-95dbba7.stderr", - "stderr_hash": "9225af71c044978cc3832abb4a60a5d13f6d143a8c4dc219e930eab9", + "stderr_hash": "371c3fc384c0e72448648d5a3734a373fe96ba258b261f0695ccb518", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-bindc_03-95dbba7.stderr b/tests/reference/asr-bindc_03-95dbba7.stderr index 98e9a26f07..ae2b810b6c 100644 --- a/tests/reference/asr-bindc_03-95dbba7.stderr +++ b/tests/reference/asr-bindc_03-95dbba7.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/bindc_03.py:3:1 +semantic error: Target type specified in c_p_pointer must have deferred shape. + --> tests/errors/bindc_03.py:6:26 | -3 | from numpy import array - | ^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | A: Pointer[i16[:]] = c_p_pointer(b, i16[n * k], array([k * n])) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/reference/asr-bindc_04-06bd800.json b/tests/reference/asr-bindc_04-06bd800.json index a19d71962d..4772e98aa9 100644 --- a/tests/reference/asr-bindc_04-06bd800.json +++ b/tests/reference/asr-bindc_04-06bd800.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-bindc_04-06bd800.stderr", - "stderr_hash": "6aa8aa05ae2628d04b771044165e1c9078ba3c5ae211906def3ff0be", + "stderr_hash": "20c105d0189cd06a197a6b1dda073a58f5c8ee0104230cf187960c46", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-bindc_04-06bd800.stderr b/tests/reference/asr-bindc_04-06bd800.stderr index 704b35ab47..1a05ab5e55 100644 --- a/tests/reference/asr-bindc_04-06bd800.stderr +++ b/tests/reference/asr-bindc_04-06bd800.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/bindc_04.py:2:1 - | -2 | from numpy import empty, int16 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: Only those local variables which can be reduced to compile time constant should be used in dimensions of an array. + --> tests/errors/bindc_04.py:20:12 + | +20 | C: i16[nk] = empty(nk, dtype=int16) + | ^^ diff --git a/tests/reference/asr-cast-435c233.json b/tests/reference/asr-cast-435c233.json index 8614194075..e72cca7a11 100644 --- a/tests/reference/asr-cast-435c233.json +++ b/tests/reference/asr-cast-435c233.json @@ -5,9 +5,9 @@ "infile_hash": "6e4219b25f4aa2035b57c9658dbb133f2dff55db0d9c128b19214f62", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-cast-435c233.stderr", - "stderr_hash": "94b3ddb64aab37aa358cd260252df21698826606401d00e07c873603", - "returncode": 2 + "stdout": "asr-cast-435c233.stdout", + "stdout_hash": "7706a2702e0eaf323a113deb332715ff149affcc6f3e3558160ad4c7", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-complex1-f26c460.json b/tests/reference/asr-complex1-f26c460.json index 2eb40d0cd8..8b7e35bd00 100644 --- a/tests/reference/asr-complex1-f26c460.json +++ b/tests/reference/asr-complex1-f26c460.json @@ -5,9 +5,9 @@ "infile_hash": "60b45de7b88ec768d70a3122b36545e9604a86504ed6e5d9d813c719", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-complex1-f26c460.stderr", - "stderr_hash": "850f4cbe87b0a7ae8138fbfb71f94b82843abf09e50752159f900292", - "returncode": 2 + "stdout": "asr-complex1-f26c460.stdout", + "stdout_hash": "b4eca9e059405fb89e3d02ac8e4e22fa3e40efdac4f91c696afdebaa", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-constants1-5828e8a.json b/tests/reference/asr-constants1-5828e8a.json index 5abb75edfe..428f30e56d 100644 --- a/tests/reference/asr-constants1-5828e8a.json +++ b/tests/reference/asr-constants1-5828e8a.json @@ -5,9 +5,9 @@ "infile_hash": "5dca391c30a1477fb903e17c1d47dad3b9b816088384ba61ff372db1", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-constants1-5828e8a.stderr", - "stderr_hash": "ebf1574a4c5a5194ffa967d7e3a768aad6fe823a3eae7b48b0ea46f2", - "returncode": 2 + "stdout": "asr-constants1-5828e8a.stdout", + "stdout_hash": "2ac6a82a6b1fd28fc9f55f49af5ab2019948547619b8ef7a60c3bf70", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-elemental_01-b58df26.json b/tests/reference/asr-elemental_01-b58df26.json index 91ad0f8c5d..d3528e63c2 100644 --- a/tests/reference/asr-elemental_01-b58df26.json +++ b/tests/reference/asr-elemental_01-b58df26.json @@ -5,9 +5,9 @@ "infile_hash": "1d1eb8ce26df5817c1e474e4f69b0b96e53df362a31f1b722efaadf0", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-elemental_01-b58df26.stderr", - "stderr_hash": "cd10f41e485a55b944782ec55b168ba07907570bc9c92869d02f705e", - "returncode": 2 + "stdout": "asr-elemental_01-b58df26.stdout", + "stdout_hash": "6555dc71f6d6443676246f628d0c911e5bb0759afc1f67ae8e815e09", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-elemental_01-b58df26.stdout b/tests/reference/asr-elemental_01-b58df26.stdout index 3b912fd87c..084fe11044 100644 --- a/tests/reference/asr-elemental_01-b58df26.stdout +++ b/tests/reference/asr-elemental_01-b58df26.stdout @@ -2361,17 +2361,10 @@ [] .false. ) -<<<<<<< HEAD [] - [(Var 212 array) - (Var 212 result) - (Var 212 size)] -======= - [sin@__lpython_overloaded_1__sin] [(Var 209 array) (Var 209 result) (Var 209 size)] ->>>>>>> main [(= (Var 209 eps) (Cast @@ -3200,19 +3193,11 @@ [] .false. ) -<<<<<<< HEAD [] - [(Var 214 array) - (Var 214 result) - (Var 214 size1) - (Var 214 size2)] -======= - [cos@__lpython_overloaded_0__cos] [(Var 211 array) (Var 211 result) (Var 211 size1) (Var 211 size2)] ->>>>>>> main [(= (Var 211 eps) (RealConstant @@ -3583,21 +3568,12 @@ [] .false. ) -<<<<<<< HEAD [] - [(Var 213 array) - (Var 213 result) - (Var 213 size1) - (Var 213 size2) - (Var 213 size3)] -======= - [sin@__lpython_overloaded_0__sin] [(Var 210 array) (Var 210 result) (Var 210 size1) (Var 210 size2) (Var 210 size3)] ->>>>>>> main [(= (Var 210 eps) (RealConstant diff --git a/tests/reference/asr-expr10-efcbb1b.json b/tests/reference/asr-expr10-efcbb1b.json index 62a4828972..d156bee312 100644 --- a/tests/reference/asr-expr10-efcbb1b.json +++ b/tests/reference/asr-expr10-efcbb1b.json @@ -5,9 +5,9 @@ "infile_hash": "7eb1dd6ad27fcc091e18c4447fb7a56c659565bbdb57f567b68f4a58", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-expr10-efcbb1b.stderr", - "stderr_hash": "32b0a64a7d73278b8d793b2991e8550827128c4df7fd48bc82d20311", - "returncode": 2 + "stdout": "asr-expr10-efcbb1b.stdout", + "stdout_hash": "c5ed7ae39603a5bd33ffdf01f65d4b6a4c9b2048ae68b147a8822a61", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-expr13-81bdb5a.json b/tests/reference/asr-expr13-81bdb5a.json index 739e799cd5..fd380688ce 100644 --- a/tests/reference/asr-expr13-81bdb5a.json +++ b/tests/reference/asr-expr13-81bdb5a.json @@ -5,9 +5,9 @@ "infile_hash": "fae72924c71183c45d328b379dfa81aa4971b5e1a9ea668db546078f", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-expr13-81bdb5a.stderr", - "stderr_hash": "0699d234dbdd85c470cbdb001dd7447b9419e96ce3aafa7642a9edc3", - "returncode": 2 + "stdout": "asr-expr13-81bdb5a.stdout", + "stdout_hash": "52fbcfcf2affa3cdaedd2221c4cc552b0d6f9656dccb3c40f294d5d4", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-expr7-480ba2f.json b/tests/reference/asr-expr7-480ba2f.json index 7d13377709..f19c904af9 100644 --- a/tests/reference/asr-expr7-480ba2f.json +++ b/tests/reference/asr-expr7-480ba2f.json @@ -5,9 +5,9 @@ "infile_hash": "7ef1383d1798621ee35adb7296bfe66dcdc08a21ac8dc86b9ce42878", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, + "stdout": "asr-expr7-480ba2f.stdout", + "stdout_hash": "80d1d0b83919300e41f4130929820d827d95ec1e37c11b61e1118c60", "stderr": "asr-expr7-480ba2f.stderr", - "stderr_hash": "4d93a6488abad28138f2713c11c47b2f02e87e530f1bf6e2e38e88bf", - "returncode": 2 + "stderr_hash": "6e9790ac88db1a9ead8f64a91ba8a6605de67167037908a74b77be0c", + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-expr7-480ba2f.stderr b/tests/reference/asr-expr7-480ba2f.stderr index d1b84ec030..a4fad29beb 100644 --- a/tests/reference/asr-expr7-480ba2f.stderr +++ b/tests/reference/asr-expr7-480ba2f.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/expr7.py:4:13 | 4 | a = i32(pow(2, 2)) - | ^^^^^^^^^ imported here + | ^^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +style suggestion: Could have used '**' instead of 'pow' + --> tests/expr7.py:8:15 + | +8 | res = i32(pow(a, b)) + | ^^^^^^^^^ '**' could be used instead diff --git a/tests/reference/asr-expr8-6beda60.json b/tests/reference/asr-expr8-6beda60.json index 7801dbd06d..9fb8c510ab 100644 --- a/tests/reference/asr-expr8-6beda60.json +++ b/tests/reference/asr-expr8-6beda60.json @@ -5,9 +5,9 @@ "infile_hash": "6966e19cf343700cbc11ec1bf6a495e43c685c6fa065669875aa61ce", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-expr8-6beda60.stderr", - "stderr_hash": "94db9a9e4af4eda9b774a82fb4f55aa3413db82da5be0160bde72352", - "returncode": 2 + "stdout": "asr-expr8-6beda60.stdout", + "stdout_hash": "b79ac7dd790182c720f71316cdcedbd0a6b3b1bd56ef5cb800fab8dd", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-expr_05-3a37324.json b/tests/reference/asr-expr_05-3a37324.json index e366badac0..4d95dcbd3c 100644 --- a/tests/reference/asr-expr_05-3a37324.json +++ b/tests/reference/asr-expr_05-3a37324.json @@ -5,9 +5,9 @@ "infile_hash": "cc922bec30fac0a8eb10efd99f72234aa5638b3c9cd92c68044c69ea", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-expr_05-3a37324.stderr", - "stderr_hash": "ec167ccde0bcc3539244c081abc86809b00655e649722a96f082d86b", - "returncode": 2 + "stdout": "asr-expr_05-3a37324.stdout", + "stdout_hash": "f51978a9f1e69972ca659433fe4f3f262bd8ea9765963728e3cf48b9", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-expr_05-3a37324.stdout b/tests/reference/asr-expr_05-3a37324.stdout index 078c903743..0c0e85b5f6 100644 --- a/tests/reference/asr-expr_05-3a37324.stdout +++ b/tests/reference/asr-expr_05-3a37324.stdout @@ -287,14 +287,7 @@ .false. ) [test_multiply -<<<<<<< HEAD test_mod] -======= - test_mod - _mod@__lpython_overloaded_2___mod - _mod@__lpython_overloaded_9___mod - _mod@__lpython_overloaded_4___mod] ->>>>>>> main [] [(= (Var 5 a) diff --git a/tests/reference/asr-generics_array_01-682b1b2.json b/tests/reference/asr-generics_array_01-682b1b2.json index 2da3a03bc0..efa930e81c 100644 --- a/tests/reference/asr-generics_array_01-682b1b2.json +++ b/tests/reference/asr-generics_array_01-682b1b2.json @@ -5,9 +5,9 @@ "infile_hash": "6e943dd0e26ab4d1ffb6ed6909a365b4135b6f5295957b2478cfb479", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-generics_array_01-682b1b2.stderr", - "stderr_hash": "07809b586ef30105878e1532461ac0ad302722003d44d2ae71b4cb7a", - "returncode": 2 + "stdout": "asr-generics_array_01-682b1b2.stdout", + "stdout_hash": "26960a50793c22f54a971672fbaa347e2834a0b2e9aaa13859e131e6", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-generics_array_02-22c8dc1.json b/tests/reference/asr-generics_array_02-22c8dc1.json index b869c0013e..9e9cf5cb45 100644 --- a/tests/reference/asr-generics_array_02-22c8dc1.json +++ b/tests/reference/asr-generics_array_02-22c8dc1.json @@ -5,9 +5,9 @@ "infile_hash": "54b5f1d4b8fc7543c292ac0d6f7a39939816a657173937fa7dc02f07", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-generics_array_02-22c8dc1.stderr", - "stderr_hash": "ab2cfe57f54581e673039761ff5a42919ddb665b1083a36342cbe7e1", - "returncode": 2 + "stdout": "asr-generics_array_02-22c8dc1.stdout", + "stdout_hash": "05e8e68d9ca98af04976c1736a2e6d4f95ead76b455155bc2039e27b", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-generics_array_03-fb3706c.json b/tests/reference/asr-generics_array_03-fb3706c.json index 128484c0ae..42281b80cf 100644 --- a/tests/reference/asr-generics_array_03-fb3706c.json +++ b/tests/reference/asr-generics_array_03-fb3706c.json @@ -5,9 +5,9 @@ "infile_hash": "5b415ae64a527ce3ab3b6878141238e227258bc2b2b8c37af6d23ff5", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-generics_array_03-fb3706c.stderr", - "stderr_hash": "7d636bddcd76853697423eb36c823f5898b8274b21a62a55f764b63b", - "returncode": 2 + "stdout": "asr-generics_array_03-fb3706c.stdout", + "stdout_hash": "29edb81f1143c127bbaf73d021f150777d79eb15de3259272c9073e1", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-kwargs_02_error-7c91f8f.json b/tests/reference/asr-kwargs_02_error-7c91f8f.json index bac9cf8743..228d941171 100644 --- a/tests/reference/asr-kwargs_02_error-7c91f8f.json +++ b/tests/reference/asr-kwargs_02_error-7c91f8f.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-kwargs_02_error-7c91f8f.stderr", - "stderr_hash": "d7988f2217bab99a6e782c6cb63f3d2f505b5d59c8976e4e4fab5042", + "stderr_hash": "120e6e6838e464af15ff96aa99dcdda21923a3bb5f0c3d6d7cc8348b", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-kwargs_02_error-7c91f8f.stderr b/tests/reference/asr-kwargs_02_error-7c91f8f.stderr index 738691275d..9e13b4f43d 100644 --- a/tests/reference/asr-kwargs_02_error-7c91f8f.stderr +++ b/tests/reference/asr-kwargs_02_error-7c91f8f.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> tests/errors/kwargs_02_error.py:4:12 - | -4 | return complex(float(a), b) + c - | ^^^^^^^^^^^^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: func02() got multiple values for argument 'b' + --> tests/errors/kwargs_02_error.py:13:5 + | +13 | func02(arg3, arg4, c=arg5, b=arg4) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/reference/asr-string_02-499c9ff.json b/tests/reference/asr-string_02-499c9ff.json index 4eaad46910..ac33dbbf21 100644 --- a/tests/reference/asr-string_02-499c9ff.json +++ b/tests/reference/asr-string_02-499c9ff.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-string_02-499c9ff.stderr", - "stderr_hash": "85593e60baa6c6f930b7486a92e41fac9943108966abdacb7acb39ef", + "stderr_hash": "368ba74a1e0d6609f71e6f87f95bd0b6151420c81336e48a172cb613", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-string_02-499c9ff.stderr b/tests/reference/asr-string_02-499c9ff.stderr index 7ca613cb8c..196515476b 100644 --- a/tests/reference/asr-string_02-499c9ff.stderr +++ b/tests/reference/asr-string_02-499c9ff.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +semantic error: str.join() takes type list only --> tests/errors/string_02.py:6:15 | 6 | res:str = x.join(p) - | ^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ + | ^^^^^^^^^ diff --git a/tests/reference/asr-structs_05-fa98307.json b/tests/reference/asr-structs_05-fa98307.json index e493825921..bf28f2e2e6 100644 --- a/tests/reference/asr-structs_05-fa98307.json +++ b/tests/reference/asr-structs_05-fa98307.json @@ -5,9 +5,9 @@ "infile_hash": "ef1037b0936a63be679efd366920a94463900e80630a070ba440aa78", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-structs_05-fa98307.stderr", - "stderr_hash": "9425960bac284eae21adb4274aa833960c505abd6bd546f896da0216", - "returncode": 2 + "stdout": "asr-structs_05-fa98307.stdout", + "stdout_hash": "7a124c1e087e577bfdd50ef021f9265a5db6e1ec51713dd6f13711c7", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_assign8-4b26e63.json b/tests/reference/asr-test_assign8-4b26e63.json index 3b0ecbbcd1..fb449632d9 100644 --- a/tests/reference/asr-test_assign8-4b26e63.json +++ b/tests/reference/asr-test_assign8-4b26e63.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_assign8-4b26e63.stderr", - "stderr_hash": "900fcd6359806b1e7ab41b6c5c4eb252bdbab6e96404912b710a8682", + "stderr_hash": "c8ad8a6c89a23c0e2bd0cbaf7c9568625f093e526ff8ff26ae300e07", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_assign8-4b26e63.stderr b/tests/reference/asr-test_assign8-4b26e63.stderr index e320bd3600..dcb47d9356 100644 --- a/tests/reference/asr-test_assign8-4b26e63.stderr +++ b/tests/reference/asr-test_assign8-4b26e63.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> tests/errors/test_assign8.py:5:13 +semantic error: readonly attribute + --> tests/errors/test_assign8.py:6:5 | -5 | c = c32(complex(3, 4)) - | ^^^^^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | c.real = 5.0 + | ^^^^^^^^^^^^ diff --git a/tests/reference/asr-test_binop3-a67201d.json b/tests/reference/asr-test_binop3-a67201d.json index b93163a529..dc238a62cb 100644 --- a/tests/reference/asr-test_binop3-a67201d.json +++ b/tests/reference/asr-test_binop3-a67201d.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_binop3-a67201d.stderr", - "stderr_hash": "00ec81e32ad3b0d4145714c7224146e9af7fd913aa87aa633667f4f2", + "stderr_hash": "ff683b1bc0695903f2d2ea7bbd1963346fcb5f84bbfd10a4da0e27d7", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_binop3-a67201d.stderr b/tests/reference/asr-test_binop3-a67201d.stderr index ea6ee12b1c..84e374e2f5 100644 --- a/tests/reference/asr-test_binop3-a67201d.stderr +++ b/tests/reference/asr-test_binop3-a67201d.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +semantic error: Type mismatch in binary operator; the types must be compatible --> tests/errors/test_binop3.py:5:9 | 5 | y = complex(5)+100 - | ^^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ + | ^^^^^^^^^^ ^^^ type mismatch (c32 and i32) diff --git a/tests/reference/asr-test_bool_binop-f856ef0.json b/tests/reference/asr-test_bool_binop-f856ef0.json index 358216f8de..b74825e8d7 100644 --- a/tests/reference/asr-test_bool_binop-f856ef0.json +++ b/tests/reference/asr-test_bool_binop-f856ef0.json @@ -5,9 +5,9 @@ "infile_hash": "7c44fe2915b3871b3b85edf3ab129d87a75fa4b9acbb597ae801daf9", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_bool_binop-f856ef0.stderr", - "stderr_hash": "7e1f44ed79212fae132aca28b495a511f27ee327b9bf88b797502eff", - "returncode": 2 + "stdout": "asr-test_bool_binop-f856ef0.stdout", + "stdout_hash": "b2d6b1205576cabc7c44ae611eec55ba5af026dbd918972e05e8f7da", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_bin-52ba9fa.json b/tests/reference/asr-test_builtin_bin-52ba9fa.json index f617a29848..59395a4441 100644 --- a/tests/reference/asr-test_builtin_bin-52ba9fa.json +++ b/tests/reference/asr-test_builtin_bin-52ba9fa.json @@ -5,9 +5,9 @@ "infile_hash": "09e09eacf697c95f358b75f6491b766781bae9a5f856c2ad5848e824", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_builtin_bin-52ba9fa.stderr", - "stderr_hash": "f96ee9f35d47046bca3a9f0e40b965bf1b0e6654a0a4da0eb7a85e30", - "returncode": 2 + "stdout": "asr-test_builtin_bin-52ba9fa.stdout", + "stdout_hash": "5d3860eec54d8b3d02d591fac9218c8a82507da0fe5f1ab9a5001563", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_bool-330223a.json b/tests/reference/asr-test_builtin_bool-330223a.json index 91858355b1..4b46b88bb1 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.json +++ b/tests/reference/asr-test_builtin_bool-330223a.json @@ -5,9 +5,9 @@ "infile_hash": "3a740faba0e36b55c179ab0fa08486dc3080332e79c8e38b8f25b4a4", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_builtin_bool-330223a.stderr", - "stderr_hash": "5cf42029c7abd7dc2dedc535fff29c622c3871ec342b595c426b27f3", - "returncode": 2 + "stdout": "asr-test_builtin_bool-330223a.stdout", + "stdout_hash": "98f3a326f1d3e8ad110b1d3452036ecca9cd4b347d66d9d876029f92", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_hex-64bd268.json b/tests/reference/asr-test_builtin_hex-64bd268.json index 2779c11099..6873ad94c3 100644 --- a/tests/reference/asr-test_builtin_hex-64bd268.json +++ b/tests/reference/asr-test_builtin_hex-64bd268.json @@ -5,9 +5,9 @@ "infile_hash": "e639f0251477f50376536d317630e3c026354859576a5f1b7b10bd7d", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_builtin_hex-64bd268.stderr", - "stderr_hash": "22b2ae7d0d34d2406125547149511ab5990a5f2163c186c48c5c4f05", - "returncode": 2 + "stdout": "asr-test_builtin_hex-64bd268.stdout", + "stdout_hash": "68d17e2bc0d604fef0be0c0c170c4bf27b20195008467579affd682e", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_oct-20b9066.json b/tests/reference/asr-test_builtin_oct-20b9066.json index bb705fd111..a1fdae9477 100644 --- a/tests/reference/asr-test_builtin_oct-20b9066.json +++ b/tests/reference/asr-test_builtin_oct-20b9066.json @@ -5,9 +5,9 @@ "infile_hash": "c20249affa4787edf4ef56c881ebbcabdced311b5b908d9da6aceaeb", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_builtin_oct-20b9066.stderr", - "stderr_hash": "986b90db11399243e0e1a9788da3876cbd8d7eecd273e46bc9437243", - "returncode": 2 + "stdout": "asr-test_builtin_oct-20b9066.stdout", + "stdout_hash": "0c387ee657c68e4b0dfa88365ef68b8f5b41e86b46ba8c6c64bbc405", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.json b/tests/reference/asr-test_builtin_pow-f02fcda.json index 5bb87ef22b..a8047e7681 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.json +++ b/tests/reference/asr-test_builtin_pow-f02fcda.json @@ -5,9 +5,9 @@ "infile_hash": "b7d1d5e1592f5078961eb228c756e424d394f5f0383a1577f1cced1b", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, + "stdout": "asr-test_builtin_pow-f02fcda.stdout", + "stdout_hash": "c543a298dce8076489dd47f639245a3766604167d487d6371b87f30b", "stderr": "asr-test_builtin_pow-f02fcda.stderr", - "stderr_hash": "6935bb3dd01caf67154e6dee0bb6480b2d3ecb270bc5038444391acc", - "returncode": 2 + "stderr_hash": "859ce76c74748f2d32c7eab92cfbba789a78d4cbf5818646b99806ea", + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.stderr b/tests/reference/asr-test_builtin_pow-f02fcda.stderr index e2d434b6f1..5dbb75ad24 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.stderr +++ b/tests/reference/asr-test_builtin_pow-f02fcda.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/../integration_tests/test_builtin_pow.py:11:16 | 11 | assert i32(pow(a, b)) == 32 - | ^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ + | ^^^^^^^^^ '**' could be used instead diff --git a/tests/reference/asr-test_builtin_round-7417a21.json b/tests/reference/asr-test_builtin_round-7417a21.json index efcd6cc31e..e040546a97 100644 --- a/tests/reference/asr-test_builtin_round-7417a21.json +++ b/tests/reference/asr-test_builtin_round-7417a21.json @@ -5,9 +5,9 @@ "infile_hash": "a4ff4032a45ce084eb524069046afb6ec44f1b24a667c84c7605f2c7", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_builtin_round-7417a21.stderr", - "stderr_hash": "a58af3b9f4312b1036b728dc70928fe9c05f87d1b96d92b5c3da881f", - "returncode": 2 + "stdout": "asr-test_builtin_round-7417a21.stdout", + "stdout_hash": "daa107175f28069c0297bd7cc86b989667df02426dfecb6c114a46e0", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_complex_01-a6def58.json b/tests/reference/asr-test_complex_01-a6def58.json index 2a3e22a7fa..6c547762cf 100644 --- a/tests/reference/asr-test_complex_01-a6def58.json +++ b/tests/reference/asr-test_complex_01-a6def58.json @@ -5,9 +5,9 @@ "infile_hash": "e580480b37e5bbfcd01d5eb412375a8a3c1ef374b5fedfb661485763", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_complex_01-a6def58.stderr", - "stderr_hash": "5e372192068e09afc8e388039c24decbd5a11c27b4143b5643bebd10", - "returncode": 2 + "stdout": "asr-test_complex_01-a6def58.stdout", + "stdout_hash": "413be8dda53bafec80f0a34ea2c1cfbf54a68748cfc4c621a297f7e9", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_complex_02-782ba2d.json b/tests/reference/asr-test_complex_02-782ba2d.json index 3fa259e305..929d8dad68 100644 --- a/tests/reference/asr-test_complex_02-782ba2d.json +++ b/tests/reference/asr-test_complex_02-782ba2d.json @@ -5,9 +5,9 @@ "infile_hash": "e6ee66d952deccec11d316a09f1d5b4bb4916ceb56a41a11dee03ae9", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_complex_02-782ba2d.stderr", - "stderr_hash": "dc3a153532aa537903852b8334a63d785edb99a11aff4e951c28b5c6", - "returncode": 2 + "stdout": "asr-test_complex_02-782ba2d.stdout", + "stdout_hash": "a045cd28e792ea5970e5e9cd8d26f16bbe9116222e257c5891881bc4", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_dict13-683b290.json b/tests/reference/asr-test_dict13-683b290.json index 3f08b12f0a..982bd80540 100644 --- a/tests/reference/asr-test_dict13-683b290.json +++ b/tests/reference/asr-test_dict13-683b290.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_dict13-683b290.stderr", - "stderr_hash": "26039da2a42594ace7df2672a7bec3e88607caa7b45e35024b33df62", + "stderr_hash": "60bc3be332a1b638ade1cf40068ee4381ba4a79942a76c104c9cdebd", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_dict13-683b290.stderr b/tests/reference/asr-test_dict13-683b290.stderr index b22b070fa2..9dc7b6ef9c 100644 --- a/tests/reference/asr-test_dict13-683b290.stderr +++ b/tests/reference/asr-test_dict13-683b290.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> tests/errors/test_dict13.py:2:12 +semantic error: 'dict' key type cannot be float/complex because resolving collisions by exact comparison of float/complex values will result in unexpected behaviours. In addition fuzzy equality checks with a certain tolerance does not follow transitivity with float/complex values. + --> tests/errors/test_dict13.py:2:11 | 2 | print({complex(0.0, 1.0): 1.1}) # constant dict with complex value as key - | ^^^^^^^^^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/reference/asr-test_max_min-3c2fc51.json b/tests/reference/asr-test_max_min-3c2fc51.json index 7c51d764ca..3ee9415031 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.json +++ b/tests/reference/asr-test_max_min-3c2fc51.json @@ -5,9 +5,9 @@ "infile_hash": "1aba932852adf8cc5dbff4a6ff83aa5de030dba5a5721eeace90a5d4", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_max_min-3c2fc51.stderr", - "stderr_hash": "bc3642925ccc0f3f61e37e0bd20fc7100fddbfb37c06a3609ff78daf", - "returncode": 2 + "stdout": "asr-test_max_min-3c2fc51.stdout", + "stdout_hash": "96ed5fcfc8bdf6ce1767b4c129e97164760147f3dc1f9bcae482f1ac", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_numpy_03-e600a49.json b/tests/reference/asr-test_numpy_03-e600a49.json index 11537ffe29..7ed19ef723 100644 --- a/tests/reference/asr-test_numpy_03-e600a49.json +++ b/tests/reference/asr-test_numpy_03-e600a49.json @@ -5,9 +5,9 @@ "infile_hash": "5c3ea7436668441c056bd576ea77cdfb49e44a5f0e95088d0f62184e", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_numpy_03-e600a49.stderr", - "stderr_hash": "934ed2ca36b7a4e431b1e4fc8dbd37edd550f7dbb5d9dca7ed49ce61", - "returncode": 2 + "stdout": "asr-test_numpy_03-e600a49.stdout", + "stdout_hash": "670ab328536003e6558e9b2eb7cfa7e20faad72daed6ea34e201321d", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_numpy_03-e600a49.stdout b/tests/reference/asr-test_numpy_03-e600a49.stdout index 1ffac7a066..1563384e0f 100644 --- a/tests/reference/asr-test_numpy_03-e600a49.stdout +++ b/tests/reference/asr-test_numpy_03-e600a49.stdout @@ -282,11 +282,7 @@ .false. ) [] -<<<<<<< HEAD - [(Var 213 d)] -======= [(Var 210 d)] ->>>>>>> main [(= (Var 210 eps) (RealConstant @@ -990,11 +986,7 @@ .false. ) [] -<<<<<<< HEAD - [(Var 212 a)] -======= [(Var 209 a)] ->>>>>>> main [(= (Var 209 eps) (RealConstant diff --git a/tests/reference/asr-test_numpy_04-ecbb614.json b/tests/reference/asr-test_numpy_04-ecbb614.json index a0e2dcecdb..d83ba73f29 100644 --- a/tests/reference/asr-test_numpy_04-ecbb614.json +++ b/tests/reference/asr-test_numpy_04-ecbb614.json @@ -5,9 +5,9 @@ "infile_hash": "0fbd0a4280966dd9a917d3a005887954325fb1ea5468fd28dcae930f", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_numpy_04-ecbb614.stderr", - "stderr_hash": "8f73238d34192a66d0659b3cc8e5f8a5339755da83a50790689cf53b", - "returncode": 2 + "stdout": "asr-test_numpy_04-ecbb614.stdout", + "stdout_hash": "4459d81753e360904daeb7fc1ea171c39abe1c8f06522bf0c1f4887f", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_pow-3f5d550.json b/tests/reference/asr-test_pow-3f5d550.json index 95344abe65..ab1c1bd421 100644 --- a/tests/reference/asr-test_pow-3f5d550.json +++ b/tests/reference/asr-test_pow-3f5d550.json @@ -5,9 +5,9 @@ "infile_hash": "073bf734150500a8b5e46940a9b0440e7e0fe30d0e2789ca049cef17", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, + "stdout": "asr-test_pow-3f5d550.stdout", + "stdout_hash": "7e194b32fd24e0d73584562429627d77c8aadddd1d3bfcebd0de49b4", "stderr": "asr-test_pow-3f5d550.stderr", - "stderr_hash": "13a950a0d1f29b9a7cf4484858b22246b086a24919ca22f6b1d410b3", - "returncode": 2 + "stderr_hash": "3d950301563cce75654f28bf41f6f53428ed1f5ae997774345f374a3", + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_pow-3f5d550.stderr b/tests/reference/asr-test_pow-3f5d550.stderr index c955d6b4bc..712d80384b 100644 --- a/tests/reference/asr-test_pow-3f5d550.stderr +++ b/tests/reference/asr-test_pow-3f5d550.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/errors/test_pow.py:2:11 | 2 | print(pow(2, 2)) - | ^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ + | ^^^^^^^^^ '**' could be used instead diff --git a/tests/reference/asr-test_pow1-581ef42.json b/tests/reference/asr-test_pow1-581ef42.json index 2ef657f3ac..a5584b1bc7 100644 --- a/tests/reference/asr-test_pow1-581ef42.json +++ b/tests/reference/asr-test_pow1-581ef42.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_pow1-581ef42.stderr", - "stderr_hash": "32fe0eecb3687de0e976228815c25c96f3dc3e8f6491adb21c105ee6", + "stderr_hash": "7f7cc07cf6f08f2d953d6e6c1f4892e6379faaf8aa668117234293d0", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_pow1-581ef42.stderr b/tests/reference/asr-test_pow1-581ef42.stderr index f1693701de..fa7160f584 100644 --- a/tests/reference/asr-test_pow1-581ef42.stderr +++ b/tests/reference/asr-test_pow1-581ef42.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/errors/test_pow1.py:4:11 | 4 | print(pow(x,3)) - | ^^^^^^^^ imported here + | ^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: Arguments do not match for any generic procedure, pow + --> tests/errors/test_pow1.py:4:11 + | +4 | print(pow(x,3)) + | ^^^^^^^^ diff --git a/tests/reference/asr-test_pow2-0dcbd7d.json b/tests/reference/asr-test_pow2-0dcbd7d.json index 129acc3859..083bc76b8d 100644 --- a/tests/reference/asr-test_pow2-0dcbd7d.json +++ b/tests/reference/asr-test_pow2-0dcbd7d.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_pow2-0dcbd7d.stderr", - "stderr_hash": "54113068b55d3eab93cd04927b2fbf6a384a4a0ed64f02aa6ea18f9b", + "stderr_hash": "1d1d3a4a308e068439ac40685fcad6f29750560722b910be3341ce3c", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_pow2-0dcbd7d.stderr b/tests/reference/asr-test_pow2-0dcbd7d.stderr index edc4007245..896faa98e5 100644 --- a/tests/reference/asr-test_pow2-0dcbd7d.stderr +++ b/tests/reference/asr-test_pow2-0dcbd7d.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/errors/test_pow2.py:12:11 | 12 | print(pow(a, b, c, d)) - | ^^^^^^^^^^^^^^^ imported here + | ^^^^^^^^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: Arguments do not match for any generic procedure, pow + --> tests/errors/test_pow2.py:12:11 + | +12 | print(pow(a, b, c, d)) + | ^^^^^^^^^^^^^^^ diff --git a/tests/reference/asr-test_pow3-79749ed.json b/tests/reference/asr-test_pow3-79749ed.json index 7c5d30d4da..cd0f9f0d33 100644 --- a/tests/reference/asr-test_pow3-79749ed.json +++ b/tests/reference/asr-test_pow3-79749ed.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_pow3-79749ed.stderr", - "stderr_hash": "199c8dc10f23e2053ec5498131683383bb4b20bf06b05bf1c5f7d747", + "stderr_hash": "4a6600740ad466d250f39b76130ab5ab796312b1ee89c2d72847500f", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_pow3-79749ed.stderr b/tests/reference/asr-test_pow3-79749ed.stderr index 3a157a0866..6456498803 100644 --- a/tests/reference/asr-test_pow3-79749ed.stderr +++ b/tests/reference/asr-test_pow3-79749ed.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/errors/test_pow3.py:8:11 | 8 | print(pow(x, a)) - | ^^^^^^^^^ imported here + | ^^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: Arguments do not match for any generic procedure, pow + --> tests/errors/test_pow3.py:8:11 + | +8 | print(pow(x, a)) + | ^^^^^^^^^ diff --git a/tests/reference/asr-test_pow4-ef60978.json b/tests/reference/asr-test_pow4-ef60978.json index 8cfd3c1460..2e98c401ce 100644 --- a/tests/reference/asr-test_pow4-ef60978.json +++ b/tests/reference/asr-test_pow4-ef60978.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_pow4-ef60978.stderr", - "stderr_hash": "e4796a76ca15b125485b820d259be4ce20ed67f403953372685b98d5", + "stderr_hash": "ddc8a81609479bf82d256c9cb8d4d54526bd6656632a0d1e2f1ada2c", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_pow4-ef60978.stderr b/tests/reference/asr-test_pow4-ef60978.stderr index 2dc752cd36..0663475b44 100644 --- a/tests/reference/asr-test_pow4-ef60978.stderr +++ b/tests/reference/asr-test_pow4-ef60978.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/errors/test_pow4.py:10:11 | 10 | print(pow(x, a, b)) - | ^^^^^^^^^^^^ imported here + | ^^^^^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: Arguments do not match for any generic procedure, pow + --> tests/errors/test_pow4.py:10:11 + | +10 | print(pow(x, a, b)) + | ^^^^^^^^^^^^ diff --git a/tests/reference/asr-test_zero_division-3dd84e8.json b/tests/reference/asr-test_zero_division-3dd84e8.json index 129e181bef..5c135e76d4 100644 --- a/tests/reference/asr-test_zero_division-3dd84e8.json +++ b/tests/reference/asr-test_zero_division-3dd84e8.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_zero_division-3dd84e8.stderr", - "stderr_hash": "9403e36c7ace95241bf1d59a108732b298fbee5425c44455fb81ac77", + "stderr_hash": "e1770a0ba87c5155926e3d6bb3bd67e14a5c040b7584c4cf114a41b2", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_zero_division-3dd84e8.stderr b/tests/reference/asr-test_zero_division-3dd84e8.stderr index 7403437c96..57611f2b32 100644 --- a/tests/reference/asr-test_zero_division-3dd84e8.stderr +++ b/tests/reference/asr-test_zero_division-3dd84e8.stderr @@ -1,5 +1,5 @@ -semantic error: integer division by zero is not allowed +semantic error: Division by 0 is not allowed --> tests/errors/test_zero_division.py:4:16 | 4 | print(i // 0) - | ^ integer division by zero + | ^ diff --git a/tests/reference/asr-test_zero_division2-d84989f.json b/tests/reference/asr-test_zero_division2-d84989f.json index b9a7de7d1e..f1fb7cbb0e 100644 --- a/tests/reference/asr-test_zero_division2-d84989f.json +++ b/tests/reference/asr-test_zero_division2-d84989f.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_zero_division2-d84989f.stderr", - "stderr_hash": "09fcb9f6244ddf2c2d14cd76ec91274cffd240e24e2b2f1c0697c8b5", + "stderr_hash": "d2bac61e7df0875a7c93edb706661c80154b7b4d05dbf26663c36176", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_zero_division2-d84989f.stderr b/tests/reference/asr-test_zero_division2-d84989f.stderr index 8dc523a2a5..438ee0b6d4 100644 --- a/tests/reference/asr-test_zero_division2-d84989f.stderr +++ b/tests/reference/asr-test_zero_division2-d84989f.stderr @@ -1,5 +1,5 @@ -semantic error: float floor division by zero is not allowed +semantic error: Division by 0 is not allowed --> tests/errors/test_zero_division2.py:4:16 | 4 | print(v // 0.0) - | ^^^ float floor division by zero + | ^^^ diff --git a/tests/reference/asr-vec_01-66ac423.json b/tests/reference/asr-vec_01-66ac423.json index abd51bc145..c127647b93 100644 --- a/tests/reference/asr-vec_01-66ac423.json +++ b/tests/reference/asr-vec_01-66ac423.json @@ -5,9 +5,9 @@ "infile_hash": "f85ca108780c53c54878d119822d56fb834cf4b5121511cbaca2c2fe", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-vec_01-66ac423.stderr", - "stderr_hash": "67b435304368f453ffeda263b2c1c1a591ce3e9a4100d21fbf1ec7a5", - "returncode": 2 + "stdout": "asr-vec_01-66ac423.stdout", + "stdout_hash": "84be4809b0edd01c29a2edddd0b356f186892eee7483820b8da22e24", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/c-expr7-bb2692a.json b/tests/reference/c-expr7-bb2692a.json index c0fcdfcb2c..84ee9e5ed5 100644 --- a/tests/reference/c-expr7-bb2692a.json +++ b/tests/reference/c-expr7-bb2692a.json @@ -5,9 +5,9 @@ "infile_hash": "7ef1383d1798621ee35adb7296bfe66dcdc08a21ac8dc86b9ce42878", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, + "stdout": "c-expr7-bb2692a.stdout", + "stdout_hash": "1d75b4cf61dcee73adafec2a5448c953bae5476aab2502115df2eecb", "stderr": "c-expr7-bb2692a.stderr", - "stderr_hash": "4d93a6488abad28138f2713c11c47b2f02e87e530f1bf6e2e38e88bf", - "returncode": 2 + "stderr_hash": "6e9790ac88db1a9ead8f64a91ba8a6605de67167037908a74b77be0c", + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/c-expr7-bb2692a.stderr b/tests/reference/c-expr7-bb2692a.stderr index d1b84ec030..a4fad29beb 100644 --- a/tests/reference/c-expr7-bb2692a.stderr +++ b/tests/reference/c-expr7-bb2692a.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/expr7.py:4:13 | 4 | a = i32(pow(2, 2)) - | ^^^^^^^^^ imported here + | ^^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +style suggestion: Could have used '**' instead of 'pow' + --> tests/expr7.py:8:15 + | +8 | res = i32(pow(a, b)) + | ^^^^^^^^^ '**' could be used instead diff --git a/tests/reference/cpp-expr15-1661c0d.json b/tests/reference/cpp-expr15-1661c0d.json index 812a9c4978..a75de781fb 100644 --- a/tests/reference/cpp-expr15-1661c0d.json +++ b/tests/reference/cpp-expr15-1661c0d.json @@ -5,9 +5,9 @@ "infile_hash": "f3fa7c8efa999392edc0a94ff9c7820ed0c3f1e849c77655151b8d72", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "cpp-expr15-1661c0d.stderr", - "stderr_hash": "abb193cadddd4745a52610eabc746e5facafefb220f85ba3310a7498", - "returncode": 2 + "stdout": "cpp-expr15-1661c0d.stdout", + "stdout_hash": "c6660bd5efa0a0602ea96a86d5c44220cb4390dea4eebf4cb16211bc", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/cpp-expr7-529bd53.json b/tests/reference/cpp-expr7-529bd53.json index be1428115b..9697eaa92d 100644 --- a/tests/reference/cpp-expr7-529bd53.json +++ b/tests/reference/cpp-expr7-529bd53.json @@ -5,9 +5,9 @@ "infile_hash": "7ef1383d1798621ee35adb7296bfe66dcdc08a21ac8dc86b9ce42878", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, + "stdout": "cpp-expr7-529bd53.stdout", + "stdout_hash": "8f72ce4b2d8f170884e171b1bdfa4a4ea07344825b6787d814a446cf", "stderr": "cpp-expr7-529bd53.stderr", - "stderr_hash": "4d93a6488abad28138f2713c11c47b2f02e87e530f1bf6e2e38e88bf", - "returncode": 2 + "stderr_hash": "6e9790ac88db1a9ead8f64a91ba8a6605de67167037908a74b77be0c", + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/cpp-expr7-529bd53.stderr b/tests/reference/cpp-expr7-529bd53.stderr index d1b84ec030..a4fad29beb 100644 --- a/tests/reference/cpp-expr7-529bd53.stderr +++ b/tests/reference/cpp-expr7-529bd53.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/expr7.py:4:13 | 4 | a = i32(pow(2, 2)) - | ^^^^^^^^^ imported here + | ^^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +style suggestion: Could have used '**' instead of 'pow' + --> tests/expr7.py:8:15 + | +8 | res = i32(pow(a, b)) + | ^^^^^^^^^ '**' could be used instead diff --git a/tests/reference/cpp-expr8-704cece.json b/tests/reference/cpp-expr8-704cece.json index 5478fb2f70..1fac6d1530 100644 --- a/tests/reference/cpp-expr8-704cece.json +++ b/tests/reference/cpp-expr8-704cece.json @@ -5,9 +5,9 @@ "infile_hash": "6966e19cf343700cbc11ec1bf6a495e43c685c6fa065669875aa61ce", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "cpp-expr8-704cece.stderr", - "stderr_hash": "94db9a9e4af4eda9b774a82fb4f55aa3413db82da5be0160bde72352", - "returncode": 2 + "stdout": "cpp-expr8-704cece.stdout", + "stdout_hash": "7ac638e8146f048bd5444436ee2b2ac4f85ffa7a1d791cf526adacb4", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/cpp-test_builtin_pow-56b3f92.json b/tests/reference/cpp-test_builtin_pow-56b3f92.json index 346ddf6b70..a18ad0aab9 100644 --- a/tests/reference/cpp-test_builtin_pow-56b3f92.json +++ b/tests/reference/cpp-test_builtin_pow-56b3f92.json @@ -5,9 +5,9 @@ "infile_hash": "b7d1d5e1592f5078961eb228c756e424d394f5f0383a1577f1cced1b", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, + "stdout": "cpp-test_builtin_pow-56b3f92.stdout", + "stdout_hash": "dec0af96e013cd38032672f4812f876e586bf697757278addd17b591", "stderr": "cpp-test_builtin_pow-56b3f92.stderr", - "stderr_hash": "6935bb3dd01caf67154e6dee0bb6480b2d3ecb270bc5038444391acc", - "returncode": 2 + "stderr_hash": "859ce76c74748f2d32c7eab92cfbba789a78d4cbf5818646b99806ea", + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/cpp-test_builtin_pow-56b3f92.stderr b/tests/reference/cpp-test_builtin_pow-56b3f92.stderr index e2d434b6f1..5dbb75ad24 100644 --- a/tests/reference/cpp-test_builtin_pow-56b3f92.stderr +++ b/tests/reference/cpp-test_builtin_pow-56b3f92.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/../integration_tests/test_builtin_pow.py:11:16 | 11 | assert i32(pow(a, b)) == 32 - | ^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ + | ^^^^^^^^^ '**' could be used instead diff --git a/tests/reference/pass_loop_vectorise-vec_01-be9985e.json b/tests/reference/pass_loop_vectorise-vec_01-be9985e.json index e023d7e0eb..ee10a1201a 100644 --- a/tests/reference/pass_loop_vectorise-vec_01-be9985e.json +++ b/tests/reference/pass_loop_vectorise-vec_01-be9985e.json @@ -5,9 +5,9 @@ "infile_hash": "f85ca108780c53c54878d119822d56fb834cf4b5121511cbaca2c2fe", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "pass_loop_vectorise-vec_01-be9985e.stderr", - "stderr_hash": "67b435304368f453ffeda263b2c1c1a591ce3e9a4100d21fbf1ec7a5", - "returncode": 2 + "stdout": "pass_loop_vectorise-vec_01-be9985e.stdout", + "stdout_hash": "00276d79d08a473e1e39d5a40747ec12d8111ae29d6ab0e90a19ca1f", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file From 895f411b3df7afb842f20216d3adab07e9a97b13 Mon Sep 17 00:00:00 2001 From: arteevraina Date: Tue, 24 Oct 2023 13:34:02 +0530 Subject: [PATCH 30/30] fix: set asr_owner when visiting For --- src/lpython/semantics/python_ast_to_asr.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index a827aa9173..f5ef757e4d 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -5482,6 +5482,7 @@ class BodyVisitor : public CommonVisitor { SymbolTable *parent_scope = current_scope; current_scope = al.make_new(parent_scope); + current_scope->asr_owner = parent_scope->asr_owner; transform_stmts(body, x.n_body, x.m_body); int32_t total_syms = current_scope->get_scope().size(); if( total_syms > 0 ) {