diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index 5ae34459ab..6ef74d6882 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -804,7 +804,7 @@ RUN(NAME test_statistics_01 LABELS cpython llvm llvm_jit NOFAST) # RUN(NAME test_statistics_02 LABELS cpython llvm llvm_jit NOFAST REQ_PY_VER 3.10) # RUN(NAME test_attributes LABELS cpython llvm llvm_jit) # RUN(NAME test_str_attributes LABELS cpython llvm llvm_jit c) -# RUN(NAME kwargs_01 LABELS cpython llvm llvm_jit NOFAST) # renable c # post sync +RUN(NAME kwargs_01 LABELS cpython llvm llvm_jit NOFAST) # renable c # post sync # RUN(NAME def_func_01 LABELS cpython llvm llvm_jit) # renable c # post sync RUN(NAME func_inline_01 LABELS llvm llvm_jit c wasm) diff --git a/libasr b/libasr index 1b68d26ffc..423e6afdd1 160000 --- a/libasr +++ b/libasr @@ -1 +1 @@ -Subproject commit 1b68d26ffc4224674fe2b1ea4c6aae401bea9032 +Subproject commit 423e6afdd1c95100e381c1842695af62c27c7537 diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index b724117f64..5c678c44d3 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -572,7 +572,7 @@ class CommonVisitor : public AST::BaseVisitor { } else { sym = es_s; } - return ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, sym)); + return ASRUtils::make_StructType_t_util(al, loc, sym); } default: { return return_type; @@ -841,7 +841,7 @@ class CommonVisitor : public AST::BaseVisitor { ASR::symbol_t *der_sym = ASRUtils::symbol_get_past_external(s); if( der_sym ) { if ( ASR::is_a(*der_sym) ) { - type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, s)); + type = ASRUtils::make_StructType_t_util(al, loc, s); type = ASRUtils::make_Array_t_util(al, loc, type, dims.p, dims.size(), abi, is_argument); } else if( ASR::is_a(*der_sym) ) { type = ASRUtils::TYPE(ASR::make_EnumType_t(al, loc, s)); @@ -1307,7 +1307,7 @@ class CommonVisitor : public AST::BaseVisitor { if ( n_kwargs>0 ) { throw SemanticError("Keyword args are not supported", loc); } - ASR::ttype_t* der_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, stemp)); + ASR::ttype_t* der_type = ASRUtils::make_StructType_t_util(al, loc, stemp); return ASR::make_StructConstructor_t(al, loc, stemp, args.p, args.size(), der_type, nullptr); } @@ -1342,7 +1342,7 @@ class CommonVisitor : public AST::BaseVisitor { for (size_t i = args.size(); i < st->n_members; i++) { args.push_back(al, st->m_initializers[i]); } - ASR::ttype_t* der_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, stemp)); + ASR::ttype_t* der_type = ASRUtils::make_StructType_t_util(al, loc, stemp); return ASR::make_StructConstructor_t(al, loc, stemp, args.p, args.size(), der_type, nullptr); } else if( ASR::is_a(*s) ) { Vec args_new; @@ -1955,7 +1955,7 @@ class CommonVisitor : public AST::BaseVisitor { " str annotation", loc); } //TODO: Change the returned type from Class to StructType - return ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, sym, false)); + return ASRUtils::make_StructType_t_util(al, loc, sym, false); } throw SemanticError("Only Name, Subscript, and Call supported for now in annotation of annotated assignment.", loc); @@ -3485,7 +3485,7 @@ class CommonVisitor : public AST::BaseVisitor { std::string self_name = x.m_args.m_args[0].m_arg; ASR::symbol_t* sym = current_scope->get_symbol(self_name); ASR::Variable_t* self_var = ASR::down_cast(sym); - self_var->m_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al,loc, class_sym)); + self_var->m_type = ASRUtils::make_StructType_t_util(al,loc, class_sym); current_scope = parent_scope; } @@ -5361,7 +5361,7 @@ class BodyVisitor : public CommonVisitor { first_arg.loc = loc; ASR::symbol_t* self_sym = current_scope->get_symbol("self"); first_arg.m_value = ASRUtils::EXPR(ASR::make_Var_t(al,loc,self_sym)); - ASR::ttype_t* target_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al,loc,parent_sym)); + ASR::ttype_t* target_type = ASRUtils::make_StructType_t_util(al,loc,parent_sym); cast_helper(target_type, first_arg.m_value, x.base.base.loc, true); Vec args_w_first; args_w_first.reserve(al,1); args_w_first.push_back(al, first_arg); @@ -6354,7 +6354,7 @@ class BodyVisitor : public CommonVisitor { s2c(al, struct_member_name), ASR::accessType::Public)); current_scope->add_symbol(import_name, import_struct_member); } - member_var_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, import_struct_member)); + member_var_type = ASRUtils::make_StructType_t_util(al, loc, import_struct_member); } } } @@ -6458,7 +6458,7 @@ class BodyVisitor : public CommonVisitor { " found in " + std::string(der_type->m_name), loc); } else if ( !member_found && der_type->m_parent ) { - ASR::ttype_t* parent_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc,der_type->m_parent)); + ASR::ttype_t* parent_type = ASRUtils::make_StructType_t_util(al, loc,der_type->m_parent); visit_AttributeUtil(parent_type,attr_char,t,loc); return; } @@ -6495,7 +6495,7 @@ class BodyVisitor : public CommonVisitor { s2c(al, struct_member_name), ASR::accessType::Public)); current_scope->add_symbol(import_name, import_struct_member); } - member_var_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, import_struct_member)); + member_var_type = ASRUtils::make_StructType_t_util(al, loc, import_struct_member); } } } diff --git a/tests/reference/llvm-bindc_01-c984f09.json b/tests/reference/llvm-bindc_01-c984f09.json index 97923094b0..56b2ddc7da 100644 --- a/tests/reference/llvm-bindc_01-c984f09.json +++ b/tests/reference/llvm-bindc_01-c984f09.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-bindc_01-c984f09.stdout", - "stdout_hash": "b59c35903bc9fa613e1e9642c20891d7893465f569262418763cc367", + "stdout_hash": "8e6909147fa7483f9dbcc5139bb36d53bdb17252c55669e8d75bef66", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-bindc_01-c984f09.stdout b/tests/reference/llvm-bindc_01-c984f09.stdout index 15b4a7bb7a..e2cf96c5de 100644 --- a/tests/reference/llvm-bindc_01-c984f09.stdout +++ b/tests/reference/llvm-bindc_01-c984f09.stdout @@ -1,8 +1,8 @@ ; ModuleID = 'LFortran' source_filename = "LFortran" -@queries = global void* null -@x = global i16* null +@__module___main___queries = global void* null +@__module___main___x = global i16* null @0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @serialization_info = private unnamed_addr constant [8 x i8] c"CPtr,I2\00", align 1 @1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 @@ -11,10 +11,10 @@ source_filename = "LFortran" define void @__module___main_____main__global_stmts() { .entry: - %0 = load void*, void** @queries, align 8 + %0 = load void*, void** @__module___main___queries, align 8 %1 = bitcast void* %0 to i16* - store i16* %1, i16** @x, align 8 - %2 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @serialization_info, i32 0, i32 0), i32 0, i32 0, void** @queries, i16** @x) + store i16* %1, i16** @__module___main___x, align 8 + %2 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @serialization_info, i32 0, i32 0), i32 0, i32 0, void** @__module___main___queries, i16** @__module___main___x) call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @1, i32 0, i32 0), i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0)) call void @__module___main___test_issue_1781() br label %return diff --git a/tests/reference/llvm-print_04-443a8d8.json b/tests/reference/llvm-print_04-443a8d8.json index 5503a2d3a5..1e4c3290b4 100644 --- a/tests/reference/llvm-print_04-443a8d8.json +++ b/tests/reference/llvm-print_04-443a8d8.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-print_04-443a8d8.stdout", - "stdout_hash": "a2870505fcc8307104191937696b63aca644e3513fa28d45a69648f0", + "stdout_hash": "6c1392ce3559ea53f3111fb9fb1686cdc78907114f6d2dae50e460fd", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-print_04-443a8d8.stdout b/tests/reference/llvm-print_04-443a8d8.stdout index e1fa2028ae..293c6322d0 100644 --- a/tests/reference/llvm-print_04-443a8d8.stdout +++ b/tests/reference/llvm-print_04-443a8d8.stdout @@ -1,10 +1,10 @@ ; ModuleID = 'LFortran' source_filename = "LFortran" -@u = global i64 -922337203685477580 -@x = global i32 -2147483648 -@y = global i16 -32768 -@z = global i8 -128 +@__module___main___u = global i64 -922337203685477580 +@__module___main___x = global i32 -2147483648 +@__module___main___y = global i16 -32768 +@__module___main___z = global i8 -128 @0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @serialization_info = private unnamed_addr constant [3 x i8] c"I8\00", align 1 @1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 @@ -20,13 +20,13 @@ source_filename = "LFortran" define void @__module___main_____main__global_stmts() { .entry: - %0 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info, i32 0, i32 0), i32 0, i32 0, i64* @u) + %0 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info, i32 0, i32 0), i32 0, i32 0, i64* @__module___main___u) call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @1, i32 0, i32 0), i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0)) - %1 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.1, i32 0, i32 0), i32 0, i32 0, i32* @x) + %1 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.1, i32 0, i32 0), i32 0, i32 0, i32* @__module___main___x) call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @3, i32 0, i32 0), i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @2, i32 0, i32 0)) - %2 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.2, i32 0, i32 0), i32 0, i32 0, i16* @y) + %2 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.2, i32 0, i32 0), i32 0, i32 0, i16* @__module___main___y) call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @5, i32 0, i32 0), i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @4, i32 0, i32 0)) - %3 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.3, i32 0, i32 0), i32 0, i32 0, i8* @z) + %3 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.3, i32 0, i32 0), i32 0, i32 0, i8* @__module___main___z) call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @7, i32 0, i32 0), i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @6, i32 0, i32 0)) br label %return