From 100218f7fc1b66ddf48d7500c772c7d73278ec77 Mon Sep 17 00:00:00 2001 From: Smit-create Date: Sat, 19 Mar 2022 18:41:56 +0530 Subject: [PATCH 01/10] implement real and imag for complex --- src/lpython/semantics/python_ast_to_asr.cpp | 43 +++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 56640758f1..7ab315847c 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -1837,6 +1837,49 @@ class BodyVisitor : public CommonVisitor { } + void visit_Attribute(const AST::Attribute_t &x) { + if (AST::is_a(*x.m_value)) { + std::string value = AST::down_cast(x.m_value)->m_id; + ASR::symbol_t *t = current_scope->scope[value]; + if (!t) { + throw SemanticError("'" + value + "' is not defined in the scope", + x.base.base.loc); + } + if (ASR::is_a(*t)) { + ASR::Variable_t *var = ASR::down_cast(t); + LFORTRAN_ASSERT(var->m_value); + if (ASR::is_a(*var->m_value)) { + std::string attr = x.m_attr; + if (attr == "imag") { + double val = ASR::down_cast(var->m_value)->m_im; + ASR::ttype_t *type = ASRUtils::TYPE(ASR::make_Real_t(al, x.base.base.loc, + 8, nullptr, 0)); + tmp = ASR::make_ConstantReal_t(al, x.base.base.loc, val, type); + } else if (attr == "real") { + double val = ASR::down_cast(var->m_value)->m_re; + ASR::ttype_t *type = ASRUtils::TYPE(ASR::make_Real_t(al, x.base.base.loc, + 8, nullptr, 0)); + tmp = ASR::make_ConstantReal_t(al, x.base.base.loc, val, type); + } else { + throw SemanticError("'" + attr + "' is not implemented for Complex type", + x.base.base.loc); + } + + } else { + throw SemanticError("Only Complex type supported for now in Attribute", + x.base.base.loc); + } + } else { + throw SemanticError("Only Variable type is supported for now in Attribute", + x.base.base.loc); + } + + } else { + throw SemanticError("Only Name is supported for now in Attribute", + x.base.base.loc); + } + } + void visit_If(const AST::If_t &x) { visit_expr(*x.m_test); ASR::expr_t *test = ASRUtils::EXPR(tmp); From 0196153c8fb44fea879bbb768e044e947c83c81a Mon Sep 17 00:00:00 2001 From: Smit-create Date: Sun, 20 Mar 2022 19:34:52 +0530 Subject: [PATCH 02/10] Add `imag` function for complex --- src/lpython/semantics/python_comptime_eval.h | 19 +++++++++++++++++++ src/runtime/lpython_builtin.py | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/src/lpython/semantics/python_comptime_eval.h b/src/lpython/semantics/python_comptime_eval.h index a8783bca6d..870165ddc9 100644 --- a/src/lpython/semantics/python_comptime_eval.h +++ b/src/lpython/semantics/python_comptime_eval.h @@ -44,6 +44,7 @@ struct PythonIntrinsicProcedures { {"hex", {m_builtin, &eval_hex}}, {"oct", {m_builtin, &eval_oct}}, {"complex", {m_builtin, &eval_complex}}, + {"imag", {m_builtin, &eval_imag}}, {"divmod", {m_builtin, &eval_divmod}}, }; } @@ -503,6 +504,24 @@ struct PythonIntrinsicProcedures { return ASR::down_cast(make_ConstantComplex_t(al, loc, c1, c2, type)); } + static ASR::expr_t *eval_imag(Allocator &al, const Location &loc, + Vec &args + ) { + LFORTRAN_ASSERT(ASRUtils::all_args_evaluated(args)); + if (args.size() != 1) { + throw SemanticError("Intrinsic imag function accepts exactly 1 argument", loc); + } + ASR::expr_t* imag_arg = args[0]; + ASR::ttype_t* t = ASRUtils::expr_type(args[0]); + if (LFortran::ASR::is_a(*t)) { + double im = ASR::down_cast(imag_arg)->m_im; + double result = im; + return ASR::down_cast(ASR::make_ConstantReal_t(al, loc, result, t)); + } else { + throw SemanticError("Argument of the aimag() function must be Complex", loc); + } + } + static ASR::expr_t *eval_divmod(Allocator &al, const Location &loc, Vec &args) { LFORTRAN_ASSERT(ASRUtils::all_args_evaluated(args)); if (args.size() != 2) { diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index 54719306dc..e6c9cb0397 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -288,3 +288,11 @@ def lbound(x: i32[:], dim: i32) -> i32: def ubound(x: i32[:], dim: i32) -> i32: pass + + +@overload +def imag(x: c64) -> f64: + pass + +@overload +def imag(x: c32) -> f32: From ca07fb356a105d10ba856437e20a9748f612151d Mon Sep 17 00:00:00 2001 From: Smit-create Date: Sun, 20 Mar 2022 19:35:23 +0530 Subject: [PATCH 03/10] fix real and imag for complex types --- src/lpython/semantics/python_ast_to_asr.cpp | 27 +++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 7ab315847c..c0db0a1630 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -1847,19 +1847,26 @@ class BodyVisitor : public CommonVisitor { } if (ASR::is_a(*t)) { ASR::Variable_t *var = ASR::down_cast(t); - LFORTRAN_ASSERT(var->m_value); - if (ASR::is_a(*var->m_value)) { + // LFORTRAN_ASSERT(var->m_value); + if (ASRUtils::is_complex(*var->m_type)) { std::string attr = x.m_attr; if (attr == "imag") { - double val = ASR::down_cast(var->m_value)->m_im; - ASR::ttype_t *type = ASRUtils::TYPE(ASR::make_Real_t(al, x.base.base.loc, - 8, nullptr, 0)); - tmp = ASR::make_ConstantReal_t(al, x.base.base.loc, val, type); + ASR::expr_t *val = ASR::down_cast(ASR::make_Var_t(al, x.base.base.loc, t)); + ASR::symbol_t *fn_imag = resolve_intrinsic_function(x.base.base.loc, "imag"); + Vec args; + args.reserve(al, 1); + args.push_back(al, val); + make_call_helper(al, fn_imag, current_scope, args, "imag", x.base.base.loc); + return; } else if (attr == "real") { - double val = ASR::down_cast(var->m_value)->m_re; - ASR::ttype_t *type = ASRUtils::TYPE(ASR::make_Real_t(al, x.base.base.loc, - 8, nullptr, 0)); - tmp = ASR::make_ConstantReal_t(al, x.base.base.loc, val, type); + ASR::expr_t *val = ASR::down_cast(ASR::make_Var_t(al, x.base.base.loc, t)); + int kind = ASRUtils::extract_kind_from_ttype_t(var->m_type); + ASR::ttype_t *dest_type = ASR::down_cast(ASR::make_Real_t(al, x.base.base.loc, + kind, nullptr, 0)); + tmp = (ASR::asr_t*)ASR::down_cast(ASR::make_ImplicitCast_t( + al, val->base.loc, val, ASR::cast_kindType::ComplexToReal, dest_type, + nullptr)); + return; } else { throw SemanticError("'" + attr + "' is not implemented for Complex type", x.base.base.loc); From 0f1275c2afe8672086ebed9972ddbb35a2275ee7 Mon Sep 17 00:00:00 2001 From: Smit-create Date: Sun, 20 Mar 2022 19:39:39 +0530 Subject: [PATCH 04/10] add a test with TODO --- integration_tests/run_tests.py | 1 + integration_tests/test_complex.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 integration_tests/test_complex.py diff --git a/integration_tests/run_tests.py b/integration_tests/run_tests.py index 149555d818..1359a79031 100755 --- a/integration_tests/run_tests.py +++ b/integration_tests/run_tests.py @@ -34,6 +34,7 @@ "test_c_interop_01.py", "test_generics_01.py", "test_cmath.py", + "test_complex.py" ] # CPython tests only diff --git a/integration_tests/test_complex.py b/integration_tests/test_complex.py new file mode 100644 index 0000000000..46d3990c77 --- /dev/null +++ b/integration_tests/test_complex.py @@ -0,0 +1,16 @@ +from ltypes import f64, c64 + +def test_real_imag(): + x: c64 + x = 2 + 3j + a: f64 + b: f64 + eps: f64 + eps = 1e-12 + a = x.real + b = x.imag + assert abs(a - 2) < eps + # TODO: below test should work + # assert abs(b - 3) < eps + +test_real_imag() From 4003bd0058cc8f4b6d35b788ac75f1d19488ad27 Mon Sep 17 00:00:00 2001 From: Smit-create Date: Tue, 22 Mar 2022 19:10:35 +0530 Subject: [PATCH 05/10] fix typos and apply suggestions --- src/lpython/semantics/python_ast_to_asr.cpp | 12 +++++++----- src/lpython/semantics/python_comptime_eval.h | 14 +++++++------- src/runtime/lpython_builtin.py | 5 +++-- tests/reference/asr-complex1-f26c460.json | 2 +- tests/reference/asr-complex1-f26c460.stdout | 2 +- tests/reference/asr-constants1-5828e8a.json | 2 +- tests/reference/asr-constants1-5828e8a.stdout | 2 +- tests/reference/asr-expr1-8df2d66.json | 2 +- tests/reference/asr-expr1-8df2d66.stdout | 2 +- 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 | 2 +- tests/reference/asr-expr7-480ba2f.json | 2 +- tests/reference/asr-expr7-480ba2f.stdout | 2 +- tests/reference/asr-test_builtin-aa64615.json | 2 +- tests/reference/asr-test_builtin-aa64615.stdout | 2 +- tests/reference/asr-test_builtin_abs-c74d2c9.json | 2 +- .../reference/asr-test_builtin_abs-c74d2c9.stdout | 2 +- tests/reference/asr-test_builtin_bin-52ba9fa.json | 2 +- .../reference/asr-test_builtin_bin-52ba9fa.stdout | 2 +- tests/reference/asr-test_builtin_bool-330223a.json | 2 +- .../reference/asr-test_builtin_bool-330223a.stdout | 2 +- .../reference/asr-test_builtin_float-20601dd.json | 2 +- .../asr-test_builtin_float-20601dd.stdout | 2 +- tests/reference/asr-test_builtin_hex-64bd268.json | 2 +- .../reference/asr-test_builtin_hex-64bd268.stdout | 2 +- tests/reference/asr-test_builtin_int-8f88fdc.json | 2 +- .../reference/asr-test_builtin_int-8f88fdc.stdout | 2 +- tests/reference/asr-test_builtin_len-55b0dec.json | 2 +- .../reference/asr-test_builtin_len-55b0dec.stdout | 2 +- tests/reference/asr-test_builtin_oct-20b9066.json | 2 +- .../reference/asr-test_builtin_oct-20b9066.stdout | 2 +- tests/reference/asr-test_builtin_pow-f02fcda.json | 2 +- .../reference/asr-test_builtin_pow-f02fcda.stdout | 2 +- .../reference/asr-test_builtin_round-7417a21.json | 2 +- .../asr-test_builtin_round-7417a21.stdout | 2 +- tests/reference/asr-test_builtin_str-580e920.json | 2 +- .../reference/asr-test_builtin_str-580e920.stdout | 2 +- 39 files changed, 53 insertions(+), 50 deletions(-) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index c0db0a1630..116459abfe 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -1847,16 +1847,18 @@ class BodyVisitor : public CommonVisitor { } if (ASR::is_a(*t)) { ASR::Variable_t *var = ASR::down_cast(t); - // LFORTRAN_ASSERT(var->m_value); if (ASRUtils::is_complex(*var->m_type)) { std::string attr = x.m_attr; if (attr == "imag") { ASR::expr_t *val = ASR::down_cast(ASR::make_Var_t(al, x.base.base.loc, t)); - ASR::symbol_t *fn_imag = resolve_intrinsic_function(x.base.base.loc, "imag"); - Vec args; + ASR::symbol_t *fn_imag = resolve_intrinsic_function(x.base.base.loc, "_imag"); + Vec args; args.reserve(al, 1); - args.push_back(al, val); - make_call_helper(al, fn_imag, current_scope, args, "imag", x.base.base.loc); + ASR::call_arg_t arg; + arg.loc = val->base.loc; + arg.m_value = val; + args.push_back(al, arg); + make_call_helper(al, fn_imag, current_scope, args, "_imag", x.base.base.loc); return; } else if (attr == "real") { ASR::expr_t *val = ASR::down_cast(ASR::make_Var_t(al, x.base.base.loc, t)); diff --git a/src/lpython/semantics/python_comptime_eval.h b/src/lpython/semantics/python_comptime_eval.h index 870165ddc9..7ce5d2a203 100644 --- a/src/lpython/semantics/python_comptime_eval.h +++ b/src/lpython/semantics/python_comptime_eval.h @@ -44,7 +44,7 @@ struct PythonIntrinsicProcedures { {"hex", {m_builtin, &eval_hex}}, {"oct", {m_builtin, &eval_oct}}, {"complex", {m_builtin, &eval_complex}}, - {"imag", {m_builtin, &eval_imag}}, + {"_imag", {m_builtin, &eval__imag}}, {"divmod", {m_builtin, &eval_divmod}}, }; } @@ -504,21 +504,21 @@ struct PythonIntrinsicProcedures { return ASR::down_cast(make_ConstantComplex_t(al, loc, c1, c2, type)); } - static ASR::expr_t *eval_imag(Allocator &al, const Location &loc, + static ASR::expr_t *eval__imag(Allocator &al, const Location &loc, Vec &args ) { LFORTRAN_ASSERT(ASRUtils::all_args_evaluated(args)); if (args.size() != 1) { - throw SemanticError("Intrinsic imag function accepts exactly 1 argument", loc); + throw SemanticError("Intrinsic _imag function accepts exactly 1 argument", loc); } ASR::expr_t* imag_arg = args[0]; - ASR::ttype_t* t = ASRUtils::expr_type(args[0]); - if (LFortran::ASR::is_a(*t)) { + ASR::ttype_t *type = ASRUtils::TYPE(ASR::make_Real_t(al, loc, 8, nullptr, 0)); + if (ASR::is_a(*ASRUtils::expr_type(imag_arg))) { double im = ASR::down_cast(imag_arg)->m_im; double result = im; - return ASR::down_cast(ASR::make_ConstantReal_t(al, loc, result, t)); + return ASR::down_cast(ASR::make_ConstantReal_t(al, loc, result, type)); } else { - throw SemanticError("Argument of the aimag() function must be Complex", loc); + throw SemanticError("Argument of the _imag() function must be Complex", loc); } } diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index e6c9cb0397..e91deaa3dc 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -291,8 +291,9 @@ def ubound(x: i32[:], dim: i32) -> i32: @overload -def imag(x: c64) -> f64: +def _imag(x: c64) -> f64: pass @overload -def imag(x: c32) -> f32: +def _imag(x: c32) -> f32: + pass diff --git a/tests/reference/asr-complex1-f26c460.json b/tests/reference/asr-complex1-f26c460.json index fce287fc90..6ce8710bbb 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": "6b4a5f8939ee7531165bc085d06704c624004418ee7b4a7896d4c72e", + "stdout_hash": "44076487f58beb07743ef2fad5b6d08fca64565b71be13e0396da36f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex1-f26c460.stdout b/tests/reference/asr-complex1-f26c460.stdout index 2255429e7e..5d538850da 100644 --- a/tests/reference/asr-complex1-f26c460.stdout +++ b/tests/reference/asr-complex1-f26c460.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 40 {}) main_program [] []), test: (Subroutine (SymbolTable 3 {x: (Variable 3 x Local () () Default (Complex 8 []) Source Public Required .false.), y: (Variable 3 y Local () () Default (Complex 8 []) Source Public Required .false.), z: (Variable 3 z Local () () Default (Complex 4 []) Source Public Required .false.)}) test [] [(= (Var 3 x) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ConstantComplex 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 y) (BinOp (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ConstantComplex 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Mul (Var 3 x) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.), test_complex: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), c2: (Variable 2 c2 Local () () Default (Complex 4 []) Source Public Required .false.), c3: (Variable 2 c3 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 5 complex lpython_builtin [] complex Private)}) test_complex [] [(= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [((ConstantReal 3.400000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [((ConstantReal 5.000000 (Real 8 []))) ((ConstantReal 4.300000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c1) (ImplicitCast (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c2) (ImplicitCast (FunctionCall 2 complex () [((ConstantInteger 2 (Integer 4 []))) ((ConstantReal 4.500000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c3) (FunctionCall 2 complex () [((ConstantReal 3.000000 (Real 8 []))) ((ConstantReal 4.000000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (ImplicitCast (Var 2 c1) ComplexToComplex (Complex 8 []) ()) Eq (Var 2 c3) (Logical 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c1) Add (Var 2 c2) (Complex 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c2) Sub (Var 2 c1) (Complex 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c1) Mul (Var 2 c2) (Complex 4 []) () ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 2 complex () [((ConstantReal 3.345340 (Real 8 []))) ((ConstantReal 4.867868 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 0.015553 0.065561 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex -5.000000 10.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [((ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 5 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 1.000000 1.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 42 {}) main_program [] []), test: (Subroutine (SymbolTable 3 {x: (Variable 3 x Local () () Default (Complex 8 []) Source Public Required .false.), y: (Variable 3 y Local () () Default (Complex 8 []) Source Public Required .false.), z: (Variable 3 z Local () () Default (Complex 4 []) Source Public Required .false.)}) test [] [(= (Var 3 x) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ConstantComplex 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 y) (BinOp (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ConstantComplex 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Mul (Var 3 x) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.), test_complex: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), c2: (Variable 2 c2 Local () () Default (Complex 4 []) Source Public Required .false.), c3: (Variable 2 c3 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 5 complex lpython_builtin [] complex Private)}) test_complex [] [(= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [((ConstantReal 3.400000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [((ConstantReal 5.000000 (Real 8 []))) ((ConstantReal 4.300000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c1) (ImplicitCast (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c2) (ImplicitCast (FunctionCall 2 complex () [((ConstantInteger 2 (Integer 4 []))) ((ConstantReal 4.500000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c3) (FunctionCall 2 complex () [((ConstantReal 3.000000 (Real 8 []))) ((ConstantReal 4.000000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (ImplicitCast (Var 2 c1) ComplexToComplex (Complex 8 []) ()) Eq (Var 2 c3) (Logical 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c1) Add (Var 2 c2) (Complex 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c2) Sub (Var 2 c1) (Complex 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c1) Mul (Var 2 c2) (Complex 4 []) () ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 2 complex () [((ConstantReal 3.345340 (Real 8 []))) ((ConstantReal 4.867868 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 0.015553 0.065561 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex -5.000000 10.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [((ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 5 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 1.000000 1.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-constants1-5828e8a.json b/tests/reference/asr-constants1-5828e8a.json index 2ebf7c9dc6..6ea6156bdd 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": "b1312682ec61a28f1368c5a4382aa6f98c1c1023aed1be56c9608d5a", + "stdout_hash": "a7463dede7083fa2339cafab09fb64ea15670ca36fc7ad64a48c7d21", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-constants1-5828e8a.stdout b/tests/reference/asr-constants1-5828e8a.stdout index 96b47fd47c..70d9af4aed 100644 --- a/tests/reference/asr-constants1-5828e8a.stdout +++ b/tests/reference/asr-constants1-5828e8a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 13 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), abs@__lpython_overloaded_2__abs: (ExternalSymbol 1 abs@__lpython_overloaded_2__abs 13 __lpython_overloaded_2__abs lpython_builtin [] __lpython_overloaded_2__abs Public), abs@__lpython_overloaded_3__abs: (ExternalSymbol 1 abs@__lpython_overloaded_3__abs 13 __lpython_overloaded_3__abs lpython_builtin [] __lpython_overloaded_3__abs Public), abs@__lpython_overloaded_5__abs: (ExternalSymbol 1 abs@__lpython_overloaded_5__abs 13 __lpython_overloaded_5__abs lpython_builtin [] __lpython_overloaded_5__abs Public), bool@__lpython_overloaded_0__bool: (ExternalSymbol 1 bool@__lpython_overloaded_0__bool 13 __lpython_overloaded_0__bool lpython_builtin [] __lpython_overloaded_0__bool Public), bool@__lpython_overloaded_3__bool: (ExternalSymbol 1 bool@__lpython_overloaded_3__bool 13 __lpython_overloaded_3__bool lpython_builtin [] __lpython_overloaded_3__bool Public), bool@__lpython_overloaded_4__bool: (ExternalSymbol 1 bool@__lpython_overloaded_4__bool 13 __lpython_overloaded_4__bool lpython_builtin [] __lpython_overloaded_4__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 13 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 48 {}) main_program [] []), test_abs: (Subroutine (SymbolTable 4 {a: (Variable 4 a Local () () Default (Integer 4 []) Source Public Required .false.), abs: (ExternalSymbol 4 abs 13 abs lpython_builtin [] abs Private), b: (Variable 4 b Local () () Default (Real 4 []) Source Public Required .false.), complex: (ExternalSymbol 4 complex 13 complex lpython_builtin [] complex Private)}) test_abs [] [(= (Var 4 a) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_2__abs 4 abs [((ConstantInteger 5 (Integer 4 [])))] (Integer 8 []) (ConstantInteger 5 (Integer 4 [])) ()) IntegerToInteger (Integer 4 []) ()) ()) (= (Var 4 a) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_2__abs 4 abs [((UnaryOp USub (ConstantInteger 500 (Integer 4 [])) (Integer 4 []) (ConstantInteger -500 (Integer 4 []))))] (Integer 8 []) (ConstantInteger 500 (Integer 4 [])) ()) IntegerToInteger (Integer 4 []) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_3__abs 4 abs [((ConstantLogical .false. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_3__abs 4 abs [((ConstantLogical .true. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((ConstantReal 3.450000 (Real 8 [])))] (Real 8 []) (ConstantReal 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((UnaryOp USub (ConstantReal 5346.340000 (Real 8 [])) (Real 8 []) (ConstantReal -5346.340000 (Real 8 []))))] (Real 8 []) (ConstantReal 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_5__abs 4 abs [((FunctionCall 4 complex () [((ConstantReal 3.450000 (Real 8 []))) ((ConstantReal 5.600000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.450000 5.600000 (Complex 8 [])) ()))] (Real 8 []) (ConstantReal 6.577424 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ())] Source Public Implementation () .false. .false.), test_bool: (Subroutine (SymbolTable 6 {a: (Variable 6 a Local () () Default (Logical 1 []) Source Public Required .false.), bool: (ExternalSymbol 6 bool 13 bool lpython_builtin [] bool Private), complex: (ExternalSymbol 6 complex 13 complex lpython_builtin [] complex Private)}) test_bool [] [(= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((ConstantInteger 0 (Integer 4 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_4__bool 6 bool [((ConstantString "" (Character 1 0 () [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_7__bool 6 bool [((FunctionCall 6 complex () [((ConstantInteger 0 (Integer 4 []))) ((ConstantInteger 0 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_4__bool 6 bool [((ConstantString "t" (Character 1 1 () [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_3__bool 6 bool [((ConstantReal 2.300000 (Real 8 [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_boz: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Character 1 -2 () []) Source Public Required .false.), bin: (ExternalSymbol 2 bin 13 bin lpython_builtin [] bin Private), hex: (ExternalSymbol 2 hex 13 hex lpython_builtin [] hex Private), oct: (ExternalSymbol 2 oct 13 oct lpython_builtin [] oct Private)}) test_boz [] [(= (Var 2 b) (FunctionCall 2 bin () [((ConstantInteger 5 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((ConstantInteger 64 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((ConstantInteger 8 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((ConstantInteger 56 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((ConstantInteger 42 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((ConstantInteger 12648430 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0x216" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.), test_callable: (Subroutine (SymbolTable 8 {a: (Variable 8 a Local () () Default (Logical 1 []) Source Public Required .false.), b: (Variable 8 b Local () () Default (Integer 4 []) Source Public Required .false.)}) test_callable [] [(= (Var 8 b) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 8 a) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_divmod: (Subroutine (SymbolTable 11 {a: (Variable 11 a Local () () Default (Tuple [(Integer 4 []) (Integer 4 [])]) Source Public Required .false.), divmod: (ExternalSymbol 11 divmod 13 divmod lpython_builtin [] divmod Private)}) test_divmod [] [(= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 9 (Integer 4 []))) ((ConstantInteger 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 9 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 []))))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger -3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 0 (Integer 4 []))) ((ConstantInteger 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ())] Source Public Implementation () .false. .false.), test_float: (Subroutine (SymbolTable 10 {a: (Variable 10 a Local () () Default (Real 8 []) Source Public Required .false.), float: (ExternalSymbol 10 float 13 float lpython_builtin [] float Private)}) test_float [] [(= (Var 10 a) (FunctionCall 10 float () [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantReal 4.560000 (Real 8 [])))] (Real 8 []) (ConstantReal 4.560000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantInteger 5 (Integer 4 [])))] (Real 8 []) (ConstantReal 5.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Real 8 []) (ConstantReal -1.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantLogical .true. (Logical 1 [])))] (Real 8 []) (ConstantReal 1.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantLogical .false. (Logical 1 [])))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantString "5346" (Character 1 4 () [])))] (Real 8 []) (ConstantReal 5346.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantString "423.534" (Character 1 7 () [])))] (Real 8 []) (ConstantReal 423.533997 (Real 8 [])) ()) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.), int: (ExternalSymbol 9 int 13 int lpython_builtin [] int Private)}) test_int [] [(= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantReal 4.560000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantInteger 5 (Integer 4 [])))] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((UnaryOp USub (ConstantReal 5.000010 (Real 8 [])) (Real 8 []) (ConstantReal -5.000010 (Real 8 []))))] (Integer 4 []) (ConstantInteger -5 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantLogical .true. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 1 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantLogical .false. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantString "5346" (Character 1 4 () [])))] (Integer 4 []) (ConstantInteger 5346 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ())] Source Public Implementation () .false. .false.), test_len: (Subroutine (SymbolTable 5 {a: (Variable 5 a Local () () Default (Integer 4 []) Source Public Required .false.), len: (ExternalSymbol 5 len 13 len lpython_builtin [] len Private)}) test_len [] [(= (Var 5 a) (FunctionCall 5 len () [((ConstantString "" (Character 1 0 () [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [((ConstantString "test" (Character 1 4 () [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [((ConstantString "this is a test" (Character 1 14 () [])))] (Integer 4 []) (ConstantInteger 14 (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_ord_chr: (Subroutine (SymbolTable 3 {a: (Variable 3 a Local () () Default (Integer 4 []) Source Public Required .false.), chr: (ExternalSymbol 3 chr 13 chr lpython_builtin [] chr Private), ord: (ExternalSymbol 3 ord 13 ord lpython_builtin [] ord Private), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord_chr [] [(= (Var 3 a) (FunctionCall 3 ord () [((ConstantString "5" (Character 1 1 () [])))] (Integer 4 []) (ConstantInteger 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [((ConstantInteger 43 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "+" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.), test_str: (Subroutine (SymbolTable 7 {s: (Variable 7 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), str: (ExternalSymbol 7 str 13 str lpython_builtin [] str Private)}) test_str [] [(= (Var 7 s) (FunctionCall 7 str () [] (Character 1 -2 () []) (ConstantString "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantInteger 5 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantReal 5.600000 (Real 8 [])))] (Character 1 -2 () []) (ConstantString "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantLogical .true. (Logical 1 [])))] (Character 1 -2 () []) (ConstantString "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantLogical .false. (Logical 1 [])))] (Character 1 -2 () []) (ConstantString "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantString "5346" (Character 1 4 () [])))] (Character 1 -2 () []) (ConstantString "5346" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 13 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), abs@__lpython_overloaded_2__abs: (ExternalSymbol 1 abs@__lpython_overloaded_2__abs 13 __lpython_overloaded_2__abs lpython_builtin [] __lpython_overloaded_2__abs Public), abs@__lpython_overloaded_3__abs: (ExternalSymbol 1 abs@__lpython_overloaded_3__abs 13 __lpython_overloaded_3__abs lpython_builtin [] __lpython_overloaded_3__abs Public), abs@__lpython_overloaded_5__abs: (ExternalSymbol 1 abs@__lpython_overloaded_5__abs 13 __lpython_overloaded_5__abs lpython_builtin [] __lpython_overloaded_5__abs Public), bool@__lpython_overloaded_0__bool: (ExternalSymbol 1 bool@__lpython_overloaded_0__bool 13 __lpython_overloaded_0__bool lpython_builtin [] __lpython_overloaded_0__bool Public), bool@__lpython_overloaded_3__bool: (ExternalSymbol 1 bool@__lpython_overloaded_3__bool 13 __lpython_overloaded_3__bool lpython_builtin [] __lpython_overloaded_3__bool Public), bool@__lpython_overloaded_4__bool: (ExternalSymbol 1 bool@__lpython_overloaded_4__bool 13 __lpython_overloaded_4__bool lpython_builtin [] __lpython_overloaded_4__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 13 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 50 {}) main_program [] []), test_abs: (Subroutine (SymbolTable 4 {a: (Variable 4 a Local () () Default (Integer 4 []) Source Public Required .false.), abs: (ExternalSymbol 4 abs 13 abs lpython_builtin [] abs Private), b: (Variable 4 b Local () () Default (Real 4 []) Source Public Required .false.), complex: (ExternalSymbol 4 complex 13 complex lpython_builtin [] complex Private)}) test_abs [] [(= (Var 4 a) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_2__abs 4 abs [((ConstantInteger 5 (Integer 4 [])))] (Integer 8 []) (ConstantInteger 5 (Integer 4 [])) ()) IntegerToInteger (Integer 4 []) ()) ()) (= (Var 4 a) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_2__abs 4 abs [((UnaryOp USub (ConstantInteger 500 (Integer 4 [])) (Integer 4 []) (ConstantInteger -500 (Integer 4 []))))] (Integer 8 []) (ConstantInteger 500 (Integer 4 [])) ()) IntegerToInteger (Integer 4 []) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_3__abs 4 abs [((ConstantLogical .false. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_3__abs 4 abs [((ConstantLogical .true. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((ConstantReal 3.450000 (Real 8 [])))] (Real 8 []) (ConstantReal 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((UnaryOp USub (ConstantReal 5346.340000 (Real 8 [])) (Real 8 []) (ConstantReal -5346.340000 (Real 8 []))))] (Real 8 []) (ConstantReal 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_5__abs 4 abs [((FunctionCall 4 complex () [((ConstantReal 3.450000 (Real 8 []))) ((ConstantReal 5.600000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.450000 5.600000 (Complex 8 [])) ()))] (Real 8 []) (ConstantReal 6.577424 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ())] Source Public Implementation () .false. .false.), test_bool: (Subroutine (SymbolTable 6 {a: (Variable 6 a Local () () Default (Logical 1 []) Source Public Required .false.), bool: (ExternalSymbol 6 bool 13 bool lpython_builtin [] bool Private), complex: (ExternalSymbol 6 complex 13 complex lpython_builtin [] complex Private)}) test_bool [] [(= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((ConstantInteger 0 (Integer 4 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_4__bool 6 bool [((ConstantString "" (Character 1 0 () [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_7__bool 6 bool [((FunctionCall 6 complex () [((ConstantInteger 0 (Integer 4 []))) ((ConstantInteger 0 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_4__bool 6 bool [((ConstantString "t" (Character 1 1 () [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_3__bool 6 bool [((ConstantReal 2.300000 (Real 8 [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_boz: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Character 1 -2 () []) Source Public Required .false.), bin: (ExternalSymbol 2 bin 13 bin lpython_builtin [] bin Private), hex: (ExternalSymbol 2 hex 13 hex lpython_builtin [] hex Private), oct: (ExternalSymbol 2 oct 13 oct lpython_builtin [] oct Private)}) test_boz [] [(= (Var 2 b) (FunctionCall 2 bin () [((ConstantInteger 5 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((ConstantInteger 64 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((ConstantInteger 8 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((ConstantInteger 56 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((ConstantInteger 42 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((ConstantInteger 12648430 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0x216" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.), test_callable: (Subroutine (SymbolTable 8 {a: (Variable 8 a Local () () Default (Logical 1 []) Source Public Required .false.), b: (Variable 8 b Local () () Default (Integer 4 []) Source Public Required .false.)}) test_callable [] [(= (Var 8 b) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 8 a) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_divmod: (Subroutine (SymbolTable 11 {a: (Variable 11 a Local () () Default (Tuple [(Integer 4 []) (Integer 4 [])]) Source Public Required .false.), divmod: (ExternalSymbol 11 divmod 13 divmod lpython_builtin [] divmod Private)}) test_divmod [] [(= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 9 (Integer 4 []))) ((ConstantInteger 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 9 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 []))))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger -3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 0 (Integer 4 []))) ((ConstantInteger 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ())] Source Public Implementation () .false. .false.), test_float: (Subroutine (SymbolTable 10 {a: (Variable 10 a Local () () Default (Real 8 []) Source Public Required .false.), float: (ExternalSymbol 10 float 13 float lpython_builtin [] float Private)}) test_float [] [(= (Var 10 a) (FunctionCall 10 float () [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantReal 4.560000 (Real 8 [])))] (Real 8 []) (ConstantReal 4.560000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantInteger 5 (Integer 4 [])))] (Real 8 []) (ConstantReal 5.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Real 8 []) (ConstantReal -1.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantLogical .true. (Logical 1 [])))] (Real 8 []) (ConstantReal 1.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantLogical .false. (Logical 1 [])))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantString "5346" (Character 1 4 () [])))] (Real 8 []) (ConstantReal 5346.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantString "423.534" (Character 1 7 () [])))] (Real 8 []) (ConstantReal 423.533997 (Real 8 [])) ()) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.), int: (ExternalSymbol 9 int 13 int lpython_builtin [] int Private)}) test_int [] [(= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantReal 4.560000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantInteger 5 (Integer 4 [])))] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((UnaryOp USub (ConstantReal 5.000010 (Real 8 [])) (Real 8 []) (ConstantReal -5.000010 (Real 8 []))))] (Integer 4 []) (ConstantInteger -5 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantLogical .true. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 1 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantLogical .false. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantString "5346" (Character 1 4 () [])))] (Integer 4 []) (ConstantInteger 5346 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ())] Source Public Implementation () .false. .false.), test_len: (Subroutine (SymbolTable 5 {a: (Variable 5 a Local () () Default (Integer 4 []) Source Public Required .false.), len: (ExternalSymbol 5 len 13 len lpython_builtin [] len Private)}) test_len [] [(= (Var 5 a) (FunctionCall 5 len () [((ConstantString "" (Character 1 0 () [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [((ConstantString "test" (Character 1 4 () [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [((ConstantString "this is a test" (Character 1 14 () [])))] (Integer 4 []) (ConstantInteger 14 (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_ord_chr: (Subroutine (SymbolTable 3 {a: (Variable 3 a Local () () Default (Integer 4 []) Source Public Required .false.), chr: (ExternalSymbol 3 chr 13 chr lpython_builtin [] chr Private), ord: (ExternalSymbol 3 ord 13 ord lpython_builtin [] ord Private), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord_chr [] [(= (Var 3 a) (FunctionCall 3 ord () [((ConstantString "5" (Character 1 1 () [])))] (Integer 4 []) (ConstantInteger 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [((ConstantInteger 43 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "+" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.), test_str: (Subroutine (SymbolTable 7 {s: (Variable 7 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), str: (ExternalSymbol 7 str 13 str lpython_builtin [] str Private)}) test_str [] [(= (Var 7 s) (FunctionCall 7 str () [] (Character 1 -2 () []) (ConstantString "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantInteger 5 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantReal 5.600000 (Real 8 [])))] (Character 1 -2 () []) (ConstantString "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantLogical .true. (Logical 1 [])))] (Character 1 -2 () []) (ConstantString "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantLogical .false. (Logical 1 [])))] (Character 1 -2 () []) (ConstantString "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantString "5346" (Character 1 4 () [])))] (Character 1 -2 () []) (ConstantString "5346" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-expr1-8df2d66.json b/tests/reference/asr-expr1-8df2d66.json index 54773ee531..a8540826ef 100644 --- a/tests/reference/asr-expr1-8df2d66.json +++ b/tests/reference/asr-expr1-8df2d66.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr1-8df2d66.stdout", - "stdout_hash": "c9e6a99b521b3e497b9d78b4d34fe55db2c0e8dffab20bab99c2701d", + "stdout_hash": "05395701746322a31af12f943c9591d8a4cf78ed45ad6499add52b08", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr1-8df2d66.stdout b/tests/reference/asr-expr1-8df2d66.stdout index fbc0fb0b5b..04a9e7f3fe 100644 --- a/tests/reference/asr-expr1-8df2d66.stdout +++ b/tests/reference/asr-expr1-8df2d66.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] []), test_namedexpr: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 4 ord lpython_builtin [] ord Private), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () () Default (Integer 4 []) Source Public Required .false.)}) test_namedexpr [] [(= (Var 2 x) (NamedExpr (Var 2 y) (ConstantInteger 0 (Integer 4 [])) (Integer 4 [])) ()) (If (NamedExpr (Var 2 a) (FunctionCall 2 ord () [((ConstantString "3" (Character 1 1 () [])))] (Integer 4 []) (ConstantInteger 51 (Integer 4 [])) ()) (Integer 4 [])) [(= (Var 2 x) (ConstantInteger 1 (Integer 4 [])) ())] []) (WhileLoop (NamedExpr (Var 2 a) (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 y) (ConstantInteger 1 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] []), test_namedexpr: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 4 ord lpython_builtin [] ord Private), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () () Default (Integer 4 []) Source Public Required .false.)}) test_namedexpr [] [(= (Var 2 x) (NamedExpr (Var 2 y) (ConstantInteger 0 (Integer 4 [])) (Integer 4 [])) ()) (If (NamedExpr (Var 2 a) (FunctionCall 2 ord () [((ConstantString "3" (Character 1 1 () [])))] (Integer 4 []) (ConstantInteger 51 (Integer 4 [])) ()) (Integer 4 [])) [(= (Var 2 x) (ConstantInteger 1 (Integer 4 [])) ())] []) (WhileLoop (NamedExpr (Var 2 a) (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 y) (ConstantInteger 1 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-expr10-efcbb1b.json b/tests/reference/asr-expr10-efcbb1b.json index d8a10dc2b0..afb1442946 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": "a15deb14223d6e622dcd4ab8c777f941fa8b0ef1db079f62de253d02", + "stdout_hash": "602635a2665b93d1c7a5afab4e19b865ab71eab197fca2ac37a44b7d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr10-efcbb1b.stdout b/tests/reference/asr-expr10-efcbb1b.stdout index e46cff7b50..8db4d2b777 100644 --- a/tests/reference/asr-expr10-efcbb1b.stdout +++ b/tests/reference/asr-expr10-efcbb1b.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] []), test_UnaryOp: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), b1: (Variable 2 b1 Local () () Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () () Default (Logical 1 []) Source Public Required .false.), b3: (Variable 2 b3 Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private), f: (Variable 2 f Local () () Default (Real 4 []) Source Public Required .false.)}) test_UnaryOp [] [(= (Var 2 a) (UnaryOp UAdd (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger 4 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (ConstantInteger 500 (Integer 4 [])) (Integer 4 []) (ConstantInteger -500 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -6 (Integer 4 []))) ()) (= (Var 2 b) (UnaryOp Not (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 f) (ImplicitCast (UnaryOp UAdd (ConstantReal 1.000000 (Real 8 [])) (Real 8 []) (ConstantReal 1.000000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 f) (ImplicitCast (UnaryOp USub (ConstantReal 183745.534000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.534000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 b1) (ConstantLogical .true. (Logical 1 [])) ()) (= (Var 2 b2) (UnaryOp Not (ConstantLogical .false. (Logical 1 [])) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 b3) (UnaryOp Not (Var 2 b2) (Logical 1 []) ()) ()) (= (Var 2 a) (UnaryOp UAdd (ConstantLogical .true. (Logical 1 [])) (Integer 4 []) (ConstantInteger 1 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (ConstantLogical .false. (Logical 1 [])) (Integer 4 []) (ConstantInteger 0 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (ConstantLogical .true. (Logical 1 [])) (Integer 4 []) (ConstantInteger -2 (Integer 4 []))) ()) (= (Var 2 c) (ImplicitCast (UnaryOp UAdd (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (UnaryOp USub (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantReal 65.000000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.000000 65.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex -3.000000 -65.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 b1) (UnaryOp Not (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b2) (UnaryOp Not (FunctionCall 2 complex () [((ConstantInteger 0 (Integer 4 []))) ((ConstantInteger 0 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] []), test_UnaryOp: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), b1: (Variable 2 b1 Local () () Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () () Default (Logical 1 []) Source Public Required .false.), b3: (Variable 2 b3 Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private), f: (Variable 2 f Local () () Default (Real 4 []) Source Public Required .false.)}) test_UnaryOp [] [(= (Var 2 a) (UnaryOp UAdd (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger 4 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (ConstantInteger 500 (Integer 4 [])) (Integer 4 []) (ConstantInteger -500 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -6 (Integer 4 []))) ()) (= (Var 2 b) (UnaryOp Not (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 f) (ImplicitCast (UnaryOp UAdd (ConstantReal 1.000000 (Real 8 [])) (Real 8 []) (ConstantReal 1.000000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 f) (ImplicitCast (UnaryOp USub (ConstantReal 183745.534000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.534000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 b1) (ConstantLogical .true. (Logical 1 [])) ()) (= (Var 2 b2) (UnaryOp Not (ConstantLogical .false. (Logical 1 [])) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 b3) (UnaryOp Not (Var 2 b2) (Logical 1 []) ()) ()) (= (Var 2 a) (UnaryOp UAdd (ConstantLogical .true. (Logical 1 [])) (Integer 4 []) (ConstantInteger 1 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (ConstantLogical .false. (Logical 1 [])) (Integer 4 []) (ConstantInteger 0 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (ConstantLogical .true. (Logical 1 [])) (Integer 4 []) (ConstantInteger -2 (Integer 4 []))) ()) (= (Var 2 c) (ImplicitCast (UnaryOp UAdd (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (UnaryOp USub (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantReal 65.000000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.000000 65.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex -3.000000 -65.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 b1) (UnaryOp Not (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b2) (UnaryOp Not (FunctionCall 2 complex () [((ConstantInteger 0 (Integer 4 []))) ((ConstantInteger 0 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-expr13-81bdb5a.json b/tests/reference/asr-expr13-81bdb5a.json index c28f359d34..4a8d18e0a6 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": "46d790b628717b021cb8d388b0b677fc8bf90c988d4144b9a2c7f652", + "stdout_hash": "f523fd467341ee828a4d7d467f9684a4397ab481e06ddb694f7bb231", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr13-81bdb5a.stdout b/tests/reference/asr-expr13-81bdb5a.stdout index a48cee9dc2..bf2f338569 100644 --- a/tests/reference/asr-expr13-81bdb5a.stdout +++ b/tests/reference/asr-expr13-81bdb5a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] []), test_Compare: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Logical 1 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private)}) test_Compare [] [(= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Gt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) LtE (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Lt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 5.600000 (Real 8 [])) GtE (ConstantReal 5.599990 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) Eq (ConstantReal 3.300000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) NotEq (ConstantReal 3.400000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) Eq (FunctionCall 2 complex () [((ConstantReal 3.000000 (Real 8 []))) ((ConstantReal 4.000000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) Gt (ConstantString "abd" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "" (Character 1 0 () [])) Lt (ConstantString "s" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "-abs" (Character 1 4 () [])) GtE (ConstantString "abs" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abcd" (Character 1 4 () [])) LtE (ConstantString "abcde" (Character 1 5 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) Eq (ConstantString "abc" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) NotEq (ConstantString "abd" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "" (Character 1 0 () [])) Eq (ConstantString "+" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .true. (Logical 1 [])) Gt (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .true. (Logical 1 [])) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .false. (Logical 1 [])) NotEq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .false. (Logical 1 [])) GtE (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] []), test_Compare: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Logical 1 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private)}) test_Compare [] [(= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Gt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) LtE (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Lt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 5.600000 (Real 8 [])) GtE (ConstantReal 5.599990 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) Eq (ConstantReal 3.300000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) NotEq (ConstantReal 3.400000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) Eq (FunctionCall 2 complex () [((ConstantReal 3.000000 (Real 8 []))) ((ConstantReal 4.000000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) Gt (ConstantString "abd" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "" (Character 1 0 () [])) Lt (ConstantString "s" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "-abs" (Character 1 4 () [])) GtE (ConstantString "abs" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abcd" (Character 1 4 () [])) LtE (ConstantString "abcde" (Character 1 5 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) Eq (ConstantString "abc" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) NotEq (ConstantString "abd" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "" (Character 1 0 () [])) Eq (ConstantString "+" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .true. (Logical 1 [])) Gt (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .true. (Logical 1 [])) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .false. (Logical 1 [])) NotEq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .false. (Logical 1 [])) GtE (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-expr7-480ba2f.json b/tests/reference/asr-expr7-480ba2f.json index 25f0640e6b..6f65f79256 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": "5e06dd3d84691c89a6a3c200a39762c57db4519f960d77b25fd87bbe", + "stdout_hash": "318748c5acdecf7c289f356ba463ac6799848d9190f547144b704716", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr7-480ba2f.stdout b/tests/reference/asr-expr7-480ba2f.stdout index 0492f66a33..6f7b6d481b 100644 --- a/tests/reference/asr-expr7-480ba2f.stdout +++ b/tests/reference/asr-expr7-480ba2f.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 main0 () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main0: (Subroutine (SymbolTable 4 {c: (Variable 4 c Local () () Default (Integer 4 []) Source Public Required .false.)}) main0 [] [(SubroutineCall 1 test_pow () [] ()) (= (Var 4 c) (FunctionCall 1 test_pow_1 () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), pow@__lpython_overloaded_0__pow: (ExternalSymbol 1 pow@__lpython_overloaded_0__pow 6 __lpython_overloaded_0__pow lpython_builtin [] __lpython_overloaded_0__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 6 pow lpython_builtin [] pow Private)}) test_pow [] [(= (Var 2 a) (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_pow_1: (Function (SymbolTable 3 {_lpython_return_variable: (Variable 3 _lpython_return_variable ReturnVar () () Default (Integer 4 []) Source Public Required .false.), a: (Variable 3 a In () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 3 b In () () Default (Integer 4 []) Source Public Required .false.), pow: (ExternalSymbol 3 pow 6 pow lpython_builtin [] pow Private), res: (Variable 3 res Local () () Default (Integer 4 []) Source Public Required .false.)}) test_pow_1 [(Var 3 a) (Var 3 b)] [(= (Var 3 res) (FunctionCall 1 pow@__lpython_overloaded_0__pow 3 pow [((Var 3 a)) ((Var 3 b))] (Integer 4 []) () ()) ()) (= (Var 3 _lpython_return_variable) (Var 3 res) ()) (Return)] (Var 3 _lpython_return_variable) Source Public Implementation ())}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 main0 () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main0: (Subroutine (SymbolTable 4 {c: (Variable 4 c Local () () Default (Integer 4 []) Source Public Required .false.)}) main0 [] [(SubroutineCall 1 test_pow () [] ()) (= (Var 4 c) (FunctionCall 1 test_pow_1 () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), pow@__lpython_overloaded_0__pow: (ExternalSymbol 1 pow@__lpython_overloaded_0__pow 6 __lpython_overloaded_0__pow lpython_builtin [] __lpython_overloaded_0__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 6 pow lpython_builtin [] pow Private)}) test_pow [] [(= (Var 2 a) (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_pow_1: (Function (SymbolTable 3 {_lpython_return_variable: (Variable 3 _lpython_return_variable ReturnVar () () Default (Integer 4 []) Source Public Required .false.), a: (Variable 3 a In () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 3 b In () () Default (Integer 4 []) Source Public Required .false.), pow: (ExternalSymbol 3 pow 6 pow lpython_builtin [] pow Private), res: (Variable 3 res Local () () Default (Integer 4 []) Source Public Required .false.)}) test_pow_1 [(Var 3 a) (Var 3 b)] [(= (Var 3 res) (FunctionCall 1 pow@__lpython_overloaded_0__pow 3 pow [((Var 3 a)) ((Var 3 b))] (Integer 4 []) () ()) ()) (= (Var 3 _lpython_return_variable) (Var 3 res) ()) (Return)] (Var 3 _lpython_return_variable) Source Public Implementation ())}) []) diff --git a/tests/reference/asr-test_builtin-aa64615.json b/tests/reference/asr-test_builtin-aa64615.json index d3463b4ac7..57e878e953 100644 --- a/tests/reference/asr-test_builtin-aa64615.json +++ b/tests/reference/asr-test_builtin-aa64615.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin-aa64615.stdout", - "stdout_hash": "76a25d054e8a241d26f653c2ae5e17f3701747d2575394b8b8d8a68a", + "stdout_hash": "7b4cdd0c287d2e8f3a37e23d90629b08bbc6406e683f459839af0947", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin-aa64615.stdout b/tests/reference/asr-test_builtin-aa64615.stdout index e160a18f65..e5a806485a 100644 --- a/tests/reference/asr-test_builtin-aa64615.stdout +++ b/tests/reference/asr-test_builtin-aa64615.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 41 {}) _lpython_main_program [] [(SubroutineCall 1 test_ord () [] ()) (SubroutineCall 1 test_chr () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 40 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_chr: (Subroutine (SymbolTable 3 {chr: (ExternalSymbol 3 chr 5 chr lpython_builtin [] chr Private), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_chr [] [(= (Var 3 i) (ConstantInteger 48 (Integer 4 [])) ()) (= (Var 3 s) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (Var 3 s) Eq (ConstantString "0" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((ConstantInteger 48 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0" (Character 1 1 () [])) ()) Eq (ConstantString "0" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_ord: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 5 ord lpython_builtin [] ord Private), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord [] [(= (Var 2 s) (ConstantString "1" (Character 1 1 () [])) ()) (= (Var 2 i) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (Var 2 i) Eq (ConstantInteger 49 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((ConstantString "1" (Character 1 1 () [])))] (Integer 4 []) (ConstantInteger 49 (Integer 4 [])) ()) Eq (ConstantInteger 49 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 43 {}) _lpython_main_program [] [(SubroutineCall 1 test_ord () [] ()) (SubroutineCall 1 test_chr () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 42 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_chr: (Subroutine (SymbolTable 3 {chr: (ExternalSymbol 3 chr 5 chr lpython_builtin [] chr Private), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_chr [] [(= (Var 3 i) (ConstantInteger 48 (Integer 4 [])) ()) (= (Var 3 s) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (Var 3 s) Eq (ConstantString "0" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((ConstantInteger 48 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0" (Character 1 1 () [])) ()) Eq (ConstantString "0" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_ord: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 5 ord lpython_builtin [] ord Private), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord [] [(= (Var 2 s) (ConstantString "1" (Character 1 1 () [])) ()) (= (Var 2 i) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (Var 2 i) Eq (ConstantInteger 49 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((ConstantString "1" (Character 1 1 () [])))] (Integer 4 []) (ConstantInteger 49 (Integer 4 [])) ()) Eq (ConstantInteger 49 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_abs-c74d2c9.json b/tests/reference/asr-test_builtin_abs-c74d2c9.json index b95311020e..2c525fa831 100644 --- a/tests/reference/asr-test_builtin_abs-c74d2c9.json +++ b/tests/reference/asr-test_builtin_abs-c74d2c9.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_abs-c74d2c9.stdout", - "stdout_hash": "21888bf35ca53a145173c10c7c3c3efd149e1cd35e8d3fd01f780c67", + "stdout_hash": "bc1245f58f746c1a4a3c6b30c4b0e79be08aa7ac1a542c53814f14dd", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_abs-c74d2c9.stdout b/tests/reference/asr-test_builtin_abs-c74d2c9.stdout index 6b7c7ef61b..4e45aecad2 100644 --- a/tests/reference/asr-test_builtin_abs-c74d2c9.stdout +++ b/tests/reference/asr-test_builtin_abs-c74d2c9.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 40 {}) _lpython_main_program [] [(SubroutineCall 1 test_abs () [] ())] Source Public Implementation () .false. .false.), abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 4 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), abs@__lpython_overloaded_1__abs: (ExternalSymbol 1 abs@__lpython_overloaded_1__abs 4 __lpython_overloaded_1__abs lpython_builtin [] __lpython_overloaded_1__abs Public), abs@__lpython_overloaded_2__abs: (ExternalSymbol 1 abs@__lpython_overloaded_2__abs 4 __lpython_overloaded_2__abs lpython_builtin [] __lpython_overloaded_2__abs Public), abs@__lpython_overloaded_3__abs: (ExternalSymbol 1 abs@__lpython_overloaded_3__abs 4 __lpython_overloaded_3__abs lpython_builtin [] __lpython_overloaded_3__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_abs: (Subroutine (SymbolTable 2 {abs: (ExternalSymbol 2 abs 4 abs lpython_builtin [] abs Private), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), x: (Variable 2 x Local () () Default (Real 8 []) Source Public Required .false.), x2: (Variable 2 x2 Local () () Default (Real 4 []) Source Public Required .false.)}) test_abs [] [(= (Var 2 x) (ConstantReal 5.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 x) (UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((ConstantReal 5.500000 (Real 8 [])))] (Real 8 []) (ConstantReal 5.500000 (Real 8 [])) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))))] (Real 8 []) (ConstantReal 5.500000 (Real 8 [])) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 x2) (ImplicitCast (UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (Compare (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_1__abs 2 abs [((Var 2 x2))] (Real 4 []) () ()) RealToReal (Real 8 []) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((Var 2 i))] (Integer 8 []) () ()) Eq (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Integer 8 []) (ConstantInteger 1 (Integer 4 [])) ()) Eq (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_abs () [] ())] Source Public Implementation () .false. .false.), abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 4 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), abs@__lpython_overloaded_1__abs: (ExternalSymbol 1 abs@__lpython_overloaded_1__abs 4 __lpython_overloaded_1__abs lpython_builtin [] __lpython_overloaded_1__abs Public), abs@__lpython_overloaded_2__abs: (ExternalSymbol 1 abs@__lpython_overloaded_2__abs 4 __lpython_overloaded_2__abs lpython_builtin [] __lpython_overloaded_2__abs Public), abs@__lpython_overloaded_3__abs: (ExternalSymbol 1 abs@__lpython_overloaded_3__abs 4 __lpython_overloaded_3__abs lpython_builtin [] __lpython_overloaded_3__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_abs: (Subroutine (SymbolTable 2 {abs: (ExternalSymbol 2 abs 4 abs lpython_builtin [] abs Private), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), x: (Variable 2 x Local () () Default (Real 8 []) Source Public Required .false.), x2: (Variable 2 x2 Local () () Default (Real 4 []) Source Public Required .false.)}) test_abs [] [(= (Var 2 x) (ConstantReal 5.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 x) (UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((ConstantReal 5.500000 (Real 8 [])))] (Real 8 []) (ConstantReal 5.500000 (Real 8 [])) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))))] (Real 8 []) (ConstantReal 5.500000 (Real 8 [])) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 x2) (ImplicitCast (UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (Compare (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_1__abs 2 abs [((Var 2 x2))] (Real 4 []) () ()) RealToReal (Real 8 []) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((Var 2 i))] (Integer 8 []) () ()) Eq (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Integer 8 []) (ConstantInteger 1 (Integer 4 [])) ()) Eq (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_bin-52ba9fa.json b/tests/reference/asr-test_builtin_bin-52ba9fa.json index cbe4f8b858..8cf1b12314 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": "ac59a77fc298e7e014a7a2e0bcec495752aab1bd853e01ce73e3524b", + "stdout_hash": "af678ef100983d8f232291a649cc5e0d4f7e9d0f3229c07085e821cd", "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 94744e04d9..ef9a596052 100644 --- a/tests/reference/asr-test_builtin_bin-52ba9fa.stdout +++ b/tests/reference/asr-test_builtin_bin-52ba9fa.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 40 {}) _lpython_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_bin: (Subroutine (SymbolTable 2 {bin: (ExternalSymbol 2 bin 4 bin lpython_builtin [] bin Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_bin [] [(= (Var 2 i) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0b101" (Character 1 5 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (ConstantInteger 64 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0b1000000" (Character 1 9 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bin () [((ConstantInteger 64 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0b1000000" (Character 1 1 () [])) ()) Eq (ConstantString "0b1000000" (Character 1 9 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bin () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) Eq (ConstantString "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_bin: (Subroutine (SymbolTable 2 {bin: (ExternalSymbol 2 bin 4 bin lpython_builtin [] bin Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_bin [] [(= (Var 2 i) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0b101" (Character 1 5 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (ConstantInteger 64 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0b1000000" (Character 1 9 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bin () [((ConstantInteger 64 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0b1000000" (Character 1 1 () [])) ()) Eq (ConstantString "0b1000000" (Character 1 9 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bin () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) Eq (ConstantString "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_bool-330223a.json b/tests/reference/asr-test_builtin_bool-330223a.json index f179d42c07..bb2d2b18d2 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": "7e01045902c021c48a892c8c8f3654bcc1dd6eb0c15afc03bb650f29", + "stdout_hash": "f9e0503c36a446cd576c7c2adcf512a3624af25877b3ab9e9fbf110d", "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 5f51d2ff33..9e87419927 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.stdout +++ b/tests/reference/asr-test_builtin_bool-330223a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 40 {}) _lpython_main_program [] [(SubroutineCall 1 test_bool () [] ())] Source Public Implementation () .false. .false.), bool@__lpython_overloaded_0__bool: (ExternalSymbol 1 bool@__lpython_overloaded_0__bool 4 __lpython_overloaded_0__bool lpython_builtin [] __lpython_overloaded_0__bool Public), bool@__lpython_overloaded_1__bool: (ExternalSymbol 1 bool@__lpython_overloaded_1__bool 4 __lpython_overloaded_1__bool lpython_builtin [] __lpython_overloaded_1__bool Public), bool@__lpython_overloaded_2__bool: (ExternalSymbol 1 bool@__lpython_overloaded_2__bool 4 __lpython_overloaded_2__bool lpython_builtin [] __lpython_overloaded_2__bool Public), bool@__lpython_overloaded_3__bool: (ExternalSymbol 1 bool@__lpython_overloaded_3__bool 4 __lpython_overloaded_3__bool lpython_builtin [] __lpython_overloaded_3__bool Public), bool@__lpython_overloaded_4__bool: (ExternalSymbol 1 bool@__lpython_overloaded_4__bool 4 __lpython_overloaded_4__bool lpython_builtin [] __lpython_overloaded_4__bool Public), bool@__lpython_overloaded_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 4 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_bool: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a2: (Variable 2 a2 Local () () Default (Integer 8 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), bool: (ExternalSymbol 2 bool 4 bool lpython_builtin [] bool Private), f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_bool [] [(= (Var 2 a) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) ()) (= (Var 2 a) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((ConstantInteger 0 (Integer 4 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 a2) (ImplicitCast (ConstantInteger 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [((Var 2 a2))] (Logical 1 []) () ()) ()) (= (Var 2 f) (ConstantReal 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (ConstantReal 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((ConstantReal 56.786866 (Real 8 [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((ConstantReal 0.000000 (Real 8 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 f2) (ImplicitCast (UnaryOp USub (ConstantReal 235.600000 (Real 8 [])) (Real 8 []) (ConstantReal -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [((Var 2 f2))] (Logical 1 []) () ()) ()) (= (Var 2 s) (ConstantString "" (Character 1 0 () [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 s) (ConstantString "str" (Character 1 3 () [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((ConstantString "" (Character 1 0 () [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((ConstantString "str" (Character 1 3 () [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((ConstantLogical .true. (Logical 1 [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((ConstantLogical .false. (Logical 1 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_bool () [] ())] Source Public Implementation () .false. .false.), bool@__lpython_overloaded_0__bool: (ExternalSymbol 1 bool@__lpython_overloaded_0__bool 4 __lpython_overloaded_0__bool lpython_builtin [] __lpython_overloaded_0__bool Public), bool@__lpython_overloaded_1__bool: (ExternalSymbol 1 bool@__lpython_overloaded_1__bool 4 __lpython_overloaded_1__bool lpython_builtin [] __lpython_overloaded_1__bool Public), bool@__lpython_overloaded_2__bool: (ExternalSymbol 1 bool@__lpython_overloaded_2__bool 4 __lpython_overloaded_2__bool lpython_builtin [] __lpython_overloaded_2__bool Public), bool@__lpython_overloaded_3__bool: (ExternalSymbol 1 bool@__lpython_overloaded_3__bool 4 __lpython_overloaded_3__bool lpython_builtin [] __lpython_overloaded_3__bool Public), bool@__lpython_overloaded_4__bool: (ExternalSymbol 1 bool@__lpython_overloaded_4__bool 4 __lpython_overloaded_4__bool lpython_builtin [] __lpython_overloaded_4__bool Public), bool@__lpython_overloaded_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 4 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_bool: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a2: (Variable 2 a2 Local () () Default (Integer 8 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), bool: (ExternalSymbol 2 bool 4 bool lpython_builtin [] bool Private), f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_bool [] [(= (Var 2 a) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) ()) (= (Var 2 a) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((ConstantInteger 0 (Integer 4 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 a2) (ImplicitCast (ConstantInteger 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [((Var 2 a2))] (Logical 1 []) () ()) ()) (= (Var 2 f) (ConstantReal 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (ConstantReal 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((ConstantReal 56.786866 (Real 8 [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((ConstantReal 0.000000 (Real 8 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 f2) (ImplicitCast (UnaryOp USub (ConstantReal 235.600000 (Real 8 [])) (Real 8 []) (ConstantReal -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [((Var 2 f2))] (Logical 1 []) () ()) ()) (= (Var 2 s) (ConstantString "" (Character 1 0 () [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 s) (ConstantString "str" (Character 1 3 () [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((ConstantString "" (Character 1 0 () [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((ConstantString "str" (Character 1 3 () [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((ConstantLogical .true. (Logical 1 [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((ConstantLogical .false. (Logical 1 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_float-20601dd.json b/tests/reference/asr-test_builtin_float-20601dd.json index ceefab99bf..52da073525 100644 --- a/tests/reference/asr-test_builtin_float-20601dd.json +++ b/tests/reference/asr-test_builtin_float-20601dd.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_float-20601dd.stdout", - "stdout_hash": "5af82705b087bbb48e3827e8ca2676c992386b986676c468db780a3f", + "stdout_hash": "80540c5b5f2957056ffc0dd0b22679a4f989432a857d6d6c2b16940c", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_float-20601dd.stdout b/tests/reference/asr-test_builtin_float-20601dd.stdout index c650c7cb91..ca7d7b4624 100644 --- a/tests/reference/asr-test_builtin_float-20601dd.stdout +++ b/tests/reference/asr-test_builtin_float-20601dd.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 40 {}) _lpython_main_program [] [(SubroutineCall 1 test_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_float: (Subroutine (SymbolTable 2 {float: (ExternalSymbol 2 float 4 float lpython_builtin [] float Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_float [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 float () [((ConstantInteger 34 (Integer 4 [])))] (Real 8 []) (ConstantReal 34.000000 (Real 8 [])) ()) Eq (ConstantReal 34.000000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 float () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])) ()) Eq (UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 float () [((ConstantInteger 34 (Integer 4 [])))] (Real 8 []) (ConstantReal 34.000000 (Real 8 [])) ()) Eq (ConstantReal 34.000000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 float () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])) ()) Eq (UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_float: (Subroutine (SymbolTable 2 {float: (ExternalSymbol 2 float 4 float lpython_builtin [] float Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_float [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 float () [((ConstantInteger 34 (Integer 4 [])))] (Real 8 []) (ConstantReal 34.000000 (Real 8 [])) ()) Eq (ConstantReal 34.000000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 float () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])) ()) Eq (UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 float () [((ConstantInteger 34 (Integer 4 [])))] (Real 8 []) (ConstantReal 34.000000 (Real 8 [])) ()) Eq (ConstantReal 34.000000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 float () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])) ()) Eq (UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_hex-64bd268.json b/tests/reference/asr-test_builtin_hex-64bd268.json index d99a4c019a..285c0a960d 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": "266a8939fe025efeef51f448c041a8a0c89d356c15643fa2b6ff8a2d", + "stdout_hash": "079b1e163e90145960c7d2378b43d0782186880dc5669f4cd7952f40", "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 3281850857..43cf2e3e38 100644 --- a/tests/reference/asr-test_builtin_hex-64bd268.stdout +++ b/tests/reference/asr-test_builtin_hex-64bd268.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 40 {}) _lpython_main_program [] [(SubroutineCall 1 test_hex () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_hex: (Subroutine (SymbolTable 2 {hex: (ExternalSymbol 2 hex 4 hex lpython_builtin [] hex Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_hex [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0x22" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "-0x108b" (Character 1 7 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 hex () [((ConstantInteger 34 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0x22" (Character 1 1 () [])) ()) Eq (ConstantString "0x22" (Character 1 4 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 hex () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0x108b" (Character 1 1 () [])) ()) Eq (ConstantString "-0x108b" (Character 1 7 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_hex () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_hex: (Subroutine (SymbolTable 2 {hex: (ExternalSymbol 2 hex 4 hex lpython_builtin [] hex Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_hex [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0x22" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "-0x108b" (Character 1 7 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 hex () [((ConstantInteger 34 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0x22" (Character 1 1 () [])) ()) Eq (ConstantString "0x22" (Character 1 4 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 hex () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0x108b" (Character 1 1 () [])) ()) Eq (ConstantString "-0x108b" (Character 1 7 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_int-8f88fdc.json b/tests/reference/asr-test_builtin_int-8f88fdc.json index 9d04fcc111..553a729835 100644 --- a/tests/reference/asr-test_builtin_int-8f88fdc.json +++ b/tests/reference/asr-test_builtin_int-8f88fdc.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_int-8f88fdc.stdout", - "stdout_hash": "6d6eb6009a20f6ef7f0d401c9524574bbec1613061c1783c15897260", + "stdout_hash": "8b1ed866ee7d9ba2f1aaf12742086a06dd5065fb5a649f2603383966", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_int-8f88fdc.stdout b/tests/reference/asr-test_builtin_int-8f88fdc.stdout index e4ae3ef3be..6a0e54faa9 100644 --- a/tests/reference/asr-test_builtin_int-8f88fdc.stdout +++ b/tests/reference/asr-test_builtin_int-8f88fdc.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 40 {}) _lpython_main_program [] [(SubroutineCall 1 test_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_int: (Subroutine (SymbolTable 2 {f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), int: (ExternalSymbol 2 int 4 int lpython_builtin [] int Private)}) test_int [] [(= (Var 2 f) (ConstantReal 5.678000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 2 int () [((ConstantReal 5.678000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 f) (UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 2 int () [((UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))))] (Integer 4 []) (ConstantInteger -183745 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 183745 (Integer 4 [])) (Integer 4 []) (ConstantInteger -183745 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 int () [((ConstantReal 5.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 int () [((UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))))] (Integer 4 []) (ConstantInteger -5 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_int: (Subroutine (SymbolTable 2 {f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), int: (ExternalSymbol 2 int 4 int lpython_builtin [] int Private)}) test_int [] [(= (Var 2 f) (ConstantReal 5.678000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 2 int () [((ConstantReal 5.678000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 f) (UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 2 int () [((UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))))] (Integer 4 []) (ConstantInteger -183745 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 183745 (Integer 4 [])) (Integer 4 []) (ConstantInteger -183745 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 int () [((ConstantReal 5.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 int () [((UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))))] (Integer 4 []) (ConstantInteger -5 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_len-55b0dec.json b/tests/reference/asr-test_builtin_len-55b0dec.json index 6ec9917e2e..1a88bf13f4 100644 --- a/tests/reference/asr-test_builtin_len-55b0dec.json +++ b/tests/reference/asr-test_builtin_len-55b0dec.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_len-55b0dec.stdout", - "stdout_hash": "acc921d7cb91c805be060ef32385d0333d9bf13d57b09e8b1f1d69b4", + "stdout_hash": "5bf01cdab9956c1f633236fa2f945527e346fc2cc55d340ad0b0c021", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_len-55b0dec.stdout b/tests/reference/asr-test_builtin_len-55b0dec.stdout index 7ef7090459..f27dd79f2c 100644 --- a/tests/reference/asr-test_builtin_len-55b0dec.stdout +++ b/tests/reference/asr-test_builtin_len-55b0dec.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 40 {}) _lpython_main_program [] [(SubroutineCall 1 test_len () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_len: (Subroutine (SymbolTable 2 {len: (ExternalSymbol 2 len 4 len lpython_builtin [] len Private), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_len [] [(= (Var 2 s) (ConstantString "abcd" (Character 1 4 () [])) ()) (Assert (Compare (FunctionCall 2 len () [((Var 2 s))] (Integer 4 []) () ()) Eq (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (ConstantString "" (Character 1 0 () [])) ()) (Assert (Compare (FunctionCall 2 len () [((Var 2 s))] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 len () [((ConstantString "abcd" (Character 1 4 () [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) Eq (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 len () [((ConstantString "" (Character 1 0 () [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_len () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_len: (Subroutine (SymbolTable 2 {len: (ExternalSymbol 2 len 4 len lpython_builtin [] len Private), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_len [] [(= (Var 2 s) (ConstantString "abcd" (Character 1 4 () [])) ()) (Assert (Compare (FunctionCall 2 len () [((Var 2 s))] (Integer 4 []) () ()) Eq (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (ConstantString "" (Character 1 0 () [])) ()) (Assert (Compare (FunctionCall 2 len () [((Var 2 s))] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 len () [((ConstantString "abcd" (Character 1 4 () [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) Eq (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 len () [((ConstantString "" (Character 1 0 () [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_oct-20b9066.json b/tests/reference/asr-test_builtin_oct-20b9066.json index 494dce3e4b..8193eca911 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": "29f2f57515ea6f05ea1d16f1c8b3902252825e59eb3cc3258b70c6c1", + "stdout_hash": "2054e85ddbf4b6aaae431fa61726c3028d4f6f47b3c4a7b59221cd13", "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 d32d1706b7..8bc9dfd946 100644 --- a/tests/reference/asr-test_builtin_oct-20b9066.stdout +++ b/tests/reference/asr-test_builtin_oct-20b9066.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 40 {}) _lpython_main_program [] [(SubroutineCall 1 test_oct () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_oct: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), oct: (ExternalSymbol 2 oct 4 oct lpython_builtin [] oct Private)}) test_oct [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0o42" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "-0o10213" (Character 1 8 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 oct () [((ConstantInteger 34 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0o42" (Character 1 1 () [])) ()) Eq (ConstantString "0o42" (Character 1 4 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 oct () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0o10213" (Character 1 1 () [])) ()) Eq (ConstantString "-0o10213" (Character 1 8 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_oct () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_oct: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), oct: (ExternalSymbol 2 oct 4 oct lpython_builtin [] oct Private)}) test_oct [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0o42" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "-0o10213" (Character 1 8 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 oct () [((ConstantInteger 34 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0o42" (Character 1 1 () [])) ()) Eq (ConstantString "0o42" (Character 1 4 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 oct () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0o10213" (Character 1 1 () [])) ()) Eq (ConstantString "-0o10213" (Character 1 8 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.json b/tests/reference/asr-test_builtin_pow-f02fcda.json index 87cf7b0ef6..0f2649d1c4 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": "cd63e77690c3a691faf6f151da2643308ce65ea2bda42d7b47214ba4", + "stdout_hash": "4fbc86c5370e9975f6f0240b7cf5313db21cba8d3d78e2c4d425a801", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.stdout b/tests/reference/asr-test_builtin_pow-f02fcda.stdout index 1b0fefe0d2..bbbc0c8d77 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.stdout +++ b/tests/reference/asr-test_builtin_pow-f02fcda.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 40 {}) _lpython_main_program [] [(SubroutineCall 1 test_pow () [] ())] Source Public Implementation () .false. .false.), abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 4 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), pow@__lpython_overloaded_0__pow: (ExternalSymbol 1 pow@__lpython_overloaded_0__pow 4 __lpython_overloaded_0__pow lpython_builtin [] __lpython_overloaded_0__pow Public), pow@__lpython_overloaded_1__pow: (ExternalSymbol 1 pow@__lpython_overloaded_1__pow 4 __lpython_overloaded_1__pow lpython_builtin [] __lpython_overloaded_1__pow Public), pow@__lpython_overloaded_2__pow: (ExternalSymbol 1 pow@__lpython_overloaded_2__pow 4 __lpython_overloaded_2__pow lpython_builtin [] __lpython_overloaded_2__pow Public), pow@__lpython_overloaded_3__pow: (ExternalSymbol 1 pow@__lpython_overloaded_3__pow 4 __lpython_overloaded_3__pow lpython_builtin [] __lpython_overloaded_3__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a1: (Variable 2 a1 Local () () Default (Real 8 []) Source Public Required .false.), a2: (Variable 2 a2 Local () () Default (Real 8 []) Source Public Required .false.), abs: (ExternalSymbol 2 abs 4 abs lpython_builtin [] abs Private), b: (Variable 2 b Local () () Default (Integer 4 []) Source Public Required .false.), eps: (Variable 2 eps Local () () Default (Real 8 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () () Default (Real 8 []) Source Public Required .false.)}) test_pow [] [(= (Var 2 eps) (ConstantReal 0.000000 (Real 8 [])) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 32 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 6 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 3 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 216 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) ()) (Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ())]) (= (Var 2 a) (ConstantInteger 6 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))) ()) (Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ())]) (= (Var 2 a1) (ConstantReal 4.500000 (Real 8 [])) ()) (= (Var 2 a2) (ConstantReal 2.300000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 a1)) ((Var 2 a2))] (Real 8 []) () ()) Sub (ConstantReal 31.797193 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 a2)) ((Var 2 a1))] (Real 8 []) () ()) Sub (ConstantReal 42.439989 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (= (Var 2 x) (ConstantInteger 3 (Integer 4 [])) ()) (= (Var 2 y) (ConstantReal 2.300000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 x)) ((Var 2 y))] (Real 8 []) () ()) Sub (ConstantReal 12.513503 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((Var 2 y)) ((Var 2 x))] (Real 8 []) () ()) Sub (ConstantReal 12.167000 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 x)) ((ConstantReal 5.500000 (Real 8 [])))] (Real 8 []) () ()) Sub (ConstantReal 420.888346 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Integer 4 []) (ConstantReal 0.500000 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.500000 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 6 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))))] (Integer 4 []) (ConstantReal 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.000772 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 [])))) ((UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))))] (Integer 4 []) (ConstantReal -0.004115 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Add (ConstantReal 0.004115 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 6 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))))] (Integer 4 []) (ConstantReal 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.000772 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((ConstantReal 4.500000 (Real 8 []))) ((ConstantReal 2.300000 (Real 8 [])))] (Real 8 []) (ConstantReal 31.797193 (Real 8 [])) ()) Sub (ConstantReal 31.797193 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((ConstantReal 2.300000 (Real 8 []))) ((ConstantReal 0.000000 (Real 8 [])))] (Real 8 []) (ConstantReal 1.000000 (Real 8 [])) ()) Sub (ConstantReal 1.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((ConstantReal 2.300000 (Real 8 []))) ((UnaryOp USub (ConstantReal 1.500000 (Real 8 [])) (Real 8 []) (ConstantReal -1.500000 (Real 8 []))))] (Real 8 []) (ConstantReal 0.286687 (Real 8 [])) ()) Sub (ConstantReal 0.286687 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((ConstantReal 3.400000 (Real 8 [])))] (Real 8 []) (ConstantReal 10.556063 (Real 8 [])) ()) Sub (ConstantReal 10.556063 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((UnaryOp USub (ConstantReal 3.400000 (Real 8 [])) (Real 8 []) (ConstantReal -3.400000 (Real 8 []))))] (Real 8 []) (ConstantReal 0.094732 (Real 8 [])) ()) Sub (ConstantReal 0.094732 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((ConstantReal 3.400000 (Real 8 []))) ((ConstantInteger 9 (Integer 4 [])))] (Real 8 []) (ConstantReal 60716.992766 (Real 8 [])) ()) Sub (ConstantReal 60716.992766 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((ConstantReal 0.000000 (Real 8 []))) ((ConstantInteger 53 (Integer 4 [])))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Sub (ConstantReal 0.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Integer 4 []) (ConstantInteger 16 (Integer 4 [])) ()) Eq (ConstantInteger 16 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])))) ((ConstantInteger 52 (Integer 4 [])))] (Real 8 []) (ConstantReal 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) ()) Sub (ConstantReal 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_pow () [] ())] Source Public Implementation () .false. .false.), abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 4 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), pow@__lpython_overloaded_0__pow: (ExternalSymbol 1 pow@__lpython_overloaded_0__pow 4 __lpython_overloaded_0__pow lpython_builtin [] __lpython_overloaded_0__pow Public), pow@__lpython_overloaded_1__pow: (ExternalSymbol 1 pow@__lpython_overloaded_1__pow 4 __lpython_overloaded_1__pow lpython_builtin [] __lpython_overloaded_1__pow Public), pow@__lpython_overloaded_2__pow: (ExternalSymbol 1 pow@__lpython_overloaded_2__pow 4 __lpython_overloaded_2__pow lpython_builtin [] __lpython_overloaded_2__pow Public), pow@__lpython_overloaded_3__pow: (ExternalSymbol 1 pow@__lpython_overloaded_3__pow 4 __lpython_overloaded_3__pow lpython_builtin [] __lpython_overloaded_3__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a1: (Variable 2 a1 Local () () Default (Real 8 []) Source Public Required .false.), a2: (Variable 2 a2 Local () () Default (Real 8 []) Source Public Required .false.), abs: (ExternalSymbol 2 abs 4 abs lpython_builtin [] abs Private), b: (Variable 2 b Local () () Default (Integer 4 []) Source Public Required .false.), eps: (Variable 2 eps Local () () Default (Real 8 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () () Default (Real 8 []) Source Public Required .false.)}) test_pow [] [(= (Var 2 eps) (ConstantReal 0.000000 (Real 8 [])) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 32 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 6 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 3 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 216 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) ()) (Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ())]) (= (Var 2 a) (ConstantInteger 6 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))) ()) (Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ())]) (= (Var 2 a1) (ConstantReal 4.500000 (Real 8 [])) ()) (= (Var 2 a2) (ConstantReal 2.300000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 a1)) ((Var 2 a2))] (Real 8 []) () ()) Sub (ConstantReal 31.797193 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 a2)) ((Var 2 a1))] (Real 8 []) () ()) Sub (ConstantReal 42.439989 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (= (Var 2 x) (ConstantInteger 3 (Integer 4 [])) ()) (= (Var 2 y) (ConstantReal 2.300000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 x)) ((Var 2 y))] (Real 8 []) () ()) Sub (ConstantReal 12.513503 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((Var 2 y)) ((Var 2 x))] (Real 8 []) () ()) Sub (ConstantReal 12.167000 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 x)) ((ConstantReal 5.500000 (Real 8 [])))] (Real 8 []) () ()) Sub (ConstantReal 420.888346 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Integer 4 []) (ConstantReal 0.500000 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.500000 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 6 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))))] (Integer 4 []) (ConstantReal 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.000772 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 [])))) ((UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))))] (Integer 4 []) (ConstantReal -0.004115 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Add (ConstantReal 0.004115 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 6 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))))] (Integer 4 []) (ConstantReal 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.000772 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((ConstantReal 4.500000 (Real 8 []))) ((ConstantReal 2.300000 (Real 8 [])))] (Real 8 []) (ConstantReal 31.797193 (Real 8 [])) ()) Sub (ConstantReal 31.797193 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((ConstantReal 2.300000 (Real 8 []))) ((ConstantReal 0.000000 (Real 8 [])))] (Real 8 []) (ConstantReal 1.000000 (Real 8 [])) ()) Sub (ConstantReal 1.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((ConstantReal 2.300000 (Real 8 []))) ((UnaryOp USub (ConstantReal 1.500000 (Real 8 [])) (Real 8 []) (ConstantReal -1.500000 (Real 8 []))))] (Real 8 []) (ConstantReal 0.286687 (Real 8 [])) ()) Sub (ConstantReal 0.286687 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((ConstantReal 3.400000 (Real 8 [])))] (Real 8 []) (ConstantReal 10.556063 (Real 8 [])) ()) Sub (ConstantReal 10.556063 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((UnaryOp USub (ConstantReal 3.400000 (Real 8 [])) (Real 8 []) (ConstantReal -3.400000 (Real 8 []))))] (Real 8 []) (ConstantReal 0.094732 (Real 8 [])) ()) Sub (ConstantReal 0.094732 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((ConstantReal 3.400000 (Real 8 []))) ((ConstantInteger 9 (Integer 4 [])))] (Real 8 []) (ConstantReal 60716.992766 (Real 8 [])) ()) Sub (ConstantReal 60716.992766 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((ConstantReal 0.000000 (Real 8 []))) ((ConstantInteger 53 (Integer 4 [])))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Sub (ConstantReal 0.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Integer 4 []) (ConstantInteger 16 (Integer 4 [])) ()) Eq (ConstantInteger 16 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])))) ((ConstantInteger 52 (Integer 4 [])))] (Real 8 []) (ConstantReal 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) ()) Sub (ConstantReal 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_round-7417a21.json b/tests/reference/asr-test_builtin_round-7417a21.json index e62fcbfa54..e186869bf7 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": "d2ac9cdd8889780c5dadae1482d6ecd7cbb56855876cc4516334f802", + "stdout_hash": "903634376caaadd730605fb3486952538e1f39fe7433d4bf94b681c2", "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 b6d74b5649..790a54bc38 100644 --- a/tests/reference/asr-test_builtin_round-7417a21.stdout +++ b/tests/reference/asr-test_builtin_round-7417a21.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 40 {}) _lpython_main_program [] [(SubroutineCall 1 test_round () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), round@__lpython_overloaded_0__round: (ExternalSymbol 1 round@__lpython_overloaded_0__round 4 __lpython_overloaded_0__round lpython_builtin [] __lpython_overloaded_0__round Public), round@__lpython_overloaded_1__round: (ExternalSymbol 1 round@__lpython_overloaded_1__round 4 __lpython_overloaded_1__round lpython_builtin [] __lpython_overloaded_1__round Public), round@__lpython_overloaded_2__round: (ExternalSymbol 1 round@__lpython_overloaded_2__round 4 __lpython_overloaded_2__round lpython_builtin [] __lpython_overloaded_2__round Public), test_round: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), round: (ExternalSymbol 2 round 4 round lpython_builtin [] round Private)}) test_round [] [(= (Var 2 f) (ConstantReal 5.678000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 44.340000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 0.500000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (UnaryOp USub (ConstantReal 50.500000 (Real 8 [])) (Real 8 []) (ConstantReal -50.500000 (Real 8 []))) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 1.500000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 13.001000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 13 (Integer 4 [])) ()) Eq (ConstantInteger 13 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (ConstantReal 40.499990 (Real 8 [])) (Real 8 []) (ConstantReal -40.499990 (Real 8 []))))] (Integer 4 []) (ConstantInteger -40 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 40 (Integer 4 [])) (Integer 4 []) (ConstantInteger -40 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 0.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (ConstantReal 0.500000 (Real 8 [])) (Real 8 []) (ConstantReal -0.500000 (Real 8 []))))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 1.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 2 (Integer 4 [])) ()) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 50.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 50 (Integer 4 [])) ()) Eq (ConstantInteger 50 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 56.780000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 57 (Integer 4 [])) ()) Eq (ConstantInteger 57 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((Var 2 i))] (Integer 8 []) () ()) Eq (ImplicitCast (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((ConstantInteger 4 (Integer 4 [])))] (Integer 8 []) (ConstantInteger 4 (Integer 4 [])) ()) Eq (ImplicitCast (ConstantInteger 4 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((ConstantLogical .false. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_round () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), round@__lpython_overloaded_0__round: (ExternalSymbol 1 round@__lpython_overloaded_0__round 4 __lpython_overloaded_0__round lpython_builtin [] __lpython_overloaded_0__round Public), round@__lpython_overloaded_1__round: (ExternalSymbol 1 round@__lpython_overloaded_1__round 4 __lpython_overloaded_1__round lpython_builtin [] __lpython_overloaded_1__round Public), round@__lpython_overloaded_2__round: (ExternalSymbol 1 round@__lpython_overloaded_2__round 4 __lpython_overloaded_2__round lpython_builtin [] __lpython_overloaded_2__round Public), test_round: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), round: (ExternalSymbol 2 round 4 round lpython_builtin [] round Private)}) test_round [] [(= (Var 2 f) (ConstantReal 5.678000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 44.340000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 0.500000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (UnaryOp USub (ConstantReal 50.500000 (Real 8 [])) (Real 8 []) (ConstantReal -50.500000 (Real 8 []))) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 1.500000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 13.001000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 13 (Integer 4 [])) ()) Eq (ConstantInteger 13 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (ConstantReal 40.499990 (Real 8 [])) (Real 8 []) (ConstantReal -40.499990 (Real 8 []))))] (Integer 4 []) (ConstantInteger -40 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 40 (Integer 4 [])) (Integer 4 []) (ConstantInteger -40 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 0.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (ConstantReal 0.500000 (Real 8 [])) (Real 8 []) (ConstantReal -0.500000 (Real 8 []))))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 1.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 2 (Integer 4 [])) ()) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 50.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 50 (Integer 4 [])) ()) Eq (ConstantInteger 50 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 56.780000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 57 (Integer 4 [])) ()) Eq (ConstantInteger 57 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((Var 2 i))] (Integer 8 []) () ()) Eq (ImplicitCast (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((ConstantInteger 4 (Integer 4 [])))] (Integer 8 []) (ConstantInteger 4 (Integer 4 [])) ()) Eq (ImplicitCast (ConstantInteger 4 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((ConstantLogical .false. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_str-580e920.json b/tests/reference/asr-test_builtin_str-580e920.json index 2746ceb76d..bad16709e2 100644 --- a/tests/reference/asr-test_builtin_str-580e920.json +++ b/tests/reference/asr-test_builtin_str-580e920.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_str-580e920.stdout", - "stdout_hash": "6577d01ed5cd25461c8bfe4f5422dd040c5f0a73d9fabfa1ce875961", + "stdout_hash": "3790372d01befc729dd9686ce053d5ff77f53e819b74913b449f4a18", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_str-580e920.stdout b/tests/reference/asr-test_builtin_str-580e920.stdout index eef5f98895..aa64ba6f2c 100644 --- a/tests/reference/asr-test_builtin_str-580e920.stdout +++ b/tests/reference/asr-test_builtin_str-580e920.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 40 {}) _lpython_main_program [] [(SubroutineCall 1 test_str_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 39 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_str_int: (Subroutine (SymbolTable 2 {s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), str: (ExternalSymbol 2 str 4 str lpython_builtin [] str Private)}) test_str_int [] [(= (Var 2 s) (FunctionCall 2 str () [((ConstantInteger 356 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "356" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (ConstantString "356" (Character 1 3 () [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (FunctionCall 2 str () [((UnaryOp USub (ConstantInteger 567 (Integer 4 [])) (Integer 4 []) (ConstantInteger -567 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-567" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (ConstantString "-567" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 str () [((ConstantInteger 4 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "4" (Character 1 1 () [])) ()) Eq (ConstantString "4" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 str () [((UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-5" (Character 1 1 () [])) ()) Eq (ConstantString "-5" (Character 1 2 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_str_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_str_int: (Subroutine (SymbolTable 2 {s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), str: (ExternalSymbol 2 str 4 str lpython_builtin [] str Private)}) test_str_int [] [(= (Var 2 s) (FunctionCall 2 str () [((ConstantInteger 356 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "356" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (ConstantString "356" (Character 1 3 () [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (FunctionCall 2 str () [((UnaryOp USub (ConstantInteger 567 (Integer 4 [])) (Integer 4 []) (ConstantInteger -567 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-567" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (ConstantString "-567" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 str () [((ConstantInteger 4 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "4" (Character 1 1 () [])) ()) Eq (ConstantString "4" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 str () [((UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-5" (Character 1 1 () [])) ()) Eq (ConstantString "-5" (Character 1 2 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) From f2bd0bcd101a4c04a94310122ceed45765db4924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Wed, 23 Mar 2022 09:47:51 -0600 Subject: [PATCH 06/10] Implement _imag using bind(c) --- src/runtime/lpython_builtin.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index e91deaa3dc..bf53a7bbb2 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -289,11 +289,19 @@ def lbound(x: i32[:], dim: i32) -> i32: def ubound(x: i32[:], dim: i32) -> i32: pass +@ccall +def _lfortran_caimag(x: c32) -> f32: + pass + +@ccall +def _lfortran_zaimag(x: c64) -> f64: + pass +# TODO: rename to _lpython_imag() @overload def _imag(x: c64) -> f64: - pass + return _lfortran_zaimag(x) @overload def _imag(x: c32) -> f32: - pass + return _lfortran_caimag(x) From 8803c7c007dfb651635c1d23299e8d449912f13a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Wed, 23 Mar 2022 10:06:30 -0600 Subject: [PATCH 07/10] LLVM: Move the bind(c) check up --- src/libasr/codegen/asr_to_llvm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libasr/codegen/asr_to_llvm.cpp b/src/libasr/codegen/asr_to_llvm.cpp index a85513ae55..3b1ac00b87 100644 --- a/src/libasr/codegen/asr_to_llvm.cpp +++ b/src/libasr/codegen/asr_to_llvm.cpp @@ -4032,6 +4032,8 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor throw CodeGenError("Function LFortran interfaces not implemented yet"); } else if (s->m_abi == ASR::abiType::Interactive) { h = get_hash((ASR::asr_t*)s); + } else if (s->m_abi == ASR::abiType::BindC) { + h = get_hash((ASR::asr_t*)s); } else if (s->m_abi == ASR::abiType::Intrinsic || intrinsic_function) { std::string func_name = s->m_name; if( fname2arg_type.find(func_name) != fname2arg_type.end() ) { @@ -4049,8 +4051,6 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor h = get_hash((ASR::asr_t*)s); } } - } else if (s->m_abi == ASR::abiType::BindC) { - h = get_hash((ASR::asr_t*)s); } else { throw CodeGenError("ABI type not implemented yet."); } From 3819ae7894d7c84d942398ab61ae71b9c00b88b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Wed, 23 Mar 2022 10:06:50 -0600 Subject: [PATCH 08/10] AST->ASR: do not mark bind(c) fns as intrinsic --- src/lpython/semantics/python_ast_to_asr.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 116459abfe..84e16dde77 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -154,7 +154,9 @@ ASR::Module_t* load_module(Allocator &al, SymbolTable *symtab, for (auto &item : mod2->m_symtab->scope) { if (ASR::is_a(*item.second)) { ASR::Subroutine_t *s = ASR::down_cast(item.second); - s->m_abi = ASR::abiType::Intrinsic; + if (s->m_abi == ASR::abiType::Source) { + s->m_abi = ASR::abiType::Intrinsic; + } if (s->n_body == 0) { std::string name = s->m_name; if (name == "ubound" || name == "lbound") { @@ -164,7 +166,9 @@ ASR::Module_t* load_module(Allocator &al, SymbolTable *symtab, } if (ASR::is_a(*item.second)) { ASR::Function_t *s = ASR::down_cast(item.second); - s->m_abi = ASR::abiType::Intrinsic; + if (s->m_abi == ASR::abiType::Source) { + s->m_abi = ASR::abiType::Intrinsic; + } if (s->n_body == 0) { std::string name = s->m_name; if (name == "ubound" || name == "lbound") { From 43c674130ea8237c6ce4b32cf2a3f08124ba3937 Mon Sep 17 00:00:00 2001 From: Smit-create Date: Thu, 24 Mar 2022 10:38:55 +0530 Subject: [PATCH 09/10] Update tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Ondřej Čertík --- tests/reference/asr-complex1-f26c460.json | 2 +- tests/reference/asr-complex1-f26c460.stdout | 2 +- tests/reference/asr-constants1-5828e8a.json | 2 +- tests/reference/asr-constants1-5828e8a.stdout | 2 +- tests/reference/asr-expr1-8df2d66.json | 2 +- tests/reference/asr-expr1-8df2d66.stdout | 2 +- 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 | 2 +- tests/reference/asr-expr7-480ba2f.json | 2 +- tests/reference/asr-expr7-480ba2f.stdout | 2 +- tests/reference/asr-test_builtin-aa64615.json | 2 +- tests/reference/asr-test_builtin-aa64615.stdout | 2 +- tests/reference/asr-test_builtin_abs-c74d2c9.json | 2 +- tests/reference/asr-test_builtin_abs-c74d2c9.stdout | 2 +- tests/reference/asr-test_builtin_bin-52ba9fa.json | 2 +- tests/reference/asr-test_builtin_bin-52ba9fa.stdout | 2 +- tests/reference/asr-test_builtin_bool-330223a.json | 2 +- tests/reference/asr-test_builtin_bool-330223a.stdout | 2 +- tests/reference/asr-test_builtin_float-20601dd.json | 2 +- tests/reference/asr-test_builtin_float-20601dd.stdout | 2 +- tests/reference/asr-test_builtin_hex-64bd268.json | 2 +- tests/reference/asr-test_builtin_hex-64bd268.stdout | 2 +- tests/reference/asr-test_builtin_int-8f88fdc.json | 2 +- tests/reference/asr-test_builtin_int-8f88fdc.stdout | 2 +- tests/reference/asr-test_builtin_len-55b0dec.json | 2 +- tests/reference/asr-test_builtin_len-55b0dec.stdout | 2 +- tests/reference/asr-test_builtin_oct-20b9066.json | 2 +- tests/reference/asr-test_builtin_oct-20b9066.stdout | 2 +- tests/reference/asr-test_builtin_pow-f02fcda.json | 2 +- tests/reference/asr-test_builtin_pow-f02fcda.stdout | 2 +- tests/reference/asr-test_builtin_round-7417a21.json | 2 +- tests/reference/asr-test_builtin_round-7417a21.stdout | 2 +- tests/reference/asr-test_builtin_str-580e920.json | 2 +- tests/reference/asr-test_builtin_str-580e920.stdout | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) diff --git a/tests/reference/asr-complex1-f26c460.json b/tests/reference/asr-complex1-f26c460.json index 6ce8710bbb..e4104456eb 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": "44076487f58beb07743ef2fad5b6d08fca64565b71be13e0396da36f", + "stdout_hash": "e0dbbef3bb6240c45acbfb64be1004e16ee9e9d3477097022be1c92a", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex1-f26c460.stdout b/tests/reference/asr-complex1-f26c460.stdout index 5d538850da..c77d25dad5 100644 --- a/tests/reference/asr-complex1-f26c460.stdout +++ b/tests/reference/asr-complex1-f26c460.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 42 {}) main_program [] []), test: (Subroutine (SymbolTable 3 {x: (Variable 3 x Local () () Default (Complex 8 []) Source Public Required .false.), y: (Variable 3 y Local () () Default (Complex 8 []) Source Public Required .false.), z: (Variable 3 z Local () () Default (Complex 4 []) Source Public Required .false.)}) test [] [(= (Var 3 x) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ConstantComplex 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 y) (BinOp (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ConstantComplex 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Mul (Var 3 x) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.), test_complex: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), c2: (Variable 2 c2 Local () () Default (Complex 4 []) Source Public Required .false.), c3: (Variable 2 c3 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 5 complex lpython_builtin [] complex Private)}) test_complex [] [(= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [((ConstantReal 3.400000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [((ConstantReal 5.000000 (Real 8 []))) ((ConstantReal 4.300000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c1) (ImplicitCast (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c2) (ImplicitCast (FunctionCall 2 complex () [((ConstantInteger 2 (Integer 4 []))) ((ConstantReal 4.500000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c3) (FunctionCall 2 complex () [((ConstantReal 3.000000 (Real 8 []))) ((ConstantReal 4.000000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (ImplicitCast (Var 2 c1) ComplexToComplex (Complex 8 []) ()) Eq (Var 2 c3) (Logical 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c1) Add (Var 2 c2) (Complex 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c2) Sub (Var 2 c1) (Complex 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c1) Mul (Var 2 c2) (Complex 4 []) () ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 2 complex () [((ConstantReal 3.345340 (Real 8 []))) ((ConstantReal 4.867868 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 0.015553 0.065561 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex -5.000000 10.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [((ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 5 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 1.000000 1.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 44 {}) main_program [] []), test: (Subroutine (SymbolTable 3 {x: (Variable 3 x Local () () Default (Complex 8 []) Source Public Required .false.), y: (Variable 3 y Local () () Default (Complex 8 []) Source Public Required .false.), z: (Variable 3 z Local () () Default (Complex 4 []) Source Public Required .false.)}) test [] [(= (Var 3 x) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ConstantComplex 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 y) (BinOp (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ConstantComplex 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Mul (Var 3 x) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.), test_complex: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), c2: (Variable 2 c2 Local () () Default (Complex 4 []) Source Public Required .false.), c3: (Variable 2 c3 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 5 complex lpython_builtin [] complex Private)}) test_complex [] [(= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [((ConstantReal 3.400000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [((ConstantReal 5.000000 (Real 8 []))) ((ConstantReal 4.300000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c1) (ImplicitCast (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c2) (ImplicitCast (FunctionCall 2 complex () [((ConstantInteger 2 (Integer 4 []))) ((ConstantReal 4.500000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c3) (FunctionCall 2 complex () [((ConstantReal 3.000000 (Real 8 []))) ((ConstantReal 4.000000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (ImplicitCast (Var 2 c1) ComplexToComplex (Complex 8 []) ()) Eq (Var 2 c3) (Logical 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c1) Add (Var 2 c2) (Complex 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c2) Sub (Var 2 c1) (Complex 4 []) () ()) ()) (= (Var 2 c) (BinOp (Var 2 c1) Mul (Var 2 c2) (Complex 4 []) () ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 2 complex () [((ConstantReal 3.345340 (Real 8 []))) ((ConstantReal 4.867868 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 0.015553 0.065561 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex -5.000000 10.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (BinOp (FunctionCall 2 complex () [((ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 5 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 1.000000 1.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-constants1-5828e8a.json b/tests/reference/asr-constants1-5828e8a.json index 6ea6156bdd..ab94d2d90a 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": "a7463dede7083fa2339cafab09fb64ea15670ca36fc7ad64a48c7d21", + "stdout_hash": "e19e1e08674cdb1ce0690b9e58003c0c620a559384550649d774ad32", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-constants1-5828e8a.stdout b/tests/reference/asr-constants1-5828e8a.stdout index 70d9af4aed..bd35b4de47 100644 --- a/tests/reference/asr-constants1-5828e8a.stdout +++ b/tests/reference/asr-constants1-5828e8a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 13 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), abs@__lpython_overloaded_2__abs: (ExternalSymbol 1 abs@__lpython_overloaded_2__abs 13 __lpython_overloaded_2__abs lpython_builtin [] __lpython_overloaded_2__abs Public), abs@__lpython_overloaded_3__abs: (ExternalSymbol 1 abs@__lpython_overloaded_3__abs 13 __lpython_overloaded_3__abs lpython_builtin [] __lpython_overloaded_3__abs Public), abs@__lpython_overloaded_5__abs: (ExternalSymbol 1 abs@__lpython_overloaded_5__abs 13 __lpython_overloaded_5__abs lpython_builtin [] __lpython_overloaded_5__abs Public), bool@__lpython_overloaded_0__bool: (ExternalSymbol 1 bool@__lpython_overloaded_0__bool 13 __lpython_overloaded_0__bool lpython_builtin [] __lpython_overloaded_0__bool Public), bool@__lpython_overloaded_3__bool: (ExternalSymbol 1 bool@__lpython_overloaded_3__bool 13 __lpython_overloaded_3__bool lpython_builtin [] __lpython_overloaded_3__bool Public), bool@__lpython_overloaded_4__bool: (ExternalSymbol 1 bool@__lpython_overloaded_4__bool 13 __lpython_overloaded_4__bool lpython_builtin [] __lpython_overloaded_4__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 13 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 50 {}) main_program [] []), test_abs: (Subroutine (SymbolTable 4 {a: (Variable 4 a Local () () Default (Integer 4 []) Source Public Required .false.), abs: (ExternalSymbol 4 abs 13 abs lpython_builtin [] abs Private), b: (Variable 4 b Local () () Default (Real 4 []) Source Public Required .false.), complex: (ExternalSymbol 4 complex 13 complex lpython_builtin [] complex Private)}) test_abs [] [(= (Var 4 a) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_2__abs 4 abs [((ConstantInteger 5 (Integer 4 [])))] (Integer 8 []) (ConstantInteger 5 (Integer 4 [])) ()) IntegerToInteger (Integer 4 []) ()) ()) (= (Var 4 a) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_2__abs 4 abs [((UnaryOp USub (ConstantInteger 500 (Integer 4 [])) (Integer 4 []) (ConstantInteger -500 (Integer 4 []))))] (Integer 8 []) (ConstantInteger 500 (Integer 4 [])) ()) IntegerToInteger (Integer 4 []) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_3__abs 4 abs [((ConstantLogical .false. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_3__abs 4 abs [((ConstantLogical .true. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((ConstantReal 3.450000 (Real 8 [])))] (Real 8 []) (ConstantReal 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((UnaryOp USub (ConstantReal 5346.340000 (Real 8 [])) (Real 8 []) (ConstantReal -5346.340000 (Real 8 []))))] (Real 8 []) (ConstantReal 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_5__abs 4 abs [((FunctionCall 4 complex () [((ConstantReal 3.450000 (Real 8 []))) ((ConstantReal 5.600000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.450000 5.600000 (Complex 8 [])) ()))] (Real 8 []) (ConstantReal 6.577424 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ())] Source Public Implementation () .false. .false.), test_bool: (Subroutine (SymbolTable 6 {a: (Variable 6 a Local () () Default (Logical 1 []) Source Public Required .false.), bool: (ExternalSymbol 6 bool 13 bool lpython_builtin [] bool Private), complex: (ExternalSymbol 6 complex 13 complex lpython_builtin [] complex Private)}) test_bool [] [(= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((ConstantInteger 0 (Integer 4 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_4__bool 6 bool [((ConstantString "" (Character 1 0 () [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_7__bool 6 bool [((FunctionCall 6 complex () [((ConstantInteger 0 (Integer 4 []))) ((ConstantInteger 0 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_4__bool 6 bool [((ConstantString "t" (Character 1 1 () [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_3__bool 6 bool [((ConstantReal 2.300000 (Real 8 [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_boz: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Character 1 -2 () []) Source Public Required .false.), bin: (ExternalSymbol 2 bin 13 bin lpython_builtin [] bin Private), hex: (ExternalSymbol 2 hex 13 hex lpython_builtin [] hex Private), oct: (ExternalSymbol 2 oct 13 oct lpython_builtin [] oct Private)}) test_boz [] [(= (Var 2 b) (FunctionCall 2 bin () [((ConstantInteger 5 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((ConstantInteger 64 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((ConstantInteger 8 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((ConstantInteger 56 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((ConstantInteger 42 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((ConstantInteger 12648430 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0x216" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.), test_callable: (Subroutine (SymbolTable 8 {a: (Variable 8 a Local () () Default (Logical 1 []) Source Public Required .false.), b: (Variable 8 b Local () () Default (Integer 4 []) Source Public Required .false.)}) test_callable [] [(= (Var 8 b) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 8 a) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_divmod: (Subroutine (SymbolTable 11 {a: (Variable 11 a Local () () Default (Tuple [(Integer 4 []) (Integer 4 [])]) Source Public Required .false.), divmod: (ExternalSymbol 11 divmod 13 divmod lpython_builtin [] divmod Private)}) test_divmod [] [(= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 9 (Integer 4 []))) ((ConstantInteger 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 9 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 []))))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger -3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 0 (Integer 4 []))) ((ConstantInteger 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ())] Source Public Implementation () .false. .false.), test_float: (Subroutine (SymbolTable 10 {a: (Variable 10 a Local () () Default (Real 8 []) Source Public Required .false.), float: (ExternalSymbol 10 float 13 float lpython_builtin [] float Private)}) test_float [] [(= (Var 10 a) (FunctionCall 10 float () [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantReal 4.560000 (Real 8 [])))] (Real 8 []) (ConstantReal 4.560000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantInteger 5 (Integer 4 [])))] (Real 8 []) (ConstantReal 5.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Real 8 []) (ConstantReal -1.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantLogical .true. (Logical 1 [])))] (Real 8 []) (ConstantReal 1.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantLogical .false. (Logical 1 [])))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantString "5346" (Character 1 4 () [])))] (Real 8 []) (ConstantReal 5346.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantString "423.534" (Character 1 7 () [])))] (Real 8 []) (ConstantReal 423.533997 (Real 8 [])) ()) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.), int: (ExternalSymbol 9 int 13 int lpython_builtin [] int Private)}) test_int [] [(= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantReal 4.560000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantInteger 5 (Integer 4 [])))] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((UnaryOp USub (ConstantReal 5.000010 (Real 8 [])) (Real 8 []) (ConstantReal -5.000010 (Real 8 []))))] (Integer 4 []) (ConstantInteger -5 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantLogical .true. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 1 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantLogical .false. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantString "5346" (Character 1 4 () [])))] (Integer 4 []) (ConstantInteger 5346 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ())] Source Public Implementation () .false. .false.), test_len: (Subroutine (SymbolTable 5 {a: (Variable 5 a Local () () Default (Integer 4 []) Source Public Required .false.), len: (ExternalSymbol 5 len 13 len lpython_builtin [] len Private)}) test_len [] [(= (Var 5 a) (FunctionCall 5 len () [((ConstantString "" (Character 1 0 () [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [((ConstantString "test" (Character 1 4 () [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [((ConstantString "this is a test" (Character 1 14 () [])))] (Integer 4 []) (ConstantInteger 14 (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_ord_chr: (Subroutine (SymbolTable 3 {a: (Variable 3 a Local () () Default (Integer 4 []) Source Public Required .false.), chr: (ExternalSymbol 3 chr 13 chr lpython_builtin [] chr Private), ord: (ExternalSymbol 3 ord 13 ord lpython_builtin [] ord Private), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord_chr [] [(= (Var 3 a) (FunctionCall 3 ord () [((ConstantString "5" (Character 1 1 () [])))] (Integer 4 []) (ConstantInteger 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [((ConstantInteger 43 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "+" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.), test_str: (Subroutine (SymbolTable 7 {s: (Variable 7 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), str: (ExternalSymbol 7 str 13 str lpython_builtin [] str Private)}) test_str [] [(= (Var 7 s) (FunctionCall 7 str () [] (Character 1 -2 () []) (ConstantString "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantInteger 5 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantReal 5.600000 (Real 8 [])))] (Character 1 -2 () []) (ConstantString "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantLogical .true. (Logical 1 [])))] (Character 1 -2 () []) (ConstantString "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantLogical .false. (Logical 1 [])))] (Character 1 -2 () []) (ConstantString "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantString "5346" (Character 1 4 () [])))] (Character 1 -2 () []) (ConstantString "5346" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 13 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), abs@__lpython_overloaded_2__abs: (ExternalSymbol 1 abs@__lpython_overloaded_2__abs 13 __lpython_overloaded_2__abs lpython_builtin [] __lpython_overloaded_2__abs Public), abs@__lpython_overloaded_3__abs: (ExternalSymbol 1 abs@__lpython_overloaded_3__abs 13 __lpython_overloaded_3__abs lpython_builtin [] __lpython_overloaded_3__abs Public), abs@__lpython_overloaded_5__abs: (ExternalSymbol 1 abs@__lpython_overloaded_5__abs 13 __lpython_overloaded_5__abs lpython_builtin [] __lpython_overloaded_5__abs Public), bool@__lpython_overloaded_0__bool: (ExternalSymbol 1 bool@__lpython_overloaded_0__bool 13 __lpython_overloaded_0__bool lpython_builtin [] __lpython_overloaded_0__bool Public), bool@__lpython_overloaded_3__bool: (ExternalSymbol 1 bool@__lpython_overloaded_3__bool 13 __lpython_overloaded_3__bool lpython_builtin [] __lpython_overloaded_3__bool Public), bool@__lpython_overloaded_4__bool: (ExternalSymbol 1 bool@__lpython_overloaded_4__bool 13 __lpython_overloaded_4__bool lpython_builtin [] __lpython_overloaded_4__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 13 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 52 {}) main_program [] []), test_abs: (Subroutine (SymbolTable 4 {a: (Variable 4 a Local () () Default (Integer 4 []) Source Public Required .false.), abs: (ExternalSymbol 4 abs 13 abs lpython_builtin [] abs Private), b: (Variable 4 b Local () () Default (Real 4 []) Source Public Required .false.), complex: (ExternalSymbol 4 complex 13 complex lpython_builtin [] complex Private)}) test_abs [] [(= (Var 4 a) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_2__abs 4 abs [((ConstantInteger 5 (Integer 4 [])))] (Integer 8 []) (ConstantInteger 5 (Integer 4 [])) ()) IntegerToInteger (Integer 4 []) ()) ()) (= (Var 4 a) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_2__abs 4 abs [((UnaryOp USub (ConstantInteger 500 (Integer 4 [])) (Integer 4 []) (ConstantInteger -500 (Integer 4 []))))] (Integer 8 []) (ConstantInteger 500 (Integer 4 [])) ()) IntegerToInteger (Integer 4 []) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_3__abs 4 abs [((ConstantLogical .false. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_3__abs 4 abs [((ConstantLogical .true. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((ConstantReal 3.450000 (Real 8 [])))] (Real 8 []) (ConstantReal 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((UnaryOp USub (ConstantReal 5346.340000 (Real 8 [])) (Real 8 []) (ConstantReal -5346.340000 (Real 8 []))))] (Real 8 []) (ConstantReal 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_5__abs 4 abs [((FunctionCall 4 complex () [((ConstantReal 3.450000 (Real 8 []))) ((ConstantReal 5.600000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.450000 5.600000 (Complex 8 [])) ()))] (Real 8 []) (ConstantReal 6.577424 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ())] Source Public Implementation () .false. .false.), test_bool: (Subroutine (SymbolTable 6 {a: (Variable 6 a Local () () Default (Logical 1 []) Source Public Required .false.), bool: (ExternalSymbol 6 bool 13 bool lpython_builtin [] bool Private), complex: (ExternalSymbol 6 complex 13 complex lpython_builtin [] complex Private)}) test_bool [] [(= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((ConstantInteger 0 (Integer 4 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_4__bool 6 bool [((ConstantString "" (Character 1 0 () [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_7__bool 6 bool [((FunctionCall 6 complex () [((ConstantInteger 0 (Integer 4 []))) ((ConstantInteger 0 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_4__bool 6 bool [((ConstantString "t" (Character 1 1 () [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_3__bool 6 bool [((ConstantReal 2.300000 (Real 8 [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_boz: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Character 1 -2 () []) Source Public Required .false.), bin: (ExternalSymbol 2 bin 13 bin lpython_builtin [] bin Private), hex: (ExternalSymbol 2 hex 13 hex lpython_builtin [] hex Private), oct: (ExternalSymbol 2 oct 13 oct lpython_builtin [] oct Private)}) test_boz [] [(= (Var 2 b) (FunctionCall 2 bin () [((ConstantInteger 5 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((ConstantInteger 64 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((ConstantInteger 8 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((ConstantInteger 56 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((ConstantInteger 42 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((ConstantInteger 12648430 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0x216" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.), test_callable: (Subroutine (SymbolTable 8 {a: (Variable 8 a Local () () Default (Logical 1 []) Source Public Required .false.), b: (Variable 8 b Local () () Default (Integer 4 []) Source Public Required .false.)}) test_callable [] [(= (Var 8 b) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 8 a) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_divmod: (Subroutine (SymbolTable 11 {a: (Variable 11 a Local () () Default (Tuple [(Integer 4 []) (Integer 4 [])]) Source Public Required .false.), divmod: (ExternalSymbol 11 divmod 13 divmod lpython_builtin [] divmod Private)}) test_divmod [] [(= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 9 (Integer 4 []))) ((ConstantInteger 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 9 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 []))))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger -3 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((ConstantInteger 0 (Integer 4 []))) ((ConstantInteger 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (ConstantTuple [(ConstantInteger 0 (Integer 4 [])) (ConstantInteger 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ())] Source Public Implementation () .false. .false.), test_float: (Subroutine (SymbolTable 10 {a: (Variable 10 a Local () () Default (Real 8 []) Source Public Required .false.), float: (ExternalSymbol 10 float 13 float lpython_builtin [] float Private)}) test_float [] [(= (Var 10 a) (FunctionCall 10 float () [] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantReal 4.560000 (Real 8 [])))] (Real 8 []) (ConstantReal 4.560000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantInteger 5 (Integer 4 [])))] (Real 8 []) (ConstantReal 5.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Real 8 []) (ConstantReal -1.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantLogical .true. (Logical 1 [])))] (Real 8 []) (ConstantReal 1.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantLogical .false. (Logical 1 [])))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantString "5346" (Character 1 4 () [])))] (Real 8 []) (ConstantReal 5346.000000 (Real 8 [])) ()) ()) (= (Var 10 a) (FunctionCall 10 float () [((ConstantString "423.534" (Character 1 7 () [])))] (Real 8 []) (ConstantReal 423.533997 (Real 8 [])) ()) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.), int: (ExternalSymbol 9 int 13 int lpython_builtin [] int Private)}) test_int [] [(= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantReal 4.560000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantInteger 5 (Integer 4 [])))] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((UnaryOp USub (ConstantReal 5.000010 (Real 8 [])) (Real 8 []) (ConstantReal -5.000010 (Real 8 []))))] (Integer 4 []) (ConstantInteger -5 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantLogical .true. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 1 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantLogical .false. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (ImplicitCast (FunctionCall 9 int () [((ConstantString "5346" (Character 1 4 () [])))] (Integer 4 []) (ConstantInteger 5346 (Integer 4 [])) ()) IntegerToInteger (Integer 8 []) ()) ())] Source Public Implementation () .false. .false.), test_len: (Subroutine (SymbolTable 5 {a: (Variable 5 a Local () () Default (Integer 4 []) Source Public Required .false.), len: (ExternalSymbol 5 len 13 len lpython_builtin [] len Private)}) test_len [] [(= (Var 5 a) (FunctionCall 5 len () [((ConstantString "" (Character 1 0 () [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [((ConstantString "test" (Character 1 4 () [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [((ConstantString "this is a test" (Character 1 14 () [])))] (Integer 4 []) (ConstantInteger 14 (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_ord_chr: (Subroutine (SymbolTable 3 {a: (Variable 3 a Local () () Default (Integer 4 []) Source Public Required .false.), chr: (ExternalSymbol 3 chr 13 chr lpython_builtin [] chr Private), ord: (ExternalSymbol 3 ord 13 ord lpython_builtin [] ord Private), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord_chr [] [(= (Var 3 a) (FunctionCall 3 ord () [((ConstantString "5" (Character 1 1 () [])))] (Integer 4 []) (ConstantInteger 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [((ConstantInteger 43 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "+" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.), test_str: (Subroutine (SymbolTable 7 {s: (Variable 7 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), str: (ExternalSymbol 7 str 13 str lpython_builtin [] str Private)}) test_str [] [(= (Var 7 s) (FunctionCall 7 str () [] (Character 1 -2 () []) (ConstantString "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantInteger 5 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantReal 5.600000 (Real 8 [])))] (Character 1 -2 () []) (ConstantString "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantLogical .true. (Logical 1 [])))] (Character 1 -2 () []) (ConstantString "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantLogical .false. (Logical 1 [])))] (Character 1 -2 () []) (ConstantString "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((ConstantString "5346" (Character 1 4 () [])))] (Character 1 -2 () []) (ConstantString "5346" (Character 1 1 () [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-expr1-8df2d66.json b/tests/reference/asr-expr1-8df2d66.json index a8540826ef..6563536fdb 100644 --- a/tests/reference/asr-expr1-8df2d66.json +++ b/tests/reference/asr-expr1-8df2d66.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr1-8df2d66.stdout", - "stdout_hash": "05395701746322a31af12f943c9591d8a4cf78ed45ad6499add52b08", + "stdout_hash": "42d44b32cc27b587ae854f3f6cd28ea214639c57c05feadb3d722bf3", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr1-8df2d66.stdout b/tests/reference/asr-expr1-8df2d66.stdout index 04a9e7f3fe..f95718cf52 100644 --- a/tests/reference/asr-expr1-8df2d66.stdout +++ b/tests/reference/asr-expr1-8df2d66.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] []), test_namedexpr: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 4 ord lpython_builtin [] ord Private), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () () Default (Integer 4 []) Source Public Required .false.)}) test_namedexpr [] [(= (Var 2 x) (NamedExpr (Var 2 y) (ConstantInteger 0 (Integer 4 [])) (Integer 4 [])) ()) (If (NamedExpr (Var 2 a) (FunctionCall 2 ord () [((ConstantString "3" (Character 1 1 () [])))] (Integer 4 []) (ConstantInteger 51 (Integer 4 [])) ()) (Integer 4 [])) [(= (Var 2 x) (ConstantInteger 1 (Integer 4 [])) ())] []) (WhileLoop (NamedExpr (Var 2 a) (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 y) (ConstantInteger 1 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] []), test_namedexpr: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 4 ord lpython_builtin [] ord Private), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () () Default (Integer 4 []) Source Public Required .false.)}) test_namedexpr [] [(= (Var 2 x) (NamedExpr (Var 2 y) (ConstantInteger 0 (Integer 4 [])) (Integer 4 [])) ()) (If (NamedExpr (Var 2 a) (FunctionCall 2 ord () [((ConstantString "3" (Character 1 1 () [])))] (Integer 4 []) (ConstantInteger 51 (Integer 4 [])) ()) (Integer 4 [])) [(= (Var 2 x) (ConstantInteger 1 (Integer 4 [])) ())] []) (WhileLoop (NamedExpr (Var 2 a) (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 y) (ConstantInteger 1 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-expr10-efcbb1b.json b/tests/reference/asr-expr10-efcbb1b.json index afb1442946..208ea1ddf7 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": "602635a2665b93d1c7a5afab4e19b865ab71eab197fca2ac37a44b7d", + "stdout_hash": "dba5b67c3a6cda4efa01f195443ea3cd21a605bb4e062616a69689dd", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr10-efcbb1b.stdout b/tests/reference/asr-expr10-efcbb1b.stdout index 8db4d2b777..b8b459cb17 100644 --- a/tests/reference/asr-expr10-efcbb1b.stdout +++ b/tests/reference/asr-expr10-efcbb1b.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] []), test_UnaryOp: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), b1: (Variable 2 b1 Local () () Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () () Default (Logical 1 []) Source Public Required .false.), b3: (Variable 2 b3 Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private), f: (Variable 2 f Local () () Default (Real 4 []) Source Public Required .false.)}) test_UnaryOp [] [(= (Var 2 a) (UnaryOp UAdd (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger 4 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (ConstantInteger 500 (Integer 4 [])) (Integer 4 []) (ConstantInteger -500 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -6 (Integer 4 []))) ()) (= (Var 2 b) (UnaryOp Not (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 f) (ImplicitCast (UnaryOp UAdd (ConstantReal 1.000000 (Real 8 [])) (Real 8 []) (ConstantReal 1.000000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 f) (ImplicitCast (UnaryOp USub (ConstantReal 183745.534000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.534000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 b1) (ConstantLogical .true. (Logical 1 [])) ()) (= (Var 2 b2) (UnaryOp Not (ConstantLogical .false. (Logical 1 [])) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 b3) (UnaryOp Not (Var 2 b2) (Logical 1 []) ()) ()) (= (Var 2 a) (UnaryOp UAdd (ConstantLogical .true. (Logical 1 [])) (Integer 4 []) (ConstantInteger 1 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (ConstantLogical .false. (Logical 1 [])) (Integer 4 []) (ConstantInteger 0 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (ConstantLogical .true. (Logical 1 [])) (Integer 4 []) (ConstantInteger -2 (Integer 4 []))) ()) (= (Var 2 c) (ImplicitCast (UnaryOp UAdd (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (UnaryOp USub (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantReal 65.000000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.000000 65.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex -3.000000 -65.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 b1) (UnaryOp Not (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b2) (UnaryOp Not (FunctionCall 2 complex () [((ConstantInteger 0 (Integer 4 []))) ((ConstantInteger 0 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] []), test_UnaryOp: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), b1: (Variable 2 b1 Local () () Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () () Default (Logical 1 []) Source Public Required .false.), b3: (Variable 2 b3 Local () () Default (Logical 1 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private), f: (Variable 2 f Local () () Default (Real 4 []) Source Public Required .false.)}) test_UnaryOp [] [(= (Var 2 a) (UnaryOp UAdd (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger 4 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (ConstantInteger 500 (Integer 4 [])) (Integer 4 []) (ConstantInteger -500 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -6 (Integer 4 []))) ()) (= (Var 2 b) (UnaryOp Not (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 f) (ImplicitCast (UnaryOp UAdd (ConstantReal 1.000000 (Real 8 [])) (Real 8 []) (ConstantReal 1.000000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 f) (ImplicitCast (UnaryOp USub (ConstantReal 183745.534000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.534000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 b1) (ConstantLogical .true. (Logical 1 [])) ()) (= (Var 2 b2) (UnaryOp Not (ConstantLogical .false. (Logical 1 [])) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 b3) (UnaryOp Not (Var 2 b2) (Logical 1 []) ()) ()) (= (Var 2 a) (UnaryOp UAdd (ConstantLogical .true. (Logical 1 [])) (Integer 4 []) (ConstantInteger 1 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (ConstantLogical .false. (Logical 1 [])) (Integer 4 []) (ConstantInteger 0 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (ConstantLogical .true. (Logical 1 [])) (Integer 4 []) (ConstantInteger -2 (Integer 4 []))) ()) (= (Var 2 c) (ImplicitCast (UnaryOp UAdd (FunctionCall 2 complex () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex 1.000000 2.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (ImplicitCast (UnaryOp USub (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantReal 65.000000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.000000 65.000000 (Complex 8 [])) ()) (Complex 8 []) (ConstantComplex -3.000000 -65.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 b1) (UnaryOp Not (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .false. (Logical 4 []))) ()) (= (Var 2 b2) (UnaryOp Not (FunctionCall 2 complex () [((ConstantInteger 0 (Integer 4 []))) ((ConstantInteger 0 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 0.000000 0.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-expr13-81bdb5a.json b/tests/reference/asr-expr13-81bdb5a.json index 4a8d18e0a6..447d8ec89e 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": "f523fd467341ee828a4d7d467f9684a4397ab481e06ddb694f7bb231", + "stdout_hash": "494aa8ccc364c76d027d0b1e8e1bc2e6cdaf03ab48f2ae8866403efa", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr13-81bdb5a.stdout b/tests/reference/asr-expr13-81bdb5a.stdout index bf2f338569..73a90c1446 100644 --- a/tests/reference/asr-expr13-81bdb5a.stdout +++ b/tests/reference/asr-expr13-81bdb5a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] []), test_Compare: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Logical 1 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private)}) test_Compare [] [(= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Gt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) LtE (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Lt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 5.600000 (Real 8 [])) GtE (ConstantReal 5.599990 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) Eq (ConstantReal 3.300000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) NotEq (ConstantReal 3.400000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) Eq (FunctionCall 2 complex () [((ConstantReal 3.000000 (Real 8 []))) ((ConstantReal 4.000000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) Gt (ConstantString "abd" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "" (Character 1 0 () [])) Lt (ConstantString "s" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "-abs" (Character 1 4 () [])) GtE (ConstantString "abs" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abcd" (Character 1 4 () [])) LtE (ConstantString "abcde" (Character 1 5 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) Eq (ConstantString "abc" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) NotEq (ConstantString "abd" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "" (Character 1 0 () [])) Eq (ConstantString "+" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .true. (Logical 1 [])) Gt (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .true. (Logical 1 [])) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .false. (Logical 1 [])) NotEq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .false. (Logical 1 [])) GtE (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] []), test_Compare: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Logical 1 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private)}) test_Compare [] [(= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Gt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) LtE (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantInteger 5 (Integer 4 [])) Lt (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 5.600000 (Real 8 [])) GtE (ConstantReal 5.599990 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) Eq (ConstantReal 3.300000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantReal 3.300000 (Real 8 [])) NotEq (ConstantReal 3.400000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (FunctionCall 2 complex () [((ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 4 (Integer 4 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) Eq (FunctionCall 2 complex () [((ConstantReal 3.000000 (Real 8 []))) ((ConstantReal 4.000000 (Real 8 [])))] (Complex 8 []) (ConstantComplex 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) Gt (ConstantString "abd" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "" (Character 1 0 () [])) Lt (ConstantString "s" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "-abs" (Character 1 4 () [])) GtE (ConstantString "abs" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abcd" (Character 1 4 () [])) LtE (ConstantString "abcde" (Character 1 5 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) Eq (ConstantString "abc" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "abc" (Character 1 3 () [])) NotEq (ConstantString "abd" (Character 1 3 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantString "" (Character 1 0 () [])) Eq (ConstantString "+" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .true. (Logical 1 [])) Gt (ConstantLogical .false. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .true. (Logical 1 [])) Eq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .false. (Logical 1 [])) NotEq (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (ConstantLogical .false. (Logical 1 [])) GtE (ConstantLogical .true. (Logical 1 [])) (Logical 4 []) (ConstantLogical .false. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-expr7-480ba2f.json b/tests/reference/asr-expr7-480ba2f.json index 6f65f79256..e372da3fe9 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": "318748c5acdecf7c289f356ba463ac6799848d9190f547144b704716", + "stdout_hash": "023b55c6865d277860f8cf5c9e21c580c6d7e1cc4c2cea0e9e56e702", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr7-480ba2f.stdout b/tests/reference/asr-expr7-480ba2f.stdout index 6f7b6d481b..ddbbf9a503 100644 --- a/tests/reference/asr-expr7-480ba2f.stdout +++ b/tests/reference/asr-expr7-480ba2f.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 main0 () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main0: (Subroutine (SymbolTable 4 {c: (Variable 4 c Local () () Default (Integer 4 []) Source Public Required .false.)}) main0 [] [(SubroutineCall 1 test_pow () [] ()) (= (Var 4 c) (FunctionCall 1 test_pow_1 () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), pow@__lpython_overloaded_0__pow: (ExternalSymbol 1 pow@__lpython_overloaded_0__pow 6 __lpython_overloaded_0__pow lpython_builtin [] __lpython_overloaded_0__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 6 pow lpython_builtin [] pow Private)}) test_pow [] [(= (Var 2 a) (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_pow_1: (Function (SymbolTable 3 {_lpython_return_variable: (Variable 3 _lpython_return_variable ReturnVar () () Default (Integer 4 []) Source Public Required .false.), a: (Variable 3 a In () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 3 b In () () Default (Integer 4 []) Source Public Required .false.), pow: (ExternalSymbol 3 pow 6 pow lpython_builtin [] pow Private), res: (Variable 3 res Local () () Default (Integer 4 []) Source Public Required .false.)}) test_pow_1 [(Var 3 a) (Var 3 b)] [(= (Var 3 res) (FunctionCall 1 pow@__lpython_overloaded_0__pow 3 pow [((Var 3 a)) ((Var 3 b))] (Integer 4 []) () ()) ()) (= (Var 3 _lpython_return_variable) (Var 3 res) ()) (Return)] (Var 3 _lpython_return_variable) Source Public Implementation ())}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 46 {}) _lpython_main_program [] [(SubroutineCall 1 main0 () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main0: (Subroutine (SymbolTable 4 {c: (Variable 4 c Local () () Default (Integer 4 []) Source Public Required .false.)}) main0 [] [(SubroutineCall 1 test_pow () [] ()) (= (Var 4 c) (FunctionCall 1 test_pow_1 () [((ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 45 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), pow@__lpython_overloaded_0__pow: (ExternalSymbol 1 pow@__lpython_overloaded_0__pow 6 __lpython_overloaded_0__pow lpython_builtin [] __lpython_overloaded_0__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 6 pow lpython_builtin [] pow Private)}) test_pow [] [(= (Var 2 a) (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_pow_1: (Function (SymbolTable 3 {_lpython_return_variable: (Variable 3 _lpython_return_variable ReturnVar () () Default (Integer 4 []) Source Public Required .false.), a: (Variable 3 a In () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 3 b In () () Default (Integer 4 []) Source Public Required .false.), pow: (ExternalSymbol 3 pow 6 pow lpython_builtin [] pow Private), res: (Variable 3 res Local () () Default (Integer 4 []) Source Public Required .false.)}) test_pow_1 [(Var 3 a) (Var 3 b)] [(= (Var 3 res) (FunctionCall 1 pow@__lpython_overloaded_0__pow 3 pow [((Var 3 a)) ((Var 3 b))] (Integer 4 []) () ()) ()) (= (Var 3 _lpython_return_variable) (Var 3 res) ()) (Return)] (Var 3 _lpython_return_variable) Source Public Implementation ())}) []) diff --git a/tests/reference/asr-test_builtin-aa64615.json b/tests/reference/asr-test_builtin-aa64615.json index 57e878e953..8c705f78bc 100644 --- a/tests/reference/asr-test_builtin-aa64615.json +++ b/tests/reference/asr-test_builtin-aa64615.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin-aa64615.stdout", - "stdout_hash": "7b4cdd0c287d2e8f3a37e23d90629b08bbc6406e683f459839af0947", + "stdout_hash": "733146b2c1863b36029db544bb453e8fda6a19cab6669a4b13bc3e8e", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin-aa64615.stdout b/tests/reference/asr-test_builtin-aa64615.stdout index e5a806485a..820da01c63 100644 --- a/tests/reference/asr-test_builtin-aa64615.stdout +++ b/tests/reference/asr-test_builtin-aa64615.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 43 {}) _lpython_main_program [] [(SubroutineCall 1 test_ord () [] ()) (SubroutineCall 1 test_chr () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 42 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_chr: (Subroutine (SymbolTable 3 {chr: (ExternalSymbol 3 chr 5 chr lpython_builtin [] chr Private), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_chr [] [(= (Var 3 i) (ConstantInteger 48 (Integer 4 [])) ()) (= (Var 3 s) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (Var 3 s) Eq (ConstantString "0" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((ConstantInteger 48 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0" (Character 1 1 () [])) ()) Eq (ConstantString "0" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_ord: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 5 ord lpython_builtin [] ord Private), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord [] [(= (Var 2 s) (ConstantString "1" (Character 1 1 () [])) ()) (= (Var 2 i) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (Var 2 i) Eq (ConstantInteger 49 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((ConstantString "1" (Character 1 1 () [])))] (Integer 4 []) (ConstantInteger 49 (Integer 4 [])) ()) Eq (ConstantInteger 49 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 45 {}) _lpython_main_program [] [(SubroutineCall 1 test_ord () [] ()) (SubroutineCall 1 test_chr () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 44 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_chr: (Subroutine (SymbolTable 3 {chr: (ExternalSymbol 3 chr 5 chr lpython_builtin [] chr Private), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 3 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_chr [] [(= (Var 3 i) (ConstantInteger 48 (Integer 4 [])) ()) (= (Var 3 s) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (Var 3 s) Eq (ConstantString "0" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((ConstantInteger 48 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0" (Character 1 1 () [])) ()) Eq (ConstantString "0" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_ord: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 5 ord lpython_builtin [] ord Private), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_ord [] [(= (Var 2 s) (ConstantString "1" (Character 1 1 () [])) ()) (= (Var 2 i) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (Var 2 i) Eq (ConstantInteger 49 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((ConstantString "1" (Character 1 1 () [])))] (Integer 4 []) (ConstantInteger 49 (Integer 4 [])) ()) Eq (ConstantInteger 49 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_abs-c74d2c9.json b/tests/reference/asr-test_builtin_abs-c74d2c9.json index 2c525fa831..c561b99588 100644 --- a/tests/reference/asr-test_builtin_abs-c74d2c9.json +++ b/tests/reference/asr-test_builtin_abs-c74d2c9.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_abs-c74d2c9.stdout", - "stdout_hash": "bc1245f58f746c1a4a3c6b30c4b0e79be08aa7ac1a542c53814f14dd", + "stdout_hash": "9a803d92953211b529ef667eb1d93337c99cb83587286281e42ac220", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_abs-c74d2c9.stdout b/tests/reference/asr-test_builtin_abs-c74d2c9.stdout index 4e45aecad2..046c8e0283 100644 --- a/tests/reference/asr-test_builtin_abs-c74d2c9.stdout +++ b/tests/reference/asr-test_builtin_abs-c74d2c9.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_abs () [] ())] Source Public Implementation () .false. .false.), abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 4 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), abs@__lpython_overloaded_1__abs: (ExternalSymbol 1 abs@__lpython_overloaded_1__abs 4 __lpython_overloaded_1__abs lpython_builtin [] __lpython_overloaded_1__abs Public), abs@__lpython_overloaded_2__abs: (ExternalSymbol 1 abs@__lpython_overloaded_2__abs 4 __lpython_overloaded_2__abs lpython_builtin [] __lpython_overloaded_2__abs Public), abs@__lpython_overloaded_3__abs: (ExternalSymbol 1 abs@__lpython_overloaded_3__abs 4 __lpython_overloaded_3__abs lpython_builtin [] __lpython_overloaded_3__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_abs: (Subroutine (SymbolTable 2 {abs: (ExternalSymbol 2 abs 4 abs lpython_builtin [] abs Private), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), x: (Variable 2 x Local () () Default (Real 8 []) Source Public Required .false.), x2: (Variable 2 x2 Local () () Default (Real 4 []) Source Public Required .false.)}) test_abs [] [(= (Var 2 x) (ConstantReal 5.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 x) (UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((ConstantReal 5.500000 (Real 8 [])))] (Real 8 []) (ConstantReal 5.500000 (Real 8 [])) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))))] (Real 8 []) (ConstantReal 5.500000 (Real 8 [])) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 x2) (ImplicitCast (UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (Compare (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_1__abs 2 abs [((Var 2 x2))] (Real 4 []) () ()) RealToReal (Real 8 []) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((Var 2 i))] (Integer 8 []) () ()) Eq (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Integer 8 []) (ConstantInteger 1 (Integer 4 [])) ()) Eq (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 test_abs () [] ())] Source Public Implementation () .false. .false.), abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 4 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), abs@__lpython_overloaded_1__abs: (ExternalSymbol 1 abs@__lpython_overloaded_1__abs 4 __lpython_overloaded_1__abs lpython_builtin [] __lpython_overloaded_1__abs Public), abs@__lpython_overloaded_2__abs: (ExternalSymbol 1 abs@__lpython_overloaded_2__abs 4 __lpython_overloaded_2__abs lpython_builtin [] __lpython_overloaded_2__abs Public), abs@__lpython_overloaded_3__abs: (ExternalSymbol 1 abs@__lpython_overloaded_3__abs 4 __lpython_overloaded_3__abs lpython_builtin [] __lpython_overloaded_3__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_abs: (Subroutine (SymbolTable 2 {abs: (ExternalSymbol 2 abs 4 abs lpython_builtin [] abs Private), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), x: (Variable 2 x Local () () Default (Real 8 []) Source Public Required .false.), x2: (Variable 2 x2 Local () () Default (Real 4 []) Source Public Required .false.)}) test_abs [] [(= (Var 2 x) (ConstantReal 5.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 x) (UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((ConstantReal 5.500000 (Real 8 [])))] (Real 8 []) (ConstantReal 5.500000 (Real 8 [])) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))))] (Real 8 []) (ConstantReal 5.500000 (Real 8 [])) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 x2) (ImplicitCast (UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (Compare (ImplicitCast (FunctionCall 1 abs@__lpython_overloaded_1__abs 2 abs [((Var 2 x2))] (Real 4 []) () ()) RealToReal (Real 8 []) ()) Eq (ConstantReal 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((Var 2 i))] (Integer 8 []) () ()) Eq (ImplicitCast (ConstantInteger 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Integer 8 []) (ConstantInteger 1 (Integer 4 [])) ()) Eq (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_bin-52ba9fa.json b/tests/reference/asr-test_builtin_bin-52ba9fa.json index 8cf1b12314..a5c49477e6 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": "af678ef100983d8f232291a649cc5e0d4f7e9d0f3229c07085e821cd", + "stdout_hash": "8a006f3503906ee83f513b1d1c6dd7a4c23206f519169b339d679c2a", "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 ef9a596052..972276cfee 100644 --- a/tests/reference/asr-test_builtin_bin-52ba9fa.stdout +++ b/tests/reference/asr-test_builtin_bin-52ba9fa.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_bin: (Subroutine (SymbolTable 2 {bin: (ExternalSymbol 2 bin 4 bin lpython_builtin [] bin Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_bin [] [(= (Var 2 i) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0b101" (Character 1 5 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (ConstantInteger 64 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0b1000000" (Character 1 9 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bin () [((ConstantInteger 64 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0b1000000" (Character 1 1 () [])) ()) Eq (ConstantString "0b1000000" (Character 1 9 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bin () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) Eq (ConstantString "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_bin: (Subroutine (SymbolTable 2 {bin: (ExternalSymbol 2 bin 4 bin lpython_builtin [] bin Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_bin [] [(= (Var 2 i) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0b101" (Character 1 5 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (ConstantInteger 64 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0b1000000" (Character 1 9 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bin () [((ConstantInteger 64 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0b1000000" (Character 1 1 () [])) ()) Eq (ConstantString "0b1000000" (Character 1 9 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bin () [((UnaryOp USub (ConstantInteger 534 (Integer 4 [])) (Integer 4 []) (ConstantInteger -534 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0b1000010110" (Character 1 1 () [])) ()) Eq (ConstantString "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_bool-330223a.json b/tests/reference/asr-test_builtin_bool-330223a.json index bb2d2b18d2..df1d2b6e1d 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": "f9e0503c36a446cd576c7c2adcf512a3624af25877b3ab9e9fbf110d", + "stdout_hash": "3ba4074190bd90310577fd47d2d7def907293584aec59a2d40207fa9", "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 9e87419927..6cf036824b 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.stdout +++ b/tests/reference/asr-test_builtin_bool-330223a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_bool () [] ())] Source Public Implementation () .false. .false.), bool@__lpython_overloaded_0__bool: (ExternalSymbol 1 bool@__lpython_overloaded_0__bool 4 __lpython_overloaded_0__bool lpython_builtin [] __lpython_overloaded_0__bool Public), bool@__lpython_overloaded_1__bool: (ExternalSymbol 1 bool@__lpython_overloaded_1__bool 4 __lpython_overloaded_1__bool lpython_builtin [] __lpython_overloaded_1__bool Public), bool@__lpython_overloaded_2__bool: (ExternalSymbol 1 bool@__lpython_overloaded_2__bool 4 __lpython_overloaded_2__bool lpython_builtin [] __lpython_overloaded_2__bool Public), bool@__lpython_overloaded_3__bool: (ExternalSymbol 1 bool@__lpython_overloaded_3__bool 4 __lpython_overloaded_3__bool lpython_builtin [] __lpython_overloaded_3__bool Public), bool@__lpython_overloaded_4__bool: (ExternalSymbol 1 bool@__lpython_overloaded_4__bool 4 __lpython_overloaded_4__bool lpython_builtin [] __lpython_overloaded_4__bool Public), bool@__lpython_overloaded_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 4 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_bool: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a2: (Variable 2 a2 Local () () Default (Integer 8 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), bool: (ExternalSymbol 2 bool 4 bool lpython_builtin [] bool Private), f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_bool [] [(= (Var 2 a) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) ()) (= (Var 2 a) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((ConstantInteger 0 (Integer 4 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 a2) (ImplicitCast (ConstantInteger 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [((Var 2 a2))] (Logical 1 []) () ()) ()) (= (Var 2 f) (ConstantReal 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (ConstantReal 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((ConstantReal 56.786866 (Real 8 [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((ConstantReal 0.000000 (Real 8 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 f2) (ImplicitCast (UnaryOp USub (ConstantReal 235.600000 (Real 8 [])) (Real 8 []) (ConstantReal -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [((Var 2 f2))] (Logical 1 []) () ()) ()) (= (Var 2 s) (ConstantString "" (Character 1 0 () [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 s) (ConstantString "str" (Character 1 3 () [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((ConstantString "" (Character 1 0 () [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((ConstantString "str" (Character 1 3 () [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((ConstantLogical .true. (Logical 1 [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((ConstantLogical .false. (Logical 1 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 test_bool () [] ())] Source Public Implementation () .false. .false.), bool@__lpython_overloaded_0__bool: (ExternalSymbol 1 bool@__lpython_overloaded_0__bool 4 __lpython_overloaded_0__bool lpython_builtin [] __lpython_overloaded_0__bool Public), bool@__lpython_overloaded_1__bool: (ExternalSymbol 1 bool@__lpython_overloaded_1__bool 4 __lpython_overloaded_1__bool lpython_builtin [] __lpython_overloaded_1__bool Public), bool@__lpython_overloaded_2__bool: (ExternalSymbol 1 bool@__lpython_overloaded_2__bool 4 __lpython_overloaded_2__bool lpython_builtin [] __lpython_overloaded_2__bool Public), bool@__lpython_overloaded_3__bool: (ExternalSymbol 1 bool@__lpython_overloaded_3__bool 4 __lpython_overloaded_3__bool lpython_builtin [] __lpython_overloaded_3__bool Public), bool@__lpython_overloaded_4__bool: (ExternalSymbol 1 bool@__lpython_overloaded_4__bool 4 __lpython_overloaded_4__bool lpython_builtin [] __lpython_overloaded_4__bool Public), bool@__lpython_overloaded_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 4 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_bool: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a2: (Variable 2 a2 Local () () Default (Integer 8 []) Source Public Required .false.), b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), bool: (ExternalSymbol 2 bool 4 bool lpython_builtin [] bool Private), f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_bool [] [(= (Var 2 a) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) ()) (= (Var 2 a) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((ConstantInteger 0 (Integer 4 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 a2) (ImplicitCast (ConstantInteger 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [((Var 2 a2))] (Logical 1 []) () ()) ()) (= (Var 2 f) (ConstantReal 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (ConstantReal 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((ConstantReal 56.786866 (Real 8 [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((ConstantReal 0.000000 (Real 8 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (= (Var 2 f2) (ImplicitCast (UnaryOp USub (ConstantReal 235.600000 (Real 8 [])) (Real 8 []) (ConstantReal -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [((Var 2 f2))] (Logical 1 []) () ()) ()) (= (Var 2 s) (ConstantString "" (Character 1 0 () [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 s) (ConstantString "str" (Character 1 3 () [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((ConstantString "" (Character 1 0 () [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((ConstantString "str" (Character 1 3 () [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((ConstantLogical .true. (Logical 1 [])))] (Logical 1 []) (ConstantLogical .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((ConstantLogical .false. (Logical 1 [])))] (Logical 1 []) (ConstantLogical .false. (Logical 1 [])) ()) (Logical 1 []) (ConstantLogical .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_float-20601dd.json b/tests/reference/asr-test_builtin_float-20601dd.json index 52da073525..2ed0650c64 100644 --- a/tests/reference/asr-test_builtin_float-20601dd.json +++ b/tests/reference/asr-test_builtin_float-20601dd.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_float-20601dd.stdout", - "stdout_hash": "80540c5b5f2957056ffc0dd0b22679a4f989432a857d6d6c2b16940c", + "stdout_hash": "166c3caee4d3114c83e279515a39efe8721097c95976906d56f5b9bf", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_float-20601dd.stdout b/tests/reference/asr-test_builtin_float-20601dd.stdout index ca7d7b4624..b82cbb0ab5 100644 --- a/tests/reference/asr-test_builtin_float-20601dd.stdout +++ b/tests/reference/asr-test_builtin_float-20601dd.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_float: (Subroutine (SymbolTable 2 {float: (ExternalSymbol 2 float 4 float lpython_builtin [] float Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_float [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 float () [((ConstantInteger 34 (Integer 4 [])))] (Real 8 []) (ConstantReal 34.000000 (Real 8 [])) ()) Eq (ConstantReal 34.000000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 float () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])) ()) Eq (UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 float () [((ConstantInteger 34 (Integer 4 [])))] (Real 8 []) (ConstantReal 34.000000 (Real 8 [])) ()) Eq (ConstantReal 34.000000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 float () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])) ()) Eq (UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 test_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_float: (Subroutine (SymbolTable 2 {float: (ExternalSymbol 2 float 4 float lpython_builtin [] float Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_float [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 float () [((ConstantInteger 34 (Integer 4 [])))] (Real 8 []) (ConstantReal 34.000000 (Real 8 [])) ()) Eq (ConstantReal 34.000000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 float () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])) ()) Eq (UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 float () [((ConstantInteger 34 (Integer 4 [])))] (Real 8 []) (ConstantReal 34.000000 (Real 8 [])) ()) Eq (ConstantReal 34.000000 (Real 8 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 float () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])) ()) Eq (UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_hex-64bd268.json b/tests/reference/asr-test_builtin_hex-64bd268.json index 285c0a960d..acab396253 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": "079b1e163e90145960c7d2378b43d0782186880dc5669f4cd7952f40", + "stdout_hash": "537effdde7197848d84677cf844d42fde84a23553403877fb0216818", "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 43cf2e3e38..68d2139afc 100644 --- a/tests/reference/asr-test_builtin_hex-64bd268.stdout +++ b/tests/reference/asr-test_builtin_hex-64bd268.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_hex () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_hex: (Subroutine (SymbolTable 2 {hex: (ExternalSymbol 2 hex 4 hex lpython_builtin [] hex Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_hex [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0x22" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "-0x108b" (Character 1 7 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 hex () [((ConstantInteger 34 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0x22" (Character 1 1 () [])) ()) Eq (ConstantString "0x22" (Character 1 4 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 hex () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0x108b" (Character 1 1 () [])) ()) Eq (ConstantString "-0x108b" (Character 1 7 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 test_hex () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_hex: (Subroutine (SymbolTable 2 {hex: (ExternalSymbol 2 hex 4 hex lpython_builtin [] hex Private), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.)}) test_hex [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0x22" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "-0x108b" (Character 1 7 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 hex () [((ConstantInteger 34 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0x22" (Character 1 1 () [])) ()) Eq (ConstantString "0x22" (Character 1 4 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 hex () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0x108b" (Character 1 1 () [])) ()) Eq (ConstantString "-0x108b" (Character 1 7 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_int-8f88fdc.json b/tests/reference/asr-test_builtin_int-8f88fdc.json index 553a729835..b6182572bd 100644 --- a/tests/reference/asr-test_builtin_int-8f88fdc.json +++ b/tests/reference/asr-test_builtin_int-8f88fdc.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_int-8f88fdc.stdout", - "stdout_hash": "8b1ed866ee7d9ba2f1aaf12742086a06dd5065fb5a649f2603383966", + "stdout_hash": "8806774d4a4f268484b46b0af70c00dcff763d8721fd4a5aac3d0cdf", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_int-8f88fdc.stdout b/tests/reference/asr-test_builtin_int-8f88fdc.stdout index 6a0e54faa9..30584c4a05 100644 --- a/tests/reference/asr-test_builtin_int-8f88fdc.stdout +++ b/tests/reference/asr-test_builtin_int-8f88fdc.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_int: (Subroutine (SymbolTable 2 {f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), int: (ExternalSymbol 2 int 4 int lpython_builtin [] int Private)}) test_int [] [(= (Var 2 f) (ConstantReal 5.678000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 2 int () [((ConstantReal 5.678000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 f) (UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 2 int () [((UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))))] (Integer 4 []) (ConstantInteger -183745 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 183745 (Integer 4 [])) (Integer 4 []) (ConstantInteger -183745 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 int () [((ConstantReal 5.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 int () [((UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))))] (Integer 4 []) (ConstantInteger -5 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 test_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_int: (Subroutine (SymbolTable 2 {f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), int: (ExternalSymbol 2 int 4 int lpython_builtin [] int Private)}) test_int [] [(= (Var 2 f) (ConstantReal 5.678000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 2 int () [((ConstantReal 5.678000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 f) (UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 2 int () [((UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))))] (Integer 4 []) (ConstantInteger -183745 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 183745 (Integer 4 [])) (Integer 4 []) (ConstantInteger -183745 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 int () [((ConstantReal 5.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 5 (Integer 4 [])) ()) Eq (ConstantInteger 5 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 int () [((UnaryOp USub (ConstantReal 5.500000 (Real 8 [])) (Real 8 []) (ConstantReal -5.500000 (Real 8 []))))] (Integer 4 []) (ConstantInteger -5 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_len-55b0dec.json b/tests/reference/asr-test_builtin_len-55b0dec.json index 1a88bf13f4..f2ca734df5 100644 --- a/tests/reference/asr-test_builtin_len-55b0dec.json +++ b/tests/reference/asr-test_builtin_len-55b0dec.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_len-55b0dec.stdout", - "stdout_hash": "5bf01cdab9956c1f633236fa2f945527e346fc2cc55d340ad0b0c021", + "stdout_hash": "c17d60f01af9ba30e72a537c59db7b09006877a1258b4fe98d99eafb", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_len-55b0dec.stdout b/tests/reference/asr-test_builtin_len-55b0dec.stdout index f27dd79f2c..9d83312221 100644 --- a/tests/reference/asr-test_builtin_len-55b0dec.stdout +++ b/tests/reference/asr-test_builtin_len-55b0dec.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_len () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_len: (Subroutine (SymbolTable 2 {len: (ExternalSymbol 2 len 4 len lpython_builtin [] len Private), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_len [] [(= (Var 2 s) (ConstantString "abcd" (Character 1 4 () [])) ()) (Assert (Compare (FunctionCall 2 len () [((Var 2 s))] (Integer 4 []) () ()) Eq (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (ConstantString "" (Character 1 0 () [])) ()) (Assert (Compare (FunctionCall 2 len () [((Var 2 s))] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 len () [((ConstantString "abcd" (Character 1 4 () [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) Eq (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 len () [((ConstantString "" (Character 1 0 () [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 test_len () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_len: (Subroutine (SymbolTable 2 {len: (ExternalSymbol 2 len 4 len lpython_builtin [] len Private), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_len [] [(= (Var 2 s) (ConstantString "abcd" (Character 1 4 () [])) ()) (Assert (Compare (FunctionCall 2 len () [((Var 2 s))] (Integer 4 []) () ()) Eq (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (ConstantString "" (Character 1 0 () [])) ()) (Assert (Compare (FunctionCall 2 len () [((Var 2 s))] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 len () [((ConstantString "abcd" (Character 1 4 () [])))] (Integer 4 []) (ConstantInteger 4 (Integer 4 [])) ()) Eq (ConstantInteger 4 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 len () [((ConstantString "" (Character 1 0 () [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_oct-20b9066.json b/tests/reference/asr-test_builtin_oct-20b9066.json index 8193eca911..a9360e5539 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": "2054e85ddbf4b6aaae431fa61726c3028d4f6f47b3c4a7b59221cd13", + "stdout_hash": "7e2f29418ee7fb89b0c77f69cbaa985b94025e1684c4c9c88aee1cef", "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 8bc9dfd946..3aff3fefec 100644 --- a/tests/reference/asr-test_builtin_oct-20b9066.stdout +++ b/tests/reference/asr-test_builtin_oct-20b9066.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_oct () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_oct: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), oct: (ExternalSymbol 2 oct 4 oct lpython_builtin [] oct Private)}) test_oct [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0o42" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "-0o10213" (Character 1 8 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 oct () [((ConstantInteger 34 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0o42" (Character 1 1 () [])) ()) Eq (ConstantString "0o42" (Character 1 4 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 oct () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0o10213" (Character 1 1 () [])) ()) Eq (ConstantString "-0o10213" (Character 1 8 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 test_oct () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_oct: (Subroutine (SymbolTable 2 {i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), oct: (ExternalSymbol 2 oct 4 oct lpython_builtin [] oct Private)}) test_oct [] [(= (Var 2 i) (ConstantInteger 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "0o42" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (ConstantString "-0o10213" (Character 1 8 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 oct () [((ConstantInteger 34 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "0o42" (Character 1 1 () [])) ()) Eq (ConstantString "0o42" (Character 1 4 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 oct () [((UnaryOp USub (ConstantInteger 4235 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4235 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-0o10213" (Character 1 1 () [])) ()) Eq (ConstantString "-0o10213" (Character 1 8 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.json b/tests/reference/asr-test_builtin_pow-f02fcda.json index 0f2649d1c4..6b3a77c032 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": "4fbc86c5370e9975f6f0240b7cf5313db21cba8d3d78e2c4d425a801", + "stdout_hash": "d0a261938bf283674e3502339a7bb081cf86bd511ab0eb29592f8137", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.stdout b/tests/reference/asr-test_builtin_pow-f02fcda.stdout index bbbc0c8d77..b3e4ab51dc 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.stdout +++ b/tests/reference/asr-test_builtin_pow-f02fcda.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_pow () [] ())] Source Public Implementation () .false. .false.), abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 4 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), pow@__lpython_overloaded_0__pow: (ExternalSymbol 1 pow@__lpython_overloaded_0__pow 4 __lpython_overloaded_0__pow lpython_builtin [] __lpython_overloaded_0__pow Public), pow@__lpython_overloaded_1__pow: (ExternalSymbol 1 pow@__lpython_overloaded_1__pow 4 __lpython_overloaded_1__pow lpython_builtin [] __lpython_overloaded_1__pow Public), pow@__lpython_overloaded_2__pow: (ExternalSymbol 1 pow@__lpython_overloaded_2__pow 4 __lpython_overloaded_2__pow lpython_builtin [] __lpython_overloaded_2__pow Public), pow@__lpython_overloaded_3__pow: (ExternalSymbol 1 pow@__lpython_overloaded_3__pow 4 __lpython_overloaded_3__pow lpython_builtin [] __lpython_overloaded_3__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a1: (Variable 2 a1 Local () () Default (Real 8 []) Source Public Required .false.), a2: (Variable 2 a2 Local () () Default (Real 8 []) Source Public Required .false.), abs: (ExternalSymbol 2 abs 4 abs lpython_builtin [] abs Private), b: (Variable 2 b Local () () Default (Integer 4 []) Source Public Required .false.), eps: (Variable 2 eps Local () () Default (Real 8 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () () Default (Real 8 []) Source Public Required .false.)}) test_pow [] [(= (Var 2 eps) (ConstantReal 0.000000 (Real 8 [])) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 32 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 6 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 3 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 216 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) ()) (Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ())]) (= (Var 2 a) (ConstantInteger 6 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))) ()) (Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ())]) (= (Var 2 a1) (ConstantReal 4.500000 (Real 8 [])) ()) (= (Var 2 a2) (ConstantReal 2.300000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 a1)) ((Var 2 a2))] (Real 8 []) () ()) Sub (ConstantReal 31.797193 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 a2)) ((Var 2 a1))] (Real 8 []) () ()) Sub (ConstantReal 42.439989 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (= (Var 2 x) (ConstantInteger 3 (Integer 4 [])) ()) (= (Var 2 y) (ConstantReal 2.300000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 x)) ((Var 2 y))] (Real 8 []) () ()) Sub (ConstantReal 12.513503 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((Var 2 y)) ((Var 2 x))] (Real 8 []) () ()) Sub (ConstantReal 12.167000 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 x)) ((ConstantReal 5.500000 (Real 8 [])))] (Real 8 []) () ()) Sub (ConstantReal 420.888346 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Integer 4 []) (ConstantReal 0.500000 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.500000 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 6 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))))] (Integer 4 []) (ConstantReal 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.000772 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 [])))) ((UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))))] (Integer 4 []) (ConstantReal -0.004115 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Add (ConstantReal 0.004115 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 6 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))))] (Integer 4 []) (ConstantReal 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.000772 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((ConstantReal 4.500000 (Real 8 []))) ((ConstantReal 2.300000 (Real 8 [])))] (Real 8 []) (ConstantReal 31.797193 (Real 8 [])) ()) Sub (ConstantReal 31.797193 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((ConstantReal 2.300000 (Real 8 []))) ((ConstantReal 0.000000 (Real 8 [])))] (Real 8 []) (ConstantReal 1.000000 (Real 8 [])) ()) Sub (ConstantReal 1.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((ConstantReal 2.300000 (Real 8 []))) ((UnaryOp USub (ConstantReal 1.500000 (Real 8 [])) (Real 8 []) (ConstantReal -1.500000 (Real 8 []))))] (Real 8 []) (ConstantReal 0.286687 (Real 8 [])) ()) Sub (ConstantReal 0.286687 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((ConstantReal 3.400000 (Real 8 [])))] (Real 8 []) (ConstantReal 10.556063 (Real 8 [])) ()) Sub (ConstantReal 10.556063 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((UnaryOp USub (ConstantReal 3.400000 (Real 8 [])) (Real 8 []) (ConstantReal -3.400000 (Real 8 []))))] (Real 8 []) (ConstantReal 0.094732 (Real 8 [])) ()) Sub (ConstantReal 0.094732 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((ConstantReal 3.400000 (Real 8 []))) ((ConstantInteger 9 (Integer 4 [])))] (Real 8 []) (ConstantReal 60716.992766 (Real 8 [])) ()) Sub (ConstantReal 60716.992766 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((ConstantReal 0.000000 (Real 8 []))) ((ConstantInteger 53 (Integer 4 [])))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Sub (ConstantReal 0.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Integer 4 []) (ConstantInteger 16 (Integer 4 [])) ()) Eq (ConstantInteger 16 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])))) ((ConstantInteger 52 (Integer 4 [])))] (Real 8 []) (ConstantReal 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) ()) Sub (ConstantReal 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 test_pow () [] ())] Source Public Implementation () .false. .false.), abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 4 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), pow@__lpython_overloaded_0__pow: (ExternalSymbol 1 pow@__lpython_overloaded_0__pow 4 __lpython_overloaded_0__pow lpython_builtin [] __lpython_overloaded_0__pow Public), pow@__lpython_overloaded_1__pow: (ExternalSymbol 1 pow@__lpython_overloaded_1__pow 4 __lpython_overloaded_1__pow lpython_builtin [] __lpython_overloaded_1__pow Public), pow@__lpython_overloaded_2__pow: (ExternalSymbol 1 pow@__lpython_overloaded_2__pow 4 __lpython_overloaded_2__pow lpython_builtin [] __lpython_overloaded_2__pow Public), pow@__lpython_overloaded_3__pow: (ExternalSymbol 1 pow@__lpython_overloaded_3__pow 4 __lpython_overloaded_3__pow lpython_builtin [] __lpython_overloaded_3__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a1: (Variable 2 a1 Local () () Default (Real 8 []) Source Public Required .false.), a2: (Variable 2 a2 Local () () Default (Real 8 []) Source Public Required .false.), abs: (ExternalSymbol 2 abs 4 abs lpython_builtin [] abs Private), b: (Variable 2 b Local () () Default (Integer 4 []) Source Public Required .false.), eps: (Variable 2 eps Local () () Default (Real 8 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () () Default (Real 8 []) Source Public Required .false.)}) test_pow [] [(= (Var 2 eps) (ConstantReal 0.000000 (Real 8 [])) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 32 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 6 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 3 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 216 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (ConstantInteger 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (ConstantInteger 2 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))) ()) (Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ())]) (= (Var 2 a) (ConstantInteger 6 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))) ()) (Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ())]) (= (Var 2 a1) (ConstantReal 4.500000 (Real 8 [])) ()) (= (Var 2 a2) (ConstantReal 2.300000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 a1)) ((Var 2 a2))] (Real 8 []) () ()) Sub (ConstantReal 31.797193 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 a2)) ((Var 2 a1))] (Real 8 []) () ()) Sub (ConstantReal 42.439989 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (= (Var 2 x) (ConstantInteger 3 (Integer 4 [])) ()) (= (Var 2 y) (ConstantReal 2.300000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 x)) ((Var 2 y))] (Real 8 []) () ()) Sub (ConstantReal 12.513503 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((Var 2 y)) ((Var 2 x))] (Real 8 []) () ()) Sub (ConstantReal 12.167000 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 x)) ((ConstantReal 5.500000 (Real 8 [])))] (Real 8 []) () ()) Sub (ConstantReal 420.888346 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []) (ConstantInteger -1 (Integer 4 []))))] (Integer 4 []) (ConstantReal 0.500000 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.500000 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 6 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))))] (Integer 4 []) (ConstantReal 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.000772 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []) (ConstantInteger -3 (Integer 4 [])))) ((UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))))] (Integer 4 []) (ConstantReal -0.004115 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Add (ConstantReal 0.004115 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (ImplicitCast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 6 (Integer 4 []))) ((UnaryOp USub (ConstantInteger 4 (Integer 4 [])) (Integer 4 []) (ConstantInteger -4 (Integer 4 []))))] (Integer 4 []) (ConstantReal 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (ConstantReal 0.000772 (Real 8 [])) (Real 8 []) () ()))] (Real 8 []) () ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((ConstantReal 4.500000 (Real 8 []))) ((ConstantReal 2.300000 (Real 8 [])))] (Real 8 []) (ConstantReal 31.797193 (Real 8 [])) ()) Sub (ConstantReal 31.797193 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((ConstantReal 2.300000 (Real 8 []))) ((ConstantReal 0.000000 (Real 8 [])))] (Real 8 []) (ConstantReal 1.000000 (Real 8 [])) ()) Sub (ConstantReal 1.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((ConstantReal 2.300000 (Real 8 []))) ((UnaryOp USub (ConstantReal 1.500000 (Real 8 [])) (Real 8 []) (ConstantReal -1.500000 (Real 8 []))))] (Real 8 []) (ConstantReal 0.286687 (Real 8 [])) ()) Sub (ConstantReal 0.286687 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((ConstantReal 3.400000 (Real 8 [])))] (Real 8 []) (ConstantReal 10.556063 (Real 8 [])) ()) Sub (ConstantReal 10.556063 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((ConstantInteger 2 (Integer 4 []))) ((UnaryOp USub (ConstantReal 3.400000 (Real 8 [])) (Real 8 []) (ConstantReal -3.400000 (Real 8 []))))] (Real 8 []) (ConstantReal 0.094732 (Real 8 [])) ()) Sub (ConstantReal 0.094732 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((ConstantReal 3.400000 (Real 8 []))) ((ConstantInteger 9 (Integer 4 [])))] (Real 8 []) (ConstantReal 60716.992766 (Real 8 [])) ()) Sub (ConstantReal 60716.992766 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((ConstantReal 0.000000 (Real 8 []))) ((ConstantInteger 53 (Integer 4 [])))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Sub (ConstantReal 0.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 2 (Integer 4 [])))] (Integer 4 []) (ConstantInteger 16 (Integer 4 [])) ()) Eq (ConstantInteger 16 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_3__pow 2 pow [((UnaryOp USub (ConstantReal 4235.000000 (Real 8 [])) (Real 8 []) (ConstantReal -4235.000000 (Real 8 [])))) ((ConstantInteger 52 (Integer 4 [])))] (Real 8 []) (ConstantReal 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) ()) Sub (ConstantReal 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()))] (Real 8 []) (ConstantReal 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_round-7417a21.json b/tests/reference/asr-test_builtin_round-7417a21.json index e186869bf7..f836f9e87f 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": "903634376caaadd730605fb3486952538e1f39fe7433d4bf94b681c2", + "stdout_hash": "f3d39a0e9304d81ac0f9f9740297cb5272cc1392e565b1bba2f71912", "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 790a54bc38..1b6dbaa6f3 100644 --- a/tests/reference/asr-test_builtin_round-7417a21.stdout +++ b/tests/reference/asr-test_builtin_round-7417a21.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_round () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), round@__lpython_overloaded_0__round: (ExternalSymbol 1 round@__lpython_overloaded_0__round 4 __lpython_overloaded_0__round lpython_builtin [] __lpython_overloaded_0__round Public), round@__lpython_overloaded_1__round: (ExternalSymbol 1 round@__lpython_overloaded_1__round 4 __lpython_overloaded_1__round lpython_builtin [] __lpython_overloaded_1__round Public), round@__lpython_overloaded_2__round: (ExternalSymbol 1 round@__lpython_overloaded_2__round 4 __lpython_overloaded_2__round lpython_builtin [] __lpython_overloaded_2__round Public), test_round: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), round: (ExternalSymbol 2 round 4 round lpython_builtin [] round Private)}) test_round [] [(= (Var 2 f) (ConstantReal 5.678000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 44.340000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 0.500000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (UnaryOp USub (ConstantReal 50.500000 (Real 8 [])) (Real 8 []) (ConstantReal -50.500000 (Real 8 []))) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 1.500000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 13.001000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 13 (Integer 4 [])) ()) Eq (ConstantInteger 13 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (ConstantReal 40.499990 (Real 8 [])) (Real 8 []) (ConstantReal -40.499990 (Real 8 []))))] (Integer 4 []) (ConstantInteger -40 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 40 (Integer 4 [])) (Integer 4 []) (ConstantInteger -40 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 0.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (ConstantReal 0.500000 (Real 8 [])) (Real 8 []) (ConstantReal -0.500000 (Real 8 []))))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 1.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 2 (Integer 4 [])) ()) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 50.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 50 (Integer 4 [])) ()) Eq (ConstantInteger 50 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 56.780000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 57 (Integer 4 [])) ()) Eq (ConstantInteger 57 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((Var 2 i))] (Integer 8 []) () ()) Eq (ImplicitCast (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((ConstantInteger 4 (Integer 4 [])))] (Integer 8 []) (ConstantInteger 4 (Integer 4 [])) ()) Eq (ImplicitCast (ConstantInteger 4 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((ConstantLogical .false. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 test_round () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), round@__lpython_overloaded_0__round: (ExternalSymbol 1 round@__lpython_overloaded_0__round 4 __lpython_overloaded_0__round lpython_builtin [] __lpython_overloaded_0__round Public), round@__lpython_overloaded_1__round: (ExternalSymbol 1 round@__lpython_overloaded_1__round 4 __lpython_overloaded_1__round lpython_builtin [] __lpython_overloaded_1__round Public), round@__lpython_overloaded_2__round: (ExternalSymbol 1 round@__lpython_overloaded_2__round 4 __lpython_overloaded_2__round lpython_builtin [] __lpython_overloaded_2__round Public), test_round: (Subroutine (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 1 []) Source Public Required .false.), f: (Variable 2 f Local () () Default (Real 8 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), round: (ExternalSymbol 2 round 4 round lpython_builtin [] round Private)}) test_round [] [(= (Var 2 f) (ConstantReal 5.678000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (UnaryOp USub (ConstantReal 183745.230000 (Real 8 [])) (Real 8 []) (ConstantReal -183745.230000 (Real 8 []))) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 44.340000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 0.500000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (UnaryOp USub (ConstantReal 50.500000 (Real 8 [])) (Real 8 []) (ConstantReal -50.500000 (Real 8 []))) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (= (Var 2 f) (ConstantReal 1.500000 (Real 8 [])) ()) (Print () [(FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ())]) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 13.001000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 13 (Integer 4 [])) ()) Eq (ConstantInteger 13 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (ConstantReal 40.499990 (Real 8 [])) (Real 8 []) (ConstantReal -40.499990 (Real 8 []))))] (Integer 4 []) (ConstantInteger -40 (Integer 4 [])) ()) Eq (UnaryOp USub (ConstantInteger 40 (Integer 4 [])) (Integer 4 []) (ConstantInteger -40 (Integer 4 []))) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 0.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (ConstantReal 0.500000 (Real 8 [])) (Real 8 []) (ConstantReal -0.500000 (Real 8 []))))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 1.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 2 (Integer 4 [])) ()) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 50.500000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 50 (Integer 4 [])) ()) Eq (ConstantInteger 50 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((ConstantReal 56.780000 (Real 8 [])))] (Integer 4 []) (ConstantInteger 57 (Integer 4 [])) ()) Eq (ConstantInteger 57 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (= (Var 2 i) (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((Var 2 i))] (Integer 8 []) () ()) Eq (ImplicitCast (UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((ConstantInteger 4 (Integer 4 [])))] (Integer 8 []) (ConstantInteger 4 (Integer 4 [])) ()) Eq (ImplicitCast (ConstantInteger 4 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (ConstantLogical .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((ConstantLogical .false. (Logical 1 [])))] (Integer 4 []) (ConstantInteger 0 (Integer 4 [])) ()) Eq (ConstantInteger 0 (Integer 4 [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin_str-580e920.json b/tests/reference/asr-test_builtin_str-580e920.json index bad16709e2..bf3768a1db 100644 --- a/tests/reference/asr-test_builtin_str-580e920.json +++ b/tests/reference/asr-test_builtin_str-580e920.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_str-580e920.stdout", - "stdout_hash": "3790372d01befc729dd9686ce053d5ff77f53e819b74913b449f4a18", + "stdout_hash": "58ab1e84a711f53f49337e73258e3b0e5ebb35cc421b9950a06b8123", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_str-580e920.stdout b/tests/reference/asr-test_builtin_str-580e920.stdout index aa64ba6f2c..869182636a 100644 --- a/tests/reference/asr-test_builtin_str-580e920.stdout +++ b/tests/reference/asr-test_builtin_str-580e920.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 42 {}) _lpython_main_program [] [(SubroutineCall 1 test_str_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 41 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_str_int: (Subroutine (SymbolTable 2 {s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), str: (ExternalSymbol 2 str 4 str lpython_builtin [] str Private)}) test_str_int [] [(= (Var 2 s) (FunctionCall 2 str () [((ConstantInteger 356 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "356" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (ConstantString "356" (Character 1 3 () [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (FunctionCall 2 str () [((UnaryOp USub (ConstantInteger 567 (Integer 4 [])) (Integer 4 []) (ConstantInteger -567 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-567" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (ConstantString "-567" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 str () [((ConstantInteger 4 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "4" (Character 1 1 () [])) ()) Eq (ConstantString "4" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 str () [((UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-5" (Character 1 1 () [])) ()) Eq (ConstantString "-5" (Character 1 2 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 44 {}) _lpython_main_program [] [(SubroutineCall 1 test_str_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 43 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_str_int: (Subroutine (SymbolTable 2 {s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), str: (ExternalSymbol 2 str 4 str lpython_builtin [] str Private)}) test_str_int [] [(= (Var 2 s) (FunctionCall 2 str () [((ConstantInteger 356 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "356" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (ConstantString "356" (Character 1 3 () [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (FunctionCall 2 str () [((UnaryOp USub (ConstantInteger 567 (Integer 4 [])) (Integer 4 []) (ConstantInteger -567 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-567" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (ConstantString "-567" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 str () [((ConstantInteger 4 (Integer 4 [])))] (Character 1 -2 () []) (ConstantString "4" (Character 1 1 () [])) ()) Eq (ConstantString "4" (Character 1 1 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 str () [((UnaryOp USub (ConstantInteger 5 (Integer 4 [])) (Integer 4 []) (ConstantInteger -5 (Integer 4 []))))] (Character 1 -2 () []) (ConstantString "-5" (Character 1 1 () [])) ()) Eq (ConstantString "-5" (Character 1 2 () [])) (Logical 4 []) (ConstantLogical .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) From 5cbcd439ccebc44a5611337ce5bc5cf849a85e83 Mon Sep 17 00:00:00 2001 From: Smit-create Date: Thu, 24 Mar 2022 10:39:22 +0530 Subject: [PATCH 10/10] Rename _imag to _lpython_imag --- src/lpython/semantics/python_ast_to_asr.cpp | 4 ++-- src/lpython/semantics/python_comptime_eval.h | 8 ++++---- src/runtime/lpython_builtin.py | 5 ++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 84e16dde77..f20673ae5b 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -1855,14 +1855,14 @@ class BodyVisitor : public CommonVisitor { std::string attr = x.m_attr; if (attr == "imag") { ASR::expr_t *val = ASR::down_cast(ASR::make_Var_t(al, x.base.base.loc, t)); - ASR::symbol_t *fn_imag = resolve_intrinsic_function(x.base.base.loc, "_imag"); + ASR::symbol_t *fn_imag = resolve_intrinsic_function(x.base.base.loc, "_lpython_imag"); Vec args; args.reserve(al, 1); ASR::call_arg_t arg; arg.loc = val->base.loc; arg.m_value = val; args.push_back(al, arg); - make_call_helper(al, fn_imag, current_scope, args, "_imag", x.base.base.loc); + make_call_helper(al, fn_imag, current_scope, args, "_lpython_imag", x.base.base.loc); return; } else if (attr == "real") { ASR::expr_t *val = ASR::down_cast(ASR::make_Var_t(al, x.base.base.loc, t)); diff --git a/src/lpython/semantics/python_comptime_eval.h b/src/lpython/semantics/python_comptime_eval.h index 7ce5d2a203..e58ce679cd 100644 --- a/src/lpython/semantics/python_comptime_eval.h +++ b/src/lpython/semantics/python_comptime_eval.h @@ -44,7 +44,7 @@ struct PythonIntrinsicProcedures { {"hex", {m_builtin, &eval_hex}}, {"oct", {m_builtin, &eval_oct}}, {"complex", {m_builtin, &eval_complex}}, - {"_imag", {m_builtin, &eval__imag}}, + {"_lpython_imag", {m_builtin, &eval__lpython_imag}}, {"divmod", {m_builtin, &eval_divmod}}, }; } @@ -504,12 +504,12 @@ struct PythonIntrinsicProcedures { return ASR::down_cast(make_ConstantComplex_t(al, loc, c1, c2, type)); } - static ASR::expr_t *eval__imag(Allocator &al, const Location &loc, + static ASR::expr_t *eval__lpython_imag(Allocator &al, const Location &loc, Vec &args ) { LFORTRAN_ASSERT(ASRUtils::all_args_evaluated(args)); if (args.size() != 1) { - throw SemanticError("Intrinsic _imag function accepts exactly 1 argument", loc); + throw SemanticError("Intrinsic _lpython_imag function accepts exactly 1 argument", loc); } ASR::expr_t* imag_arg = args[0]; ASR::ttype_t *type = ASRUtils::TYPE(ASR::make_Real_t(al, loc, 8, nullptr, 0)); @@ -518,7 +518,7 @@ struct PythonIntrinsicProcedures { double result = im; return ASR::down_cast(ASR::make_ConstantReal_t(al, loc, result, type)); } else { - throw SemanticError("Argument of the _imag() function must be Complex", loc); + throw SemanticError("Argument of the _lpython_imag() function must be Complex", loc); } } diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index bf53a7bbb2..1feb3d7b52 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -297,11 +297,10 @@ def _lfortran_caimag(x: c32) -> f32: def _lfortran_zaimag(x: c64) -> f64: pass -# TODO: rename to _lpython_imag() @overload -def _imag(x: c64) -> f64: +def _lpython_imag(x: c64) -> f64: return _lfortran_zaimag(x) @overload -def _imag(x: c32) -> f32: +def _lpython_imag(x: c32) -> f32: return _lfortran_caimag(x)