From 6a357d247aca9d48cc57e15ed64b253758de11b1 Mon Sep 17 00:00:00 2001 From: Naman Gera Date: Wed, 27 Apr 2022 01:03:40 +0530 Subject: [PATCH 01/14] Comment out compile-time and runtime `len` --- integration_tests/run_tests.py | 4 ++-- integration_tests/test_builtin_bool.py | 14 +++++++------- src/lpython/semantics/python_comptime_eval.h | 2 +- src/runtime/lpython_builtin.py | 18 ++---------------- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/integration_tests/run_tests.py b/integration_tests/run_tests.py index 7a64f5686d..b7ee1291cb 100755 --- a/integration_tests/run_tests.py +++ b/integration_tests/run_tests.py @@ -26,9 +26,9 @@ "test_builtin_bool.py", "test_builtin_pow.py", "test_builtin_int.py", - "test_builtin_len.py", + # "test_builtin_len.py", "test_builtin_float.py", - "test_builtin_str_02.py", + # "test_builtin_str_02.py", "test_builtin_round.py", # "test_builtin_hex.py", # "test_builtin_oct.py", diff --git a/integration_tests/test_builtin_bool.py b/integration_tests/test_builtin_bool.py index f34e1ec773..ca6007543e 100644 --- a/integration_tests/test_builtin_bool.py +++ b/integration_tests/test_builtin_bool.py @@ -33,13 +33,13 @@ def test_bool(): f2 = -235.6 assert bool(f2) - s: str - s = "" - assert not bool(s) - s = "str" - assert bool(s) - assert not bool('') - assert bool("str") + # s: str + # s = "" + # assert not bool(s) + # s = "str" + # assert bool(s) + # assert not bool('') + # assert bool("str") b: bool b = True diff --git a/src/lpython/semantics/python_comptime_eval.h b/src/lpython/semantics/python_comptime_eval.h index ad9ec41754..5d01840e53 100644 --- a/src/lpython/semantics/python_comptime_eval.h +++ b/src/lpython/semantics/python_comptime_eval.h @@ -35,7 +35,7 @@ struct PythonIntrinsicProcedures { {"bool", {m_builtin, &eval_bool}}, {"chr", {m_builtin, &eval_chr}}, {"ord", {m_builtin, &eval_ord}}, - {"len", {m_builtin, &eval_len}}, + // {"len", {m_builtin, &eval_len}}, {"pow", {m_builtin, &eval_pow}}, // {"int", {m_builtin, &eval_int}}, // {"float", {m_builtin, &eval_float}}, diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index dc0b6ff826..0fb34fe7af 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -7,8 +7,8 @@ def ord(s: str) -> i32: # currently supports characters with unicode value betwe Returns an integer representing the Unicode code point of a given unicode character. This is the inverse of `chr()`. """ - if len(s) != 1: - return -1 # not a character + # if len(s) != 1: + # return -1 # not a character i: i32 for i in range(32, 127): if chr(i) == s: @@ -158,13 +158,6 @@ def bool(f: f64) -> bool: """ return f != 0.0 -@overload -def bool(s: str) -> bool: - """ - Return False when the argument `s` is an empty string, True otherwise. - """ - return len(s) > 0 - @overload def bool(b: bool) -> bool: return b @@ -178,13 +171,6 @@ def bool(c: c64) -> bool: return c.real != 0.0 or _lfortran_zaimag(c) != 0.0 -@interface -def len(s: str) -> i32: - """ - Return the length of the string `s`. - """ - pass - #: pow() as a generic procedure. #: supported types for arguments: #: (i32, i32), (i64, i64), (f64, f64), From a5b82127b5ed6e201f4dfd6598df0e5094764351 Mon Sep 17 00:00:00 2001 From: Naman Gera Date: Wed, 27 Apr 2022 01:05:25 +0530 Subject: [PATCH 02/14] ASR: Add `StringLen` node --- src/libasr/ASR.asdl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libasr/ASR.asdl b/src/libasr/ASR.asdl index 0af05787d5..7a4d7f64e1 100644 --- a/src/libasr/ASR.asdl +++ b/src/libasr/ASR.asdl @@ -232,7 +232,10 @@ expr | ArrayConstant(expr* args, ttype type) | SetConstant(expr* elements, ttype type) | TupleConstant(expr* elements, ttype type) + | StringConstant(string s, ttype type) + | StringLen(expr arg) + | DictConstant(expr* keys, expr* values, ttype type) | Var(symbol v) | ArrayRef(symbol v, array_index* args, ttype type, expr? value) From 62a73d69321eb7a01541f43508d3007fa9e725ea Mon Sep 17 00:00:00 2001 From: Naman Gera Date: Wed, 27 Apr 2022 01:17:59 +0530 Subject: [PATCH 03/14] Make `len` work for str by inserting `StringLen` node --- src/lpython/semantics/python_ast_to_asr.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 985c1bbb84..22320599de 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -2681,6 +2681,16 @@ class BodyVisitor : public CommonVisitor { return nullptr; } + ASR::asr_t* handle_intrinsic_len(Allocator &al, Vec args, + const Location &loc) { + ASR::expr_t *arg = args[0].m_value; + ASR::ttype_t *type = ASRUtils::expr_type(arg); + if (ASRUtils::is_character(*type)) { + return (ASR::asr_t *)ASR::down_cast(ASR::make_StringLen_t(al, loc, arg)); + } + return nullptr; + } + void visit_Call(const AST::Call_t &x) { std::string call_name; Vec args; @@ -2808,6 +2818,13 @@ class BodyVisitor : public CommonVisitor { tmp = handle_intrinsic_float(al, args, x.base.base.loc); } return; + } else if (call_name == "len") { + if (args.size() != 1) { + throw SemanticError("len() takes exactly one argument (" + + std::to_string(args.size()) + " given)", x.base.base.loc); + } + tmp = handle_intrinsic_len(al, args, x.base.base.loc); + return; } else { // The function was not found and it is not intrinsic throw SemanticError("Function '" + call_name + "' is not declared and not intrinsic", From 3a41c5cafd98e3cd7443cccc89e2e9f100fb8a1a Mon Sep 17 00:00:00 2001 From: Naman Gera Date: Wed, 27 Apr 2022 01:25:42 +0530 Subject: [PATCH 04/14] Add len nodes for all iterables --- src/libasr/ASR.asdl | 8 +++++++- src/lpython/semantics/python_ast_to_asr.cpp | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/libasr/ASR.asdl b/src/libasr/ASR.asdl index 7a4d7f64e1..d4bd813a21 100644 --- a/src/libasr/ASR.asdl +++ b/src/libasr/ASR.asdl @@ -227,16 +227,22 @@ expr | LogicalConstant(bool value, ttype type) | ListConstant(expr* args, ttype type) + | ListLen(expr arg, ttype type) | ListConcat(expr left, expr right, ttype type, expr? value) | ArrayConstant(expr* args, ttype type) + | SetConstant(expr* elements, ttype type) + | SetLen(expr arg, ttype type) + | TupleConstant(expr* elements, ttype type) + | TupleLen(expr arg, ttype type) | StringConstant(string s, ttype type) - | StringLen(expr arg) + | StringLen(expr arg, ttype type) | DictConstant(expr* keys, expr* values, ttype type) + | DictLen(expr arg, ttype type) | Var(symbol v) | ArrayRef(symbol v, array_index* args, ttype type, expr? value) | DerivedRef(expr v, symbol m, ttype type, expr? value) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 22320599de..8745092e15 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -2685,8 +2685,10 @@ class BodyVisitor : public CommonVisitor { const Location &loc) { ASR::expr_t *arg = args[0].m_value; ASR::ttype_t *type = ASRUtils::expr_type(arg); + ASR::ttype_t *to_type = ASRUtils::TYPE(ASR::make_Integer_t(al, loc, + 4, nullptr, 0)); if (ASRUtils::is_character(*type)) { - return (ASR::asr_t *)ASR::down_cast(ASR::make_StringLen_t(al, loc, arg)); + return (ASR::asr_t *)ASR::down_cast(ASR::make_StringLen_t(al, loc, arg, to_type)); } return nullptr; } From f05105470ea6c45d6c670a944d516569bb981a66 Mon Sep 17 00:00:00 2001 From: Naman Gera Date: Wed, 27 Apr 2022 01:34:09 +0530 Subject: [PATCH 05/14] Make `len` work for iterables: dict, tuple, set, list --- src/lpython/semantics/python_ast_to_asr.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 8745092e15..4270b17a25 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -2689,6 +2689,14 @@ class BodyVisitor : public CommonVisitor { 4, nullptr, 0)); if (ASRUtils::is_character(*type)) { return (ASR::asr_t *)ASR::down_cast(ASR::make_StringLen_t(al, loc, arg, to_type)); + } else if (ASR::is_a(*type)) { + return (ASR::asr_t *)ASR::down_cast(ASR::make_SetLen_t(al, loc, arg, to_type)); + } else if (ASR::is_a(*type)) { + return (ASR::asr_t *)ASR::down_cast(ASR::make_TupleLen_t(al, loc, arg, to_type)); + } else if (ASR::is_a(*type)) { + return (ASR::asr_t *)ASR::down_cast(ASR::make_ListLen_t(al, loc, arg, to_type)); + } else if (ASR::is_a(*type)) { + return (ASR::asr_t *)ASR::down_cast(ASR::make_DictLen_t(al, loc, arg, to_type)); } return nullptr; } From e7db6d2f55515402a7449ba2e7a260e9e7a6f59c Mon Sep 17 00:00:00 2001 From: Naman Gera Date: Wed, 27 Apr 2022 01:53:54 +0530 Subject: [PATCH 06/14] Update tests --- src/libasr/asr_utils.h | 5 +++++ tests/constants1.py | 4 ++-- tests/reference/asr-complex1-f26c460.json | 2 +- tests/reference/asr-complex1-f26c460.stdout | 2 +- tests/reference/asr-constants1-5828e8a.json | 4 ++-- 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-expr8-6beda60.json | 2 +- tests/reference/asr-expr8-6beda60.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 | 4 ++-- tests/reference/asr-test_builtin_bool-330223a.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_len-55b0dec.json | 10 +++++----- 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 +- tests/reference/asr-test_list_concat-41d186f.stdout | 1 + tests/reference/asr-test_max_min-3c2fc51.json | 2 +- tests/reference/asr-test_max_min-3c2fc51.stdout | 2 +- tests/reference/asr-test_pow-3f5d550.json | 2 +- tests/reference/asr-test_pow-3f5d550.stdout | 2 +- tests/reference/ast-constants1-91cb6ff.json | 4 ++-- tests/reference/ast-constants1-91cb6ff.stdout | 2 +- tests/tests.toml | 2 +- 43 files changed, 55 insertions(+), 49 deletions(-) create mode 100644 tests/reference/asr-test_list_concat-41d186f.stdout diff --git a/src/libasr/asr_utils.h b/src/libasr/asr_utils.h index 5883c7e1a0..cd57702495 100644 --- a/src/libasr/asr_utils.h +++ b/src/libasr/asr_utils.h @@ -109,12 +109,17 @@ static inline ASR::ttype_t* expr_type(const ASR::expr_t *f) case ASR::exprType::RealConstant: { return ((ASR::RealConstant_t*)f)->m_type; } case ASR::exprType::ComplexConstant: { return ((ASR::ComplexConstant_t*)f)->m_type; } case ASR::exprType::SetConstant: { return ((ASR::SetConstant_t*)f)->m_type; } + case ASR::exprType::SetLen: { return ((ASR::SetLen_t*)f)->m_type; } case ASR::exprType::ListConstant: { return ((ASR::ListConstant_t*)f)->m_type; } case ASR::exprType::ListConcat: { return ((ASR::ListConcat_t*)f)->m_type; } + case ASR::exprType::ListLen: { return ((ASR::ListLen_t*)f)->m_type; } case ASR::exprType::TupleConstant: { return ((ASR::TupleConstant_t*)f)->m_type; } + case ASR::exprType::TupleLen: { return ((ASR::TupleLen_t*)f)->m_type; } case ASR::exprType::LogicalConstant: { return ((ASR::LogicalConstant_t*)f)->m_type; } case ASR::exprType::StringConstant: { return ((ASR::StringConstant_t*)f)->m_type; } + case ASR::exprType::StringLen: { return ((ASR::StringLen_t*)f)->m_type; } case ASR::exprType::DictConstant: { return ((ASR::DictConstant_t*)f)->m_type; } + case ASR::exprType::DictLen: { return ((ASR::DictLen_t*)f)->m_type; } case ASR::exprType::IntegerBOZ: { return ((ASR::IntegerBOZ_t*)f)->m_type; } case ASR::exprType::Var: { return EXPR2VAR(f)->m_type; } case ASR::exprType::ArrayRef: { return ((ASR::ArrayRef_t*)f)->m_type; } diff --git a/tests/constants1.py b/tests/constants1.py index fa0a53f9d3..0e5923070c 100644 --- a/tests/constants1.py +++ b/tests/constants1.py @@ -48,10 +48,10 @@ def test_bool(): a: bool a = bool(0) a = bool(-1) - a = bool('') + # a = bool('') a = bool(complex(0, 0)) assert a == False - a = bool('t') + # a = bool('t') a = bool(2.3) assert a == True diff --git a/tests/reference/asr-complex1-f26c460.json b/tests/reference/asr-complex1-f26c460.json index 47230f44b2..cfc9b1337b 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": "5869e314cb005e53ec05365a2887376794de5ecb2148e5f049e51096", + "stdout_hash": "3f26a999449c70080ff395831083d05eaa6af5c852c1a17a7874d5df", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex1-f26c460.stdout b/tests/reference/asr-complex1-f26c460.stdout index ff814ad255..8685fbe7de 100644 --- a/tests/reference/asr-complex1-f26c460.stdout +++ b/tests/reference/asr-complex1-f26c460.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_0__complex: (ExternalSymbol 1 complex@__lpython_overloaded_0__complex 5 __lpython_overloaded_0__complex lpython_builtin [] __lpython_overloaded_0__complex Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 5 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_1__complex: (ExternalSymbol 1 complex@__lpython_overloaded_1__complex 5 __lpython_overloaded_1__complex lpython_builtin [] __lpython_overloaded_1__complex Public), complex@__lpython_overloaded_2__complex: (ExternalSymbol 1 complex@__lpython_overloaded_2__complex 5 __lpython_overloaded_2__complex lpython_builtin [] __lpython_overloaded_2__complex Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 5 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 5 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 97 {}) 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 (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 y) (BinOp (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 z) (Cast (BinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (BinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (BinOp (Cast (IntegerConstant 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) (Cast (FunctionCall 1 complex@__lpython_overloaded_0__complex 2 complex [] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_1__complex 2 complex [((RealConstant 3.400000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 5.000000 (Real 8 []))) ((RealConstant 4.300000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (FunctionCall 1 complex@__lpython_overloaded_2__complex 2 complex [((IntegerConstant 1 (Integer 4 [])))] (Complex 4 []) (ComplexConstant 1.000000 0.000000 (Complex 8 [])) ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c2) (Cast (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 4.500000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c3) (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (Cast (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) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.345340 (Real 8 []))) ((RealConstant 4.867868 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 0.015553 0.065561 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -5.000000 10.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 1.000000 1.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_0__complex: (ExternalSymbol 1 complex@__lpython_overloaded_0__complex 5 __lpython_overloaded_0__complex lpython_builtin [] __lpython_overloaded_0__complex Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 5 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_1__complex: (ExternalSymbol 1 complex@__lpython_overloaded_1__complex 5 __lpython_overloaded_1__complex lpython_builtin [] __lpython_overloaded_1__complex Public), complex@__lpython_overloaded_2__complex: (ExternalSymbol 1 complex@__lpython_overloaded_2__complex 5 __lpython_overloaded_2__complex lpython_builtin [] __lpython_overloaded_2__complex Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 5 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 5 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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 (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 y) (BinOp (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 z) (Cast (BinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (BinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (BinOp (Cast (IntegerConstant 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) (Cast (FunctionCall 1 complex@__lpython_overloaded_0__complex 2 complex [] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_1__complex 2 complex [((RealConstant 3.400000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 5.000000 (Real 8 []))) ((RealConstant 4.300000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (FunctionCall 1 complex@__lpython_overloaded_2__complex 2 complex [((IntegerConstant 1 (Integer 4 [])))] (Complex 4 []) (ComplexConstant 1.000000 0.000000 (Complex 8 [])) ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c2) (Cast (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 4.500000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c3) (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (Cast (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) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.345340 (Real 8 []))) ((RealConstant 4.867868 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 0.015553 0.065561 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -5.000000 10.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 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 ee2b00c8e0..323fc22ad4 100644 --- a/tests/reference/asr-constants1-5828e8a.json +++ b/tests/reference/asr-constants1-5828e8a.json @@ -2,11 +2,11 @@ "basename": "asr-constants1-5828e8a", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/constants1.py", - "infile_hash": "0410dc29468f90206a5c2aab56a9761c8d2ffcb239de210d3df2b14f", + "infile_hash": "86d7dacf1572246948121f4ef0aaddd1cb8be614c003453e8faae162", "outfile": null, "outfile_hash": null, "stdout": "asr-constants1-5828e8a.stdout", - "stdout_hash": "1c0247f92f98131fbe521af9b0e3555ad3dd5adbe8a034617bd08d86", + "stdout_hash": "cfec8129cae95991ee82c0d138d4915468ffe701deda58a3997ad5b0", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-constants1-5828e8a.stdout b/tests/reference/asr-constants1-5828e8a.stdout index 4e1f15e4af..f5039c27bb 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_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 13 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 13 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), abs@__lpython_overloaded_8__abs: (ExternalSymbol 1 abs@__lpython_overloaded_8__abs 13 __lpython_overloaded_8__abs lpython_builtin [] __lpython_overloaded_8__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_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 13 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), bool@__lpython_overloaded_6__bool: (ExternalSymbol 1 bool@__lpython_overloaded_6__bool 13 __lpython_overloaded_6__bool lpython_builtin [] __lpython_overloaded_6__bool Public), bool@__lpython_overloaded_9__bool: (ExternalSymbol 1 bool@__lpython_overloaded_9__bool 13 __lpython_overloaded_9__bool lpython_builtin [] __lpython_overloaded_9__bool Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 13 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 13 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 105 {}) 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) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((IntegerConstant 5 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 5 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 500 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .true. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((RealConstant 3.450000 (Real 8 [])))] (Real 8 []) (RealConstant 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((UnaryOp USub (RealConstant 5346.340000 (Real 8 [])) (Real 8 []) (RealConstant -5346.340000 (Real 8 []))))] (Real 8 []) (RealConstant 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_8__abs 4 abs [((FunctionCall 1 complex@__lpython_overloaded_5__complex 4 complex [((RealConstant 3.450000 (Real 8 []))) ((RealConstant 5.600000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.450000 5.600000 (Complex 8 [])) ()))] (Real 8 []) (RealConstant 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 [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_6__bool 6 bool [((StringConstant "" (Character 1 0 () [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_9__bool 6 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 6 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_6__bool 6 bool [((StringConstant "t" (Character 1 1 () [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_5__bool 6 bool [((RealConstant 2.300000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .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 () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 8 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 56 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 42 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 12648430 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-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) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 8 a) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .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 () [((IntegerConstant 9 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 9 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant -3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 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.)}) test_float [] [(= (Var 10 a) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 10 a) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToReal (Real 8 []) (RealConstant 5.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant -1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 0.000000 (Real 8 []))) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.)}) test_int [] [(= (Var 9 a) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (RealConstant 4.560000 (Real 8 [])) RealToInteger (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (UnaryOp USub (RealConstant 5.000010 (Real 8 [])) (Real 8 []) (RealConstant -5.000010 (Real 8 []))) RealToInteger (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (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 () [((StringConstant "" (Character 1 0 () [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [((StringConstant "test" (Character 1 4 () [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ()) ()) (= (Var 5 a) (FunctionCall 5 len () [((StringConstant "this is a test" (Character 1 14 () [])))] (Integer 4 []) (IntegerConstant 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 () [((StringConstant "5" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (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 () []) (StringConstant "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((RealConstant 5.600000 (Real 8 [])))] (Character 1 -2 () []) (StringConstant "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .true. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .false. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((StringConstant "5346" (Character 1 4 () [])))] (Character 1 -2 () []) (StringConstant "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_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 13 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 13 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), abs@__lpython_overloaded_8__abs: (ExternalSymbol 1 abs@__lpython_overloaded_8__abs 13 __lpython_overloaded_8__abs lpython_builtin [] __lpython_overloaded_8__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_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 13 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 13 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 13 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 13 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 103 {}) 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) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((IntegerConstant 5 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 5 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 500 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .true. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((RealConstant 3.450000 (Real 8 [])))] (Real 8 []) (RealConstant 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((UnaryOp USub (RealConstant 5346.340000 (Real 8 [])) (Real 8 []) (RealConstant -5346.340000 (Real 8 []))))] (Real 8 []) (RealConstant 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_8__abs 4 abs [((FunctionCall 1 complex@__lpython_overloaded_5__complex 4 complex [((RealConstant 3.450000 (Real 8 []))) ((RealConstant 5.600000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.450000 5.600000 (Complex 8 [])) ()))] (Real 8 []) (RealConstant 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 [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_8__bool 6 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 6 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_5__bool 6 bool [((RealConstant 2.300000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .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 () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 8 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 56 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 42 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 12648430 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-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) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 8 a) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .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 () [((IntegerConstant 9 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 9 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant -3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 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.)}) test_float [] [(= (Var 10 a) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 10 a) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToReal (Real 8 []) (RealConstant 5.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant -1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 0.000000 (Real 8 []))) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.)}) test_int [] [(= (Var 9 a) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (RealConstant 4.560000 (Real 8 [])) RealToInteger (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (UnaryOp USub (RealConstant 5.000010 (Real 8 [])) (Real 8 []) (RealConstant -5.000010 (Real 8 []))) RealToInteger (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (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.)}) test_len [] [(= (Var 5 a) (StringLen (StringConstant "" (Character 1 0 () [])) (Integer 4 [])) ()) (= (Var 5 a) (StringLen (StringConstant "test" (Character 1 4 () [])) (Integer 4 [])) ()) (= (Var 5 a) (StringLen (StringConstant "this is a test" (Character 1 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 () [((StringConstant "5" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (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 () []) (StringConstant "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((RealConstant 5.600000 (Real 8 [])))] (Character 1 -2 () []) (StringConstant "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .true. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .false. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((StringConstant "5346" (Character 1 4 () [])))] (Character 1 -2 () []) (StringConstant "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 b958fc0032..279ee2a1b2 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": "3e6010e171ba9438dae81691408224f63db3c4394d5026c89e2341ee", + "stdout_hash": "68befed0a476b8a704a4eace939367f7e2004c42a4d58fe7a46410df", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr1-8df2d66.stdout b/tests/reference/asr-expr1-8df2d66.stdout index 600728e816..c6f1909ddf 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 96 {}) 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) (IntegerConstant 0 (Integer 4 [])) (Integer 4 [])) ()) (If (NamedExpr (Var 2 a) (FunctionCall 2 ord () [((StringConstant "3" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 51 (Integer 4 [])) ()) (Integer 4 [])) [(= (Var 2 x) (IntegerConstant 1 (Integer 4 [])) ())] []) (WhileLoop (NamedExpr (Var 2 a) (IntegerConstant 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 y) (IntegerConstant 1 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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) (IntegerConstant 0 (Integer 4 [])) (Integer 4 [])) ()) (If (NamedExpr (Var 2 a) (FunctionCall 2 ord () [((StringConstant "3" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 51 (Integer 4 [])) ()) (Integer 4 [])) [(= (Var 2 x) (IntegerConstant 1 (Integer 4 [])) ())] []) (WhileLoop (NamedExpr (Var 2 a) (IntegerConstant 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 y) (IntegerConstant 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 8bd7d8b1dc..ccf8391dcc 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": "986d149e69267800de0fa6ad20bbcedbf5230f227af6b6aad2056a9d", + "stdout_hash": "9ddd745019307388c658a3214661e4b6d93835146e1d92c620147097", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr10-efcbb1b.stdout b/tests/reference/asr-expr10-efcbb1b.stdout index fa09c8e489..5ff1d7e38b 100644 --- a/tests/reference/asr-expr10-efcbb1b.stdout +++ b/tests/reference/asr-expr10-efcbb1b.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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 (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 []))) ()) (= (Var 2 b) (UnaryOp Not (IntegerConstant 5 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f) (Cast (UnaryOp UAdd (RealConstant 1.000000 (Real 8 [])) (Real 8 []) (RealConstant 1.000000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 f) (Cast (UnaryOp USub (RealConstant 183745.534000 (Real 8 [])) (Real 8 []) (RealConstant -183745.534000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 b1) (LogicalConstant .true. (Logical 1 [])) ()) (= (Var 2 b2) (UnaryOp Not (LogicalConstant .false. (Logical 1 [])) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 b3) (UnaryOp Not (Var 2 b2) (Logical 1 []) ()) ()) (= (Var 2 a) (UnaryOp UAdd (LogicalConstant .true. (Logical 1 [])) (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (LogicalConstant .false. (Logical 1 [])) (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (LogicalConstant .true. (Logical 1 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 []))) ()) (= (Var 2 c) (Cast (UnaryOp UAdd (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (UnaryOp USub (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((RealConstant 65.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 65.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -3.000000 -65.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 b1) (UnaryOp Not (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b2) (UnaryOp Not (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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 (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 []))) ()) (= (Var 2 b) (UnaryOp Not (IntegerConstant 5 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f) (Cast (UnaryOp UAdd (RealConstant 1.000000 (Real 8 [])) (Real 8 []) (RealConstant 1.000000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 f) (Cast (UnaryOp USub (RealConstant 183745.534000 (Real 8 [])) (Real 8 []) (RealConstant -183745.534000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 b1) (LogicalConstant .true. (Logical 1 [])) ()) (= (Var 2 b2) (UnaryOp Not (LogicalConstant .false. (Logical 1 [])) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 b3) (UnaryOp Not (Var 2 b2) (Logical 1 []) ()) ()) (= (Var 2 a) (UnaryOp UAdd (LogicalConstant .true. (Logical 1 [])) (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (LogicalConstant .false. (Logical 1 [])) (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (LogicalConstant .true. (Logical 1 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 []))) ()) (= (Var 2 c) (Cast (UnaryOp UAdd (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (UnaryOp USub (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((RealConstant 65.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 65.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -3.000000 -65.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 b1) (UnaryOp Not (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b2) (UnaryOp Not (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .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 08ace0c39b..53bd088695 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": "89a330afa217988aa2f7ec5b2a7fad74fd2c3869dd7afa0e3f8fe333", + "stdout_hash": "36d733486029c8047fd4d3798fc40f356bb23f6902179b0873672455", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr13-81bdb5a.stdout b/tests/reference/asr-expr13-81bdb5a.stdout index 06f0777edf..be4297ace2 100644 --- a/tests/reference/asr-expr13-81bdb5a.stdout +++ b/tests/reference/asr-expr13-81bdb5a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 4 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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 (IntegerConstant 5 (Integer 4 [])) Gt (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (IntegerConstant 5 (Integer 4 [])) LtE (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (IntegerConstant 5 (Integer 4 [])) Lt (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 5.600000 (Real 8 [])) GtE (RealConstant 5.599990 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 3.300000 (Real 8 [])) Eq (RealConstant 3.300000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 3.300000 (Real 8 [])) NotEq (RealConstant 3.400000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) Eq (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) Gt (StringConstant "abd" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "" (Character 1 0 () [])) Lt (StringConstant "s" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "-abs" (Character 1 4 () [])) GtE (StringConstant "abs" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abcd" (Character 1 4 () [])) LtE (StringConstant "abcde" (Character 1 5 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) Eq (StringConstant "abc" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) NotEq (StringConstant "abd" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "" (Character 1 0 () [])) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .true. (Logical 1 [])) Gt (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .true. (Logical 1 [])) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .false. (Logical 1 [])) NotEq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .false. (Logical 1 [])) GtE (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 4 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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 (IntegerConstant 5 (Integer 4 [])) Gt (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (IntegerConstant 5 (Integer 4 [])) LtE (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (IntegerConstant 5 (Integer 4 [])) Lt (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 5.600000 (Real 8 [])) GtE (RealConstant 5.599990 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 3.300000 (Real 8 [])) Eq (RealConstant 3.300000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 3.300000 (Real 8 [])) NotEq (RealConstant 3.400000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) Eq (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) Gt (StringConstant "abd" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "" (Character 1 0 () [])) Lt (StringConstant "s" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "-abs" (Character 1 4 () [])) GtE (StringConstant "abs" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abcd" (Character 1 4 () [])) LtE (StringConstant "abcde" (Character 1 5 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) Eq (StringConstant "abc" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) NotEq (StringConstant "abd" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "" (Character 1 0 () [])) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .true. (Logical 1 [])) Gt (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .true. (Logical 1 [])) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .false. (Logical 1 [])) NotEq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .false. (Logical 1 [])) GtE (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .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 53698b4fc1..724a94513d 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": "46baddcc31f19815c2225c526120c9ccae116a233cffa6b21f0ad4d4", + "stdout_hash": "9720e949c4f121f07e4d80f50904488352611cd7cadd552bcaa0a9dc", "stderr": "asr-expr7-480ba2f.stderr", "stderr_hash": "28509dd59a386eebd632340a550d14299cd2a921ef6dc3ac7dbe7fe9", "returncode": 0 diff --git a/tests/reference/asr-expr7-480ba2f.stdout b/tests/reference/asr-expr7-480ba2f.stdout index c018c168b1..3307db6882 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 99 {}) _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 () [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 98 {}) 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 [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 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 97 {}) _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 () [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 96 {}) 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 [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 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-expr8-6beda60.json b/tests/reference/asr-expr8-6beda60.json index 2a986a2737..d8eb8d83f2 100644 --- a/tests/reference/asr-expr8-6beda60.json +++ b/tests/reference/asr-expr8-6beda60.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr8-6beda60.stdout", - "stdout_hash": "603d1df54942732f122b3e5408a3151904cba04f65a9cf229fa5b4b1", + "stdout_hash": "2f8a598a36d854691ea0df208d560b9eed70b37a6632678ef65f9b08", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr8-6beda60.stdout b/tests/reference/asr-expr8-6beda60.stdout index 2c487c7be4..95d78cbd99 100644 --- a/tests/reference/asr-expr8-6beda60.stdout +++ b/tests/reference/asr-expr8-6beda60.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_floordiv@__lpython_overloaded_2___lpython_floordiv: (ExternalSymbol 1 _lpython_floordiv@__lpython_overloaded_2___lpython_floordiv 4 __lpython_overloaded_2___lpython_floordiv lpython_builtin [] __lpython_overloaded_2___lpython_floordiv Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) main_program [] []), test_binop: (Subroutine (SymbolTable 2 {_lpython_floordiv: (ExternalSymbol 2 _lpython_floordiv 4 _lpython_floordiv lpython_builtin [] _lpython_floordiv Private), b1: (Variable 2 b1 Local () () Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () () Default (Logical 1 []) Source Public Required .false.), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), x2: (Variable 2 x2 Local () () Default (Real 4 []) Source Public Required .false.)}) test_binop [] [(= (Var 2 x) (BinOp (IntegerConstant 2 (Integer 4 [])) Pow (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant 8 (Integer 4 [])) ()) ()) (= (Var 2 x2) (Cast (BinOp (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Pow (RealConstant 3.500000 (Real 8 [])) (Real 8 []) () ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x) (BinOp (IntegerConstant 54 (Integer 4 [])) Sub (IntegerConstant 100 (Integer 4 [])) (Integer 4 []) (IntegerConstant -46 (Integer 4 [])) ()) ()) (= (Var 2 x2) (Cast (BinOp (BinOp (RealConstant 3.454000 (Real 8 [])) Sub (RealConstant 765.430000 (Real 8 [])) (Real 8 []) (RealConstant -761.976000 (Real 8 [])) ()) Add (RealConstant 534.600000 (Real 8 [])) (Real 8 []) (RealConstant -227.376000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x2) (Cast (BinOp (RealConstant 5346.565000 (Real 8 [])) Mul (RealConstant 3.450000 (Real 8 [])) (Real 8 []) (RealConstant 18445.649250 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x2) (Cast (BinOp (RealConstant 5346.565000 (Real 8 [])) Pow (RealConstant 3.450000 (Real 8 [])) (Real 8 []) (RealConstant 7275422789925.217773 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Add (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Sub (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Mul (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Pow (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 b1) (LogicalConstant .true. (Logical 1 [])) ()) (= (Var 2 b2) (LogicalConstant .false. (Logical 1 [])) ()) (= (Var 2 x) (FunctionCall 1 _lpython_floordiv@__lpython_overloaded_2___lpython_floordiv 2 _lpython_floordiv [((Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ())) ((Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ()))] (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ()) Pow (Cast (Var 2 b2) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_floordiv@__lpython_overloaded_2___lpython_floordiv: (ExternalSymbol 1 _lpython_floordiv@__lpython_overloaded_2___lpython_floordiv 4 __lpython_overloaded_2___lpython_floordiv lpython_builtin [] __lpython_overloaded_2___lpython_floordiv Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) main_program [] []), test_binop: (Subroutine (SymbolTable 2 {_lpython_floordiv: (ExternalSymbol 2 _lpython_floordiv 4 _lpython_floordiv lpython_builtin [] _lpython_floordiv Private), b1: (Variable 2 b1 Local () () Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () () Default (Logical 1 []) Source Public Required .false.), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), x2: (Variable 2 x2 Local () () Default (Real 4 []) Source Public Required .false.)}) test_binop [] [(= (Var 2 x) (BinOp (IntegerConstant 2 (Integer 4 [])) Pow (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant 8 (Integer 4 [])) ()) ()) (= (Var 2 x2) (Cast (BinOp (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Pow (RealConstant 3.500000 (Real 8 [])) (Real 8 []) () ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x) (BinOp (IntegerConstant 54 (Integer 4 [])) Sub (IntegerConstant 100 (Integer 4 [])) (Integer 4 []) (IntegerConstant -46 (Integer 4 [])) ()) ()) (= (Var 2 x2) (Cast (BinOp (BinOp (RealConstant 3.454000 (Real 8 [])) Sub (RealConstant 765.430000 (Real 8 [])) (Real 8 []) (RealConstant -761.976000 (Real 8 [])) ()) Add (RealConstant 534.600000 (Real 8 [])) (Real 8 []) (RealConstant -227.376000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x2) (Cast (BinOp (RealConstant 5346.565000 (Real 8 [])) Mul (RealConstant 3.450000 (Real 8 [])) (Real 8 []) (RealConstant 18445.649250 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x2) (Cast (BinOp (RealConstant 5346.565000 (Real 8 [])) Pow (RealConstant 3.450000 (Real 8 [])) (Real 8 []) (RealConstant 7275422789925.217773 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Add (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Sub (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Mul (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Pow (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 b1) (LogicalConstant .true. (Logical 1 [])) ()) (= (Var 2 b2) (LogicalConstant .false. (Logical 1 [])) ()) (= (Var 2 x) (FunctionCall 1 _lpython_floordiv@__lpython_overloaded_2___lpython_floordiv 2 _lpython_floordiv [((Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ())) ((Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ()))] (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ()) Pow (Cast (Var 2 b2) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin-aa64615.json b/tests/reference/asr-test_builtin-aa64615.json index 1711e234a4..e15a929a0a 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": "af9a5624280851a160124d6fd9d07ab531f2bb36f4ff7a4e2b02595b", + "stdout_hash": "04d44bf32d15548557bc01aa312832044215930671038b138bd373c1", "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 9843554381..d4fb960a3f 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 98 {}) _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 97 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_chr: (Subroutine (SymbolTable 3 {capital_a: (Variable 3 capital_a Local () () Default (Character 1 -2 () []) Source Public Required .false.), capital_z: (Variable 3 capital_z Local () () Default (Character 1 -2 () []) Source Public Required .false.), chr: (ExternalSymbol 3 chr 5 chr lpython_builtin [] chr Private), dollar: (Variable 3 dollar Local () () Default (Character 1 -2 () []) Source Public Required .false.), exclamation: (Variable 3 exclamation Local () () Default (Character 1 -2 () []) Source Public Required .false.), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), left_parenthesis: (Variable 3 left_parenthesis Local () () Default (Character 1 -2 () []) Source Public Required .false.), nine: (Variable 3 nine Local () () Default (Character 1 -2 () []) Source Public Required .false.), plus: (Variable 3 plus Local () () Default (Character 1 -2 () []) Source Public Required .false.), right_brace: (Variable 3 right_brace Local () () Default (Character 1 -2 () []) Source Public Required .false.), right_bracket: (Variable 3 right_bracket Local () () Default (Character 1 -2 () []) Source Public Required .false.), semicolon: (Variable 3 semicolon Local () () Default (Character 1 -2 () []) Source Public Required .false.), small_a: (Variable 3 small_a Local () () Default (Character 1 -2 () []) Source Public Required .false.), small_z: (Variable 3 small_z Local () () Default (Character 1 -2 () []) Source Public Required .false.), zero: (Variable 3 zero Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_chr [] [(= (Var 3 i) (IntegerConstant 33 (Integer 4 [])) ()) (= (Var 3 exclamation) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 33 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "!" (Character 1 1 () [])) ()) Eq (StringConstant "!" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 exclamation) Eq (StringConstant "!" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 36 (Integer 4 [])) ()) (= (Var 3 dollar) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 36 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "$" (Character 1 1 () [])) ()) Eq (StringConstant "$" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 dollar) Eq (StringConstant "$" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 40 (Integer 4 [])) ()) (= (Var 3 left_parenthesis) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 40 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "(" (Character 1 1 () [])) ()) Eq (StringConstant "(" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 left_parenthesis) Eq (StringConstant "(" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 43 (Integer 4 [])) ()) (= (Var 3 plus) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (Character 1 1 () [])) ()) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 plus) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 48 (Integer 4 [])) ()) (= (Var 3 zero) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 48 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0" (Character 1 1 () [])) ()) Eq (StringConstant "0" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 zero) Eq (StringConstant "0" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 57 (Integer 4 [])) ()) (= (Var 3 nine) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 57 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "9" (Character 1 1 () [])) ()) Eq (StringConstant "9" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 nine) Eq (StringConstant "9" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 59 (Integer 4 [])) ()) (= (Var 3 semicolon) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 59 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant ";" (Character 1 1 () [])) ()) Eq (StringConstant ";" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 semicolon) Eq (StringConstant ";" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 65 (Integer 4 [])) ()) (= (Var 3 capital_a) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 65 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "A" (Character 1 1 () [])) ()) Eq (StringConstant "A" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 capital_a) Eq (StringConstant "A" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 90 (Integer 4 [])) ()) (= (Var 3 capital_z) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 90 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "Z" (Character 1 1 () [])) ()) Eq (StringConstant "Z" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 capital_z) Eq (StringConstant "Z" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 93 (Integer 4 [])) ()) (= (Var 3 right_bracket) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 93 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "]" (Character 1 1 () [])) ()) Eq (StringConstant "]" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 right_bracket) Eq (StringConstant "]" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 97 (Integer 4 [])) ()) (= (Var 3 small_a) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 97 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "a" (Character 1 1 () [])) ()) Eq (StringConstant "a" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 small_a) Eq (StringConstant "a" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 122 (Integer 4 [])) ()) (= (Var 3 small_z) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 122 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "z" (Character 1 1 () [])) ()) Eq (StringConstant "z" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 small_z) Eq (StringConstant "z" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 125 (Integer 4 [])) ()) (= (Var 3 right_brace) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 125 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "}" (Character 1 1 () [])) ()) Eq (StringConstant "}" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 right_brace) Eq (StringConstant "}" (Character 1 1 () [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_ord: (Subroutine (SymbolTable 2 {capital_a_unicode: (Variable 2 capital_a_unicode Local () () Default (Integer 4 []) Source Public Required .false.), capital_z_unicode: (Variable 2 capital_z_unicode Local () () Default (Integer 4 []) Source Public Required .false.), dollar_unicode: (Variable 2 dollar_unicode Local () () Default (Integer 4 []) Source Public Required .false.), exclamation_unicode: (Variable 2 exclamation_unicode Local () () Default (Integer 4 []) Source Public Required .false.), left_parenthesis_unicode: (Variable 2 left_parenthesis_unicode Local () () Default (Integer 4 []) Source Public Required .false.), nine_unicode: (Variable 2 nine_unicode Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 5 ord lpython_builtin [] ord Private), plus_unicode: (Variable 2 plus_unicode Local () () Default (Integer 4 []) Source Public Required .false.), right_brace_unicode: (Variable 2 right_brace_unicode Local () () Default (Integer 4 []) Source Public Required .false.), right_bracket_unicode: (Variable 2 right_bracket_unicode Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), semicolon_unicode: (Variable 2 semicolon_unicode Local () () Default (Integer 4 []) Source Public Required .false.), small_a_unicode: (Variable 2 small_a_unicode Local () () Default (Integer 4 []) Source Public Required .false.), small_z_unicode: (Variable 2 small_z_unicode Local () () Default (Integer 4 []) Source Public Required .false.), zero_unicode: (Variable 2 zero_unicode Local () () Default (Integer 4 []) Source Public Required .false.)}) test_ord [] [(= (Var 2 s) (StringConstant "!" (Character 1 1 () [])) ()) (= (Var 2 exclamation_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "!" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 33 (Integer 4 [])) ()) Eq (IntegerConstant 33 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 exclamation_unicode) Eq (IntegerConstant 33 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "$" (Character 1 1 () [])) ()) (= (Var 2 dollar_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "$" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 36 (Integer 4 [])) ()) Eq (IntegerConstant 36 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 dollar_unicode) Eq (IntegerConstant 36 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "(" (Character 1 1 () [])) ()) (= (Var 2 left_parenthesis_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "(" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 40 (Integer 4 [])) ()) Eq (IntegerConstant 40 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 left_parenthesis_unicode) Eq (IntegerConstant 40 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "+" (Character 1 1 () [])) ()) (= (Var 2 plus_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "+" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 43 (Integer 4 [])) ()) Eq (IntegerConstant 43 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 plus_unicode) Eq (IntegerConstant 43 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "0" (Character 1 1 () [])) ()) (= (Var 2 zero_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "0" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 48 (Integer 4 [])) ()) Eq (IntegerConstant 48 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 zero_unicode) Eq (IntegerConstant 48 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "9" (Character 1 1 () [])) ()) (= (Var 2 nine_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "9" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 57 (Integer 4 [])) ()) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 nine_unicode) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant ";" (Character 1 1 () [])) ()) (= (Var 2 semicolon_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant ";" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 59 (Integer 4 [])) ()) Eq (IntegerConstant 59 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 semicolon_unicode) Eq (IntegerConstant 59 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "A" (Character 1 1 () [])) ()) (= (Var 2 capital_a_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "A" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 65 (Integer 4 [])) ()) Eq (IntegerConstant 65 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 capital_a_unicode) Eq (IntegerConstant 65 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "Z" (Character 1 1 () [])) ()) (= (Var 2 capital_z_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "Z" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 90 (Integer 4 [])) ()) Eq (IntegerConstant 90 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 capital_z_unicode) Eq (IntegerConstant 90 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "]" (Character 1 1 () [])) ()) (= (Var 2 right_bracket_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "]" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 93 (Integer 4 [])) ()) Eq (IntegerConstant 93 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 right_bracket_unicode) Eq (IntegerConstant 93 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "a" (Character 1 1 () [])) ()) (= (Var 2 small_a_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "a" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 97 (Integer 4 [])) ()) Eq (IntegerConstant 97 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 small_a_unicode) Eq (IntegerConstant 97 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "z" (Character 1 1 () [])) ()) (= (Var 2 small_z_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "z" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 122 (Integer 4 [])) ()) Eq (IntegerConstant 122 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 small_z_unicode) Eq (IntegerConstant 122 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "}" (Character 1 1 () [])) ()) (= (Var 2 right_brace_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "}" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 125 (Integer 4 [])) ()) Eq (IntegerConstant 125 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 right_brace_unicode) Eq (IntegerConstant 125 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 96 {}) _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 95 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_chr: (Subroutine (SymbolTable 3 {capital_a: (Variable 3 capital_a Local () () Default (Character 1 -2 () []) Source Public Required .false.), capital_z: (Variable 3 capital_z Local () () Default (Character 1 -2 () []) Source Public Required .false.), chr: (ExternalSymbol 3 chr 5 chr lpython_builtin [] chr Private), dollar: (Variable 3 dollar Local () () Default (Character 1 -2 () []) Source Public Required .false.), exclamation: (Variable 3 exclamation Local () () Default (Character 1 -2 () []) Source Public Required .false.), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), left_parenthesis: (Variable 3 left_parenthesis Local () () Default (Character 1 -2 () []) Source Public Required .false.), nine: (Variable 3 nine Local () () Default (Character 1 -2 () []) Source Public Required .false.), plus: (Variable 3 plus Local () () Default (Character 1 -2 () []) Source Public Required .false.), right_brace: (Variable 3 right_brace Local () () Default (Character 1 -2 () []) Source Public Required .false.), right_bracket: (Variable 3 right_bracket Local () () Default (Character 1 -2 () []) Source Public Required .false.), semicolon: (Variable 3 semicolon Local () () Default (Character 1 -2 () []) Source Public Required .false.), small_a: (Variable 3 small_a Local () () Default (Character 1 -2 () []) Source Public Required .false.), small_z: (Variable 3 small_z Local () () Default (Character 1 -2 () []) Source Public Required .false.), zero: (Variable 3 zero Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_chr [] [(= (Var 3 i) (IntegerConstant 33 (Integer 4 [])) ()) (= (Var 3 exclamation) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 33 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "!" (Character 1 1 () [])) ()) Eq (StringConstant "!" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 exclamation) Eq (StringConstant "!" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 36 (Integer 4 [])) ()) (= (Var 3 dollar) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 36 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "$" (Character 1 1 () [])) ()) Eq (StringConstant "$" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 dollar) Eq (StringConstant "$" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 40 (Integer 4 [])) ()) (= (Var 3 left_parenthesis) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 40 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "(" (Character 1 1 () [])) ()) Eq (StringConstant "(" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 left_parenthesis) Eq (StringConstant "(" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 43 (Integer 4 [])) ()) (= (Var 3 plus) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (Character 1 1 () [])) ()) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 plus) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 48 (Integer 4 [])) ()) (= (Var 3 zero) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 48 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0" (Character 1 1 () [])) ()) Eq (StringConstant "0" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 zero) Eq (StringConstant "0" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 57 (Integer 4 [])) ()) (= (Var 3 nine) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 57 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "9" (Character 1 1 () [])) ()) Eq (StringConstant "9" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 nine) Eq (StringConstant "9" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 59 (Integer 4 [])) ()) (= (Var 3 semicolon) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 59 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant ";" (Character 1 1 () [])) ()) Eq (StringConstant ";" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 semicolon) Eq (StringConstant ";" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 65 (Integer 4 [])) ()) (= (Var 3 capital_a) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 65 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "A" (Character 1 1 () [])) ()) Eq (StringConstant "A" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 capital_a) Eq (StringConstant "A" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 90 (Integer 4 [])) ()) (= (Var 3 capital_z) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 90 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "Z" (Character 1 1 () [])) ()) Eq (StringConstant "Z" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 capital_z) Eq (StringConstant "Z" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 93 (Integer 4 [])) ()) (= (Var 3 right_bracket) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 93 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "]" (Character 1 1 () [])) ()) Eq (StringConstant "]" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 right_bracket) Eq (StringConstant "]" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 97 (Integer 4 [])) ()) (= (Var 3 small_a) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 97 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "a" (Character 1 1 () [])) ()) Eq (StringConstant "a" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 small_a) Eq (StringConstant "a" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 122 (Integer 4 [])) ()) (= (Var 3 small_z) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 122 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "z" (Character 1 1 () [])) ()) Eq (StringConstant "z" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 small_z) Eq (StringConstant "z" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 125 (Integer 4 [])) ()) (= (Var 3 right_brace) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 125 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "}" (Character 1 1 () [])) ()) Eq (StringConstant "}" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 right_brace) Eq (StringConstant "}" (Character 1 1 () [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_ord: (Subroutine (SymbolTable 2 {capital_a_unicode: (Variable 2 capital_a_unicode Local () () Default (Integer 4 []) Source Public Required .false.), capital_z_unicode: (Variable 2 capital_z_unicode Local () () Default (Integer 4 []) Source Public Required .false.), dollar_unicode: (Variable 2 dollar_unicode Local () () Default (Integer 4 []) Source Public Required .false.), exclamation_unicode: (Variable 2 exclamation_unicode Local () () Default (Integer 4 []) Source Public Required .false.), left_parenthesis_unicode: (Variable 2 left_parenthesis_unicode Local () () Default (Integer 4 []) Source Public Required .false.), nine_unicode: (Variable 2 nine_unicode Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 5 ord lpython_builtin [] ord Private), plus_unicode: (Variable 2 plus_unicode Local () () Default (Integer 4 []) Source Public Required .false.), right_brace_unicode: (Variable 2 right_brace_unicode Local () () Default (Integer 4 []) Source Public Required .false.), right_bracket_unicode: (Variable 2 right_bracket_unicode Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), semicolon_unicode: (Variable 2 semicolon_unicode Local () () Default (Integer 4 []) Source Public Required .false.), small_a_unicode: (Variable 2 small_a_unicode Local () () Default (Integer 4 []) Source Public Required .false.), small_z_unicode: (Variable 2 small_z_unicode Local () () Default (Integer 4 []) Source Public Required .false.), zero_unicode: (Variable 2 zero_unicode Local () () Default (Integer 4 []) Source Public Required .false.)}) test_ord [] [(= (Var 2 s) (StringConstant "!" (Character 1 1 () [])) ()) (= (Var 2 exclamation_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "!" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 33 (Integer 4 [])) ()) Eq (IntegerConstant 33 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 exclamation_unicode) Eq (IntegerConstant 33 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "$" (Character 1 1 () [])) ()) (= (Var 2 dollar_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "$" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 36 (Integer 4 [])) ()) Eq (IntegerConstant 36 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 dollar_unicode) Eq (IntegerConstant 36 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "(" (Character 1 1 () [])) ()) (= (Var 2 left_parenthesis_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "(" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 40 (Integer 4 [])) ()) Eq (IntegerConstant 40 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 left_parenthesis_unicode) Eq (IntegerConstant 40 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "+" (Character 1 1 () [])) ()) (= (Var 2 plus_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "+" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 43 (Integer 4 [])) ()) Eq (IntegerConstant 43 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 plus_unicode) Eq (IntegerConstant 43 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "0" (Character 1 1 () [])) ()) (= (Var 2 zero_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "0" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 48 (Integer 4 [])) ()) Eq (IntegerConstant 48 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 zero_unicode) Eq (IntegerConstant 48 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "9" (Character 1 1 () [])) ()) (= (Var 2 nine_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "9" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 57 (Integer 4 [])) ()) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 nine_unicode) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant ";" (Character 1 1 () [])) ()) (= (Var 2 semicolon_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant ";" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 59 (Integer 4 [])) ()) Eq (IntegerConstant 59 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 semicolon_unicode) Eq (IntegerConstant 59 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "A" (Character 1 1 () [])) ()) (= (Var 2 capital_a_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "A" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 65 (Integer 4 [])) ()) Eq (IntegerConstant 65 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 capital_a_unicode) Eq (IntegerConstant 65 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "Z" (Character 1 1 () [])) ()) (= (Var 2 capital_z_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "Z" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 90 (Integer 4 [])) ()) Eq (IntegerConstant 90 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 capital_z_unicode) Eq (IntegerConstant 90 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "]" (Character 1 1 () [])) ()) (= (Var 2 right_bracket_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "]" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 93 (Integer 4 [])) ()) Eq (IntegerConstant 93 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 right_bracket_unicode) Eq (IntegerConstant 93 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "a" (Character 1 1 () [])) ()) (= (Var 2 small_a_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "a" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 97 (Integer 4 [])) ()) Eq (IntegerConstant 97 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 small_a_unicode) Eq (IntegerConstant 97 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "z" (Character 1 1 () [])) ()) (= (Var 2 small_z_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "z" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 122 (Integer 4 [])) ()) Eq (IntegerConstant 122 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 small_z_unicode) Eq (IntegerConstant 122 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "}" (Character 1 1 () [])) ()) (= (Var 2 right_brace_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "}" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 125 (Integer 4 [])) ()) Eq (IntegerConstant 125 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 right_brace_unicode) Eq (IntegerConstant 125 (Integer 4 [])) (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 e8a2be208a..dbb14b48ad 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": "19a099ceed89fff21910afe0a0d1dff2b294a08cabd58111602c447e", + "stdout_hash": "b207d735c7faceec3bebeec75fffa059142a0b9971f57adb667f729f", "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 5694eb47e9..20b9519aff 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 97 {}) _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), abs@__lpython_overloaded_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 4 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_5__abs: (ExternalSymbol 1 abs@__lpython_overloaded_5__abs 4 __lpython_overloaded_5__abs lpython_builtin [] __lpython_overloaded_5__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 4 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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.), i2: (Variable 2 i2 Local () () Default (Integer 8 []) Source Public Required .false.), i3: (Variable 2 i3 Local () () Default (Integer 1 []) Source Public Required .false.), i4: (Variable 2 i4 Local () () Default (Integer 2 []) 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) (RealConstant 5.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 x) (UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((RealConstant 5.500000 (Real 8 [])))] (Real 8 []) (RealConstant 5.500000 (Real 8 [])) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))))] (Real 8 []) (RealConstant 5.500000 (Real 8 [])) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 x2) (Cast (UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_1__abs 2 abs [((Var 2 x2))] (Real 4 []) () ()) RealToReal (Real 8 []) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_4__abs 2 abs [((Var 2 i))] (Integer 4 []) () ()) Eq (IntegerConstant 5 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_4__abs 2 abs [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 i2) (Cast (UnaryOp USub (IntegerConstant 6 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_5__abs 2 abs [((Var 2 i2))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 6 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 i3) (Cast (UnaryOp USub (IntegerConstant 7 (Integer 4 [])) (Integer 4 []) (IntegerConstant -7 (Integer 4 []))) IntegerToInteger (Integer 1 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((Var 2 i3))] (Integer 1 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 7 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i4) (Cast (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 i4))] (Integer 2 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 8 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_6__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_6__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 95 {}) _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), abs@__lpython_overloaded_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 4 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_5__abs: (ExternalSymbol 1 abs@__lpython_overloaded_5__abs 4 __lpython_overloaded_5__abs lpython_builtin [] __lpython_overloaded_5__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 4 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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.), i2: (Variable 2 i2 Local () () Default (Integer 8 []) Source Public Required .false.), i3: (Variable 2 i3 Local () () Default (Integer 1 []) Source Public Required .false.), i4: (Variable 2 i4 Local () () Default (Integer 2 []) 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) (RealConstant 5.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 x) (UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((RealConstant 5.500000 (Real 8 [])))] (Real 8 []) (RealConstant 5.500000 (Real 8 [])) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))))] (Real 8 []) (RealConstant 5.500000 (Real 8 [])) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 x2) (Cast (UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_1__abs 2 abs [((Var 2 x2))] (Real 4 []) () ()) RealToReal (Real 8 []) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_4__abs 2 abs [((Var 2 i))] (Integer 4 []) () ()) Eq (IntegerConstant 5 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_4__abs 2 abs [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 i2) (Cast (UnaryOp USub (IntegerConstant 6 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_5__abs 2 abs [((Var 2 i2))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 6 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 i3) (Cast (UnaryOp USub (IntegerConstant 7 (Integer 4 [])) (Integer 4 []) (IntegerConstant -7 (Integer 4 []))) IntegerToInteger (Integer 1 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((Var 2 i3))] (Integer 1 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 7 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i4) (Cast (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 i4))] (Integer 2 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 8 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_6__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_6__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 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 72c2419617..9b53ce7c26 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": "c2820513efd3ff7d8fca3d896f4a5ce4ea8f0f927dca26158a4f043c", + "stdout_hash": "e22d1fcc06063becc20f2d6114948a3a3c8d1c5e2a00a8563963fe8a", "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 de73adab7d..9e17dccea2 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 97 {}) _lpython_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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) (IntegerConstant 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0b101" (Character 1 5 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (IntegerConstant 64 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0b1000000" (Character 1 9 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) Eq (StringConstant "0b1000000" (Character 1 9 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) Eq (StringConstant "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 95 {}) _lpython_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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) (IntegerConstant 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0b101" (Character 1 5 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (IntegerConstant 64 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0b1000000" (Character 1 9 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) Eq (StringConstant "0b1000000" (Character 1 9 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) Eq (StringConstant "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) (LogicalConstant .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 b618cd7b33..b5eb6fe694 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.json +++ b/tests/reference/asr-test_builtin_bool-330223a.json @@ -2,11 +2,11 @@ "basename": "asr-test_builtin_bool-330223a", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/test_builtin_bool.py", - "infile_hash": "4dfa3350f4c58f8d6375fdde90997ef51a16035983c73dd391086149", + "infile_hash": "6bd508b8960906f9b1c46ead5124a15a4bf3a6568f97e4ae536fda3a", "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_bool-330223a.stdout", - "stdout_hash": "b83fe2967d8ee1b00d66fd6678b9a0ba8d56270796ee0fdd0a0ae93b", + "stdout_hash": "c069d8c39fb7cf57ca661e8b1e5308c2f7a3c05b71cc22aa601c0074", "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 761b3e93c8..06bb0a663a 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 97 {}) _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), bool@__lpython_overloaded_6__bool: (ExternalSymbol 1 bool@__lpython_overloaded_6__bool 4 __lpython_overloaded_6__bool lpython_builtin [] __lpython_overloaded_6__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 4 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 4 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), bool@__lpython_overloaded_9__bool: (ExternalSymbol 1 bool@__lpython_overloaded_9__bool 4 __lpython_overloaded_9__bool lpython_builtin [] __lpython_overloaded_9__bool Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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.), a3: (Variable 2 a3 Local () () Default (Integer 1 []) Source Public Required .false.), a4: (Variable 2 a4 Local () () Default (Integer 2 []) 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), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) ()) (= (Var 2 a) (IntegerConstant 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 (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 a2) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [((Var 2 a2))] (Logical 1 []) () ()) ()) (= (Var 2 a3) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [((Var 2 a3))] (Logical 1 []) () ()) ()) (= (Var 2 a4) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 a4))] (Logical 1 []) () ()) ()) (= (Var 2 f) (RealConstant 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (RealConstant 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 56.786866 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 0.000000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f2) (Cast (UnaryOp USub (RealConstant 235.600000 (Real 8 [])) (Real 8 []) (RealConstant -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 f2))] (Logical 1 []) () ()) ()) (= (Var 2 s) (StringConstant "" (Character 1 0 () [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 s) (StringConstant "str" (Character 1 3 () [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((StringConstant "" (Character 1 0 () [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((StringConstant "str" (Character 1 3 () [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((LogicalConstant .true. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((LogicalConstant .false. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 2.000000 3.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((BinOp (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 0.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((RealConstant 0.100202 (Real 8 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.100202 (Complex 8 [])) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((Var 2 c1))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((BinOp (Cast (IntegerConstant 3 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 95 {}) _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), bool@__lpython_overloaded_6__bool: (ExternalSymbol 1 bool@__lpython_overloaded_6__bool 4 __lpython_overloaded_6__bool lpython_builtin [] __lpython_overloaded_6__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 4 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 4 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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.), a3: (Variable 2 a3 Local () () Default (Integer 1 []) Source Public Required .false.), a4: (Variable 2 a4 Local () () Default (Integer 2 []) 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), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex 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.)}) test_bool [] [(= (Var 2 a) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) ()) (= (Var 2 a) (IntegerConstant 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 (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 a2) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [((Var 2 a2))] (Logical 1 []) () ()) ()) (= (Var 2 a3) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [((Var 2 a3))] (Logical 1 []) () ()) ()) (= (Var 2 a4) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 a4))] (Logical 1 []) () ()) ()) (= (Var 2 f) (RealConstant 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (RealConstant 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 56.786866 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 0.000000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f2) (Cast (UnaryOp USub (RealConstant 235.600000 (Real 8 [])) (Real 8 []) (RealConstant -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 f2))] (Logical 1 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((LogicalConstant .true. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((LogicalConstant .false. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 2.000000 3.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((BinOp (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 0.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((RealConstant 0.100202 (Real 8 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.100202 (Complex 8 [])) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((Var 2 c1))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((BinOp (Cast (IntegerConstant 3 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) ())] 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 171d12f1e9..204bd2adaf 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": "36bc32628917196579424e872a4788210ae67fabe317149970bcc08f", + "stdout_hash": "dd522b179bfb00e2f2c0343225e871a6f09c6db8d068c0cefcdfa384", "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 87b1e23aad..08f8f71e25 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 97 {}) _lpython_main_program [] [(SubroutineCall 1 test_hex () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0x22" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0x108b" (Character 1 7 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 hex () [((IntegerConstant 34 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x22" (Character 1 1 () [])) ()) Eq (StringConstant "0x22" (Character 1 4 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0x108b" (Character 1 1 () [])) ()) Eq (StringConstant "-0x108b" (Character 1 7 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 95 {}) _lpython_main_program [] [(SubroutineCall 1 test_hex () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0x22" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0x108b" (Character 1 7 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 hex () [((IntegerConstant 34 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x22" (Character 1 1 () [])) ()) Eq (StringConstant "0x22" (Character 1 4 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0x108b" (Character 1 1 () [])) ()) Eq (StringConstant "-0x108b" (Character 1 7 () [])) (Logical 4 []) (LogicalConstant .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 31fd13f217..d46b8e5db5 100644 --- a/tests/reference/asr-test_builtin_len-55b0dec.json +++ b/tests/reference/asr-test_builtin_len-55b0dec.json @@ -5,9 +5,9 @@ "infile_hash": "f1540b68424e3c8f59af07f56535997ceda392b5e9c16f1d32c8913e", "outfile": null, "outfile_hash": null, - "stdout": "asr-test_builtin_len-55b0dec.stdout", - "stdout_hash": "3bb11c9908c48b2a469c36cac5cc7219163ac291a697bd1a0ad1bd30", - "stderr": null, - "stderr_hash": null, - "returncode": 0 + "stdout": null, + "stdout_hash": null, + "stderr": "asr-test_builtin_len-55b0dec.stderr", + "stderr_hash": "7a3316e0d950e6cd4ac0f1cb958d3f3c36d6dbba1e1392d711fd43fd", + "returncode": 1 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_oct-20b9066.json b/tests/reference/asr-test_builtin_oct-20b9066.json index 53aeaf1bbd..34f3a1e458 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": "e14d5015d4bb2be92a374be00ca92fcddd520b05f14f706d5cf8c17a", + "stdout_hash": "5553d3c59975c637c8db8048d1f574f40036f3fdddfa9feb65b082d8", "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 6fae380958..01df209098 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 97 {}) _lpython_main_program [] [(SubroutineCall 1 test_oct () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0o42" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0o10213" (Character 1 8 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 oct () [((IntegerConstant 34 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o42" (Character 1 1 () [])) ()) Eq (StringConstant "0o42" (Character 1 4 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o10213" (Character 1 1 () [])) ()) Eq (StringConstant "-0o10213" (Character 1 8 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 95 {}) _lpython_main_program [] [(SubroutineCall 1 test_oct () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0o42" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0o10213" (Character 1 8 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 oct () [((IntegerConstant 34 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o42" (Character 1 1 () [])) ()) Eq (StringConstant "0o42" (Character 1 4 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o10213" (Character 1 1 () [])) ()) Eq (StringConstant "-0o10213" (Character 1 8 () [])) (Logical 4 []) (LogicalConstant .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 fd7bf7978e..cbae2db9ba 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": "8de147b60237a40e4dd55c7a97b1f1a0f8a0b89d13907c5a5854a9b2", + "stdout_hash": "f36a315a7ec4c341d33a1134111901220e9ea387c828ea85e7f14c97", "stderr": "asr-test_builtin_pow-f02fcda.stderr", "stderr_hash": "180e1adfbb0d9c63a2fffa31951bbd629b3f1950cf0d97ca1389efe5", "returncode": 0 diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.stdout b/tests/reference/asr-test_builtin_pow-f02fcda.stdout index 71662545e7..d66f912218 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 97 {}) _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), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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), pow@__lpython_overloaded_4__pow: (ExternalSymbol 1 pow@__lpython_overloaded_4__pow 4 __lpython_overloaded_4__pow lpython_builtin [] __lpython_overloaded_4__pow Public), pow@__lpython_overloaded_5__pow: (ExternalSymbol 1 pow@__lpython_overloaded_5__pow 4 __lpython_overloaded_5__pow lpython_builtin [] __lpython_overloaded_5__pow Public), pow@__lpython_overloaded_6__pow: (ExternalSymbol 1 pow@__lpython_overloaded_6__pow 4 __lpython_overloaded_6__pow lpython_builtin [] __lpython_overloaded_6__pow Public), pow@__lpython_overloaded_7__pow: (ExternalSymbol 1 pow@__lpython_overloaded_7__pow 4 __lpython_overloaded_7__pow lpython_builtin [] __lpython_overloaded_7__pow Public), pow@__lpython_overloaded_8__pow: (ExternalSymbol 1 pow@__lpython_overloaded_8__pow 4 __lpython_overloaded_8__pow lpython_builtin [] __lpython_overloaded_8__pow Public), pow@__lpython_overloaded_9__pow: (ExternalSymbol 1 pow@__lpython_overloaded_9__pow 4 __lpython_overloaded_9__pow lpython_builtin [] __lpython_overloaded_9__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a1: (Variable 2 a1 Local () (RealConstant 4.500000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), a2: (Variable 2 a2 Local () (RealConstant 2.300000 (Real 8 [])) 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.), b1: (Variable 2 b1 Local () (LogicalConstant .true. (Logical 1 [])) Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () (LogicalConstant .false. (Logical 1 [])) Default (Logical 1 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private), eps: (Variable 2 eps Local () () Default (Real 8 []) Source Public Required .false.), f1: (Variable 2 f1 Local () () Default (Real 4 []) Source Public Required .false.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), i1: (Variable 2 i1 Local () () Default (Integer 8 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 8 []) Source Public Required .false.), p: (Variable 2 p Local () () Default (Real 4 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private), x: (Variable 2 x Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () (RealConstant 2.300000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.)}) test_pow [] [(= (Var 2 eps) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 32 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 6 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 3 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 216 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) ()) (= (Var 2 a) (IntegerConstant 6 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))) ()) (= (Var 2 i1) (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 i2) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 i1)) ((Var 2 i2))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 32 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 i1) (Cast (IntegerConstant 6 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 i2) (Cast (UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 f1) (Cast (BinOp (Cast (IntegerConstant 525346 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Div (Cast (IntegerConstant 66456 (Integer 4 [])) IntegerToReal (Real 8 []) ()) (Real 8 []) () ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 f2) (Cast (RealConstant 3.000000 (Real 8 [])) RealToReal (Real 4 []) ()) ()) (= (Var 2 p) (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 f1)) ((Var 2 f2))] (Real 4 []) () ()) ()) (= (Var 2 f1) (FunctionCall 1 pow@__lpython_overloaded_4__pow 2 pow [((Var 2 a)) ((Var 2 f2))] (Real 4 []) () ()) ()) (= (Var 2 f1) (FunctionCall 1 pow@__lpython_overloaded_5__pow 2 pow [((Var 2 f2)) ((Var 2 a))] (Real 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b1)) ((Var 2 b2))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b2)) ((Var 2 b1))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b1)) ((Var 2 b2))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((LogicalConstant .false. (Logical 1 []))) ((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (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 a1)) ((Var 2 a2))] (Real 8 []) (RealConstant 31.797193 (Real 8 [])) ()) Sub (RealConstant 31.797193 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((Var 2 a2)) ((Var 2 a1))] (Real 8 []) (RealConstant 42.439989 (Real 8 [])) ()) Sub (RealConstant 42.439989 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((Var 2 x)) ((Var 2 y))] (Real 8 []) (RealConstant 12.513503 (Real 8 [])) ()) Sub (RealConstant 12.513503 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((Var 2 y)) ((Var 2 x))] (Real 8 []) (RealConstant 12.167000 (Real 8 [])) ()) Sub (RealConstant 12.167000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((Var 2 x)) ((RealConstant 5.500000 (Real 8 [])))] (Real 8 []) (RealConstant 420.888346 (Real 8 [])) ()) Sub (RealConstant 420.888346 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.500000 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 6 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 [])))) ((UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))))] (Integer 4 []) (RealConstant -0.004115 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Add (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 6 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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_3__pow 2 pow [((RealConstant 4.500000 (Real 8 []))) ((RealConstant 2.300000 (Real 8 [])))] (Real 8 []) (RealConstant 31.797193 (Real 8 [])) ()) Sub (RealConstant 31.797193 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((RealConstant 2.300000 (Real 8 []))) ((RealConstant 0.000000 (Real 8 [])))] (Real 8 []) (RealConstant 1.000000 (Real 8 [])) ()) Sub (RealConstant 1.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((RealConstant 2.300000 (Real 8 []))) ((UnaryOp USub (RealConstant 1.500000 (Real 8 [])) (Real 8 []) (RealConstant -1.500000 (Real 8 []))))] (Real 8 []) (RealConstant 0.286687 (Real 8 [])) ()) Sub (RealConstant 0.286687 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 3.400000 (Real 8 [])))] (Real 8 []) (RealConstant 10.556063 (Real 8 [])) ()) Sub (RealConstant 10.556063 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((UnaryOp USub (RealConstant 3.400000 (Real 8 [])) (Real 8 []) (RealConstant -3.400000 (Real 8 []))))] (Real 8 []) (RealConstant 0.094732 (Real 8 [])) ()) Sub (RealConstant 0.094732 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((RealConstant 3.400000 (Real 8 []))) ((IntegerConstant 9 (Integer 4 [])))] (Real 8 []) (RealConstant 60716.992766 (Real 8 [])) ()) Sub (RealConstant 60716.992766 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((RealConstant 0.000000 (Real 8 []))) ((IntegerConstant 53 (Integer 4 [])))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Sub (RealConstant 0.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 16 (Integer 4 [])) ()) Eq (IntegerConstant 16 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_7__pow 2 pow [((UnaryOp USub (RealConstant 4235.000000 (Real 8 [])) (Real 8 []) (RealConstant -4235.000000 (Real 8 [])))) ((IntegerConstant 52 (Integer 4 [])))] (Real 8 []) (RealConstant 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) ()) Sub (RealConstant 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 pow@__lpython_overloaded_9__pow 2 pow [((Var 2 c1)) ((IntegerConstant 4 (Integer 4 [])))] (Complex 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 95 {}) _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), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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), pow@__lpython_overloaded_4__pow: (ExternalSymbol 1 pow@__lpython_overloaded_4__pow 4 __lpython_overloaded_4__pow lpython_builtin [] __lpython_overloaded_4__pow Public), pow@__lpython_overloaded_5__pow: (ExternalSymbol 1 pow@__lpython_overloaded_5__pow 4 __lpython_overloaded_5__pow lpython_builtin [] __lpython_overloaded_5__pow Public), pow@__lpython_overloaded_6__pow: (ExternalSymbol 1 pow@__lpython_overloaded_6__pow 4 __lpython_overloaded_6__pow lpython_builtin [] __lpython_overloaded_6__pow Public), pow@__lpython_overloaded_7__pow: (ExternalSymbol 1 pow@__lpython_overloaded_7__pow 4 __lpython_overloaded_7__pow lpython_builtin [] __lpython_overloaded_7__pow Public), pow@__lpython_overloaded_8__pow: (ExternalSymbol 1 pow@__lpython_overloaded_8__pow 4 __lpython_overloaded_8__pow lpython_builtin [] __lpython_overloaded_8__pow Public), pow@__lpython_overloaded_9__pow: (ExternalSymbol 1 pow@__lpython_overloaded_9__pow 4 __lpython_overloaded_9__pow lpython_builtin [] __lpython_overloaded_9__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a1: (Variable 2 a1 Local () (RealConstant 4.500000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), a2: (Variable 2 a2 Local () (RealConstant 2.300000 (Real 8 [])) 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.), b1: (Variable 2 b1 Local () (LogicalConstant .true. (Logical 1 [])) Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () (LogicalConstant .false. (Logical 1 [])) Default (Logical 1 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private), eps: (Variable 2 eps Local () () Default (Real 8 []) Source Public Required .false.), f1: (Variable 2 f1 Local () () Default (Real 4 []) Source Public Required .false.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), i1: (Variable 2 i1 Local () () Default (Integer 8 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 8 []) Source Public Required .false.), p: (Variable 2 p Local () () Default (Real 4 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private), x: (Variable 2 x Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () (RealConstant 2.300000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.)}) test_pow [] [(= (Var 2 eps) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 32 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 6 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 3 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 216 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) ()) (= (Var 2 a) (IntegerConstant 6 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))) ()) (= (Var 2 i1) (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 i2) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 i1)) ((Var 2 i2))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 32 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 i1) (Cast (IntegerConstant 6 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 i2) (Cast (UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 f1) (Cast (BinOp (Cast (IntegerConstant 525346 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Div (Cast (IntegerConstant 66456 (Integer 4 [])) IntegerToReal (Real 8 []) ()) (Real 8 []) () ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 f2) (Cast (RealConstant 3.000000 (Real 8 [])) RealToReal (Real 4 []) ()) ()) (= (Var 2 p) (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 f1)) ((Var 2 f2))] (Real 4 []) () ()) ()) (= (Var 2 f1) (FunctionCall 1 pow@__lpython_overloaded_4__pow 2 pow [((Var 2 a)) ((Var 2 f2))] (Real 4 []) () ()) ()) (= (Var 2 f1) (FunctionCall 1 pow@__lpython_overloaded_5__pow 2 pow [((Var 2 f2)) ((Var 2 a))] (Real 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b1)) ((Var 2 b2))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b2)) ((Var 2 b1))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b1)) ((Var 2 b2))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((LogicalConstant .false. (Logical 1 []))) ((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (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 a1)) ((Var 2 a2))] (Real 8 []) (RealConstant 31.797193 (Real 8 [])) ()) Sub (RealConstant 31.797193 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((Var 2 a2)) ((Var 2 a1))] (Real 8 []) (RealConstant 42.439989 (Real 8 [])) ()) Sub (RealConstant 42.439989 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((Var 2 x)) ((Var 2 y))] (Real 8 []) (RealConstant 12.513503 (Real 8 [])) ()) Sub (RealConstant 12.513503 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((Var 2 y)) ((Var 2 x))] (Real 8 []) (RealConstant 12.167000 (Real 8 [])) ()) Sub (RealConstant 12.167000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((Var 2 x)) ((RealConstant 5.500000 (Real 8 [])))] (Real 8 []) (RealConstant 420.888346 (Real 8 [])) ()) Sub (RealConstant 420.888346 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.500000 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 6 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 [])))) ((UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))))] (Integer 4 []) (RealConstant -0.004115 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Add (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 6 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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_3__pow 2 pow [((RealConstant 4.500000 (Real 8 []))) ((RealConstant 2.300000 (Real 8 [])))] (Real 8 []) (RealConstant 31.797193 (Real 8 [])) ()) Sub (RealConstant 31.797193 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((RealConstant 2.300000 (Real 8 []))) ((RealConstant 0.000000 (Real 8 [])))] (Real 8 []) (RealConstant 1.000000 (Real 8 [])) ()) Sub (RealConstant 1.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((RealConstant 2.300000 (Real 8 []))) ((UnaryOp USub (RealConstant 1.500000 (Real 8 [])) (Real 8 []) (RealConstant -1.500000 (Real 8 []))))] (Real 8 []) (RealConstant 0.286687 (Real 8 [])) ()) Sub (RealConstant 0.286687 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 3.400000 (Real 8 [])))] (Real 8 []) (RealConstant 10.556063 (Real 8 [])) ()) Sub (RealConstant 10.556063 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((UnaryOp USub (RealConstant 3.400000 (Real 8 [])) (Real 8 []) (RealConstant -3.400000 (Real 8 []))))] (Real 8 []) (RealConstant 0.094732 (Real 8 [])) ()) Sub (RealConstant 0.094732 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((RealConstant 3.400000 (Real 8 []))) ((IntegerConstant 9 (Integer 4 [])))] (Real 8 []) (RealConstant 60716.992766 (Real 8 [])) ()) Sub (RealConstant 60716.992766 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((RealConstant 0.000000 (Real 8 []))) ((IntegerConstant 53 (Integer 4 [])))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Sub (RealConstant 0.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 16 (Integer 4 [])) ()) Eq (IntegerConstant 16 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_7__pow 2 pow [((UnaryOp USub (RealConstant 4235.000000 (Real 8 [])) (Real 8 []) (RealConstant -4235.000000 (Real 8 [])))) ((IntegerConstant 52 (Integer 4 [])))] (Real 8 []) (RealConstant 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) ()) Sub (RealConstant 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 pow@__lpython_overloaded_9__pow 2 pow [((Var 2 c1)) ((IntegerConstant 4 (Integer 4 [])))] (Complex 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 cac9fefdaa..9b8dda1c1c 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": "677ed9ad1fdaea8c1be96b015ee55b35923481a0f97d3c0bab596f2d", + "stdout_hash": "5ff8351a86651e338380cd112bd849b23edc5c0cfe6b5dec98344899", "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 718b4717aa..1e76870f2d 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 97 {}) _lpython_main_program [] [(SubroutineCall 1 test_round () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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), round@__lpython_overloaded_3__round: (ExternalSymbol 1 round@__lpython_overloaded_3__round 4 __lpython_overloaded_3__round lpython_builtin [] __lpython_overloaded_3__round Public), round@__lpython_overloaded_4__round: (ExternalSymbol 1 round@__lpython_overloaded_4__round 4 __lpython_overloaded_4__round lpython_builtin [] __lpython_overloaded_4__round Public), round@__lpython_overloaded_5__round: (ExternalSymbol 1 round@__lpython_overloaded_5__round 4 __lpython_overloaded_5__round lpython_builtin [] __lpython_overloaded_5__round Public), round@__lpython_overloaded_6__round: (ExternalSymbol 1 round@__lpython_overloaded_6__round 4 __lpython_overloaded_6__round lpython_builtin [] __lpython_overloaded_6__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.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 1 []) Source Public Required .false.), i3: (Variable 2 i3 Local () () Default (Integer 2 []) Source Public Required .false.), i4: (Variable 2 i4 Local () () Default (Integer 8 []) Source Public Required .false.), round: (ExternalSymbol 2 round 4 round lpython_builtin [] round Private)}) test_round [] [(= (Var 2 f) (RealConstant 5.678000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (UnaryOp USub (RealConstant 183745.230000 (Real 8 [])) (Real 8 []) (RealConstant -183745.230000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 183745 (Integer 4 [])) (Integer 4 []) (IntegerConstant -183745 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 44.340000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 44 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 0.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (UnaryOp USub (RealConstant 50.500000 (Real 8 [])) (Real 8 []) (RealConstant -50.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 50 (Integer 4 [])) (Integer 4 []) (IntegerConstant -50 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 1.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 13.001000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 13 (Integer 4 [])) ()) Eq (IntegerConstant 13 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (RealConstant 40.499990 (Real 8 [])) (Real 8 []) (RealConstant -40.499990 (Real 8 []))))] (Integer 4 []) (IntegerConstant -40 (Integer 4 [])) ()) Eq (UnaryOp USub (IntegerConstant 40 (Integer 4 [])) (Integer 4 []) (IntegerConstant -40 (Integer 4 []))) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 0.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (RealConstant 0.500000 (Real 8 [])) (Real 8 []) (RealConstant -0.500000 (Real 8 []))))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 1.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 2 (Integer 4 [])) ()) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 50.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 50 (Integer 4 [])) ()) Eq (IntegerConstant 50 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 56.780000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 57 (Integer 4 [])) ()) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 f2) (Cast (RealConstant 5.678000 (Real 8 [])) RealToReal (Real 4 []) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((Var 2 f2))] (Integer 4 []) () ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 i))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((IntegerConstant 4 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ()) Eq (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 i2) (Cast (IntegerConstant 7 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 round@__lpython_overloaded_4__round 2 round [((Var 2 i2))] (Integer 1 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 7 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i3) (Cast (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 round@__lpython_overloaded_5__round 2 round [((Var 2 i3))] (Integer 2 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 i4) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_3__round 2 round [((Var 2 i4))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 95 {}) _lpython_main_program [] [(SubroutineCall 1 test_round () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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), round@__lpython_overloaded_3__round: (ExternalSymbol 1 round@__lpython_overloaded_3__round 4 __lpython_overloaded_3__round lpython_builtin [] __lpython_overloaded_3__round Public), round@__lpython_overloaded_4__round: (ExternalSymbol 1 round@__lpython_overloaded_4__round 4 __lpython_overloaded_4__round lpython_builtin [] __lpython_overloaded_4__round Public), round@__lpython_overloaded_5__round: (ExternalSymbol 1 round@__lpython_overloaded_5__round 4 __lpython_overloaded_5__round lpython_builtin [] __lpython_overloaded_5__round Public), round@__lpython_overloaded_6__round: (ExternalSymbol 1 round@__lpython_overloaded_6__round 4 __lpython_overloaded_6__round lpython_builtin [] __lpython_overloaded_6__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.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 1 []) Source Public Required .false.), i3: (Variable 2 i3 Local () () Default (Integer 2 []) Source Public Required .false.), i4: (Variable 2 i4 Local () () Default (Integer 8 []) Source Public Required .false.), round: (ExternalSymbol 2 round 4 round lpython_builtin [] round Private)}) test_round [] [(= (Var 2 f) (RealConstant 5.678000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (UnaryOp USub (RealConstant 183745.230000 (Real 8 [])) (Real 8 []) (RealConstant -183745.230000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 183745 (Integer 4 [])) (Integer 4 []) (IntegerConstant -183745 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 44.340000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 44 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 0.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (UnaryOp USub (RealConstant 50.500000 (Real 8 [])) (Real 8 []) (RealConstant -50.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 50 (Integer 4 [])) (Integer 4 []) (IntegerConstant -50 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 1.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 13.001000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 13 (Integer 4 [])) ()) Eq (IntegerConstant 13 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (RealConstant 40.499990 (Real 8 [])) (Real 8 []) (RealConstant -40.499990 (Real 8 []))))] (Integer 4 []) (IntegerConstant -40 (Integer 4 [])) ()) Eq (UnaryOp USub (IntegerConstant 40 (Integer 4 [])) (Integer 4 []) (IntegerConstant -40 (Integer 4 []))) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 0.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (RealConstant 0.500000 (Real 8 [])) (Real 8 []) (RealConstant -0.500000 (Real 8 []))))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 1.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 2 (Integer 4 [])) ()) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 50.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 50 (Integer 4 [])) ()) Eq (IntegerConstant 50 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 56.780000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 57 (Integer 4 [])) ()) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 f2) (Cast (RealConstant 5.678000 (Real 8 [])) RealToReal (Real 4 []) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((Var 2 f2))] (Integer 4 []) () ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 i))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((IntegerConstant 4 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ()) Eq (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 i2) (Cast (IntegerConstant 7 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 round@__lpython_overloaded_4__round 2 round [((Var 2 i2))] (Integer 1 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 7 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i3) (Cast (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 round@__lpython_overloaded_5__round 2 round [((Var 2 i3))] (Integer 2 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 i4) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_3__round 2 round [((Var 2 i4))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .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 59cf1529d7..2ea0b3475e 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": "26ccda1447736d73f7e9dd377a9085ea6c7dff348dd956e1d5e2b47d", + "stdout_hash": "6c389bcb6e7ee40ce8ba0f55489c3fca8e62ca6e05ec5d699668fe1f", "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 4b0fda75a3..99467a3cbb 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 97 {}) _lpython_main_program [] [(SubroutineCall 1 test_str_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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 () [((IntegerConstant 356 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "356" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (StringConstant "356" (Character 1 3 () [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (FunctionCall 2 str () [((UnaryOp USub (IntegerConstant 567 (Integer 4 [])) (Integer 4 []) (IntegerConstant -567 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-567" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (StringConstant "-567" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 str () [((IntegerConstant 4 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "4" (Character 1 1 () [])) ()) Eq (StringConstant "4" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 str () [((UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-5" (Character 1 1 () [])) ()) Eq (StringConstant "-5" (Character 1 2 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 95 {}) _lpython_main_program [] [(SubroutineCall 1 test_str_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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 () [((IntegerConstant 356 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "356" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (StringConstant "356" (Character 1 3 () [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (FunctionCall 2 str () [((UnaryOp USub (IntegerConstant 567 (Integer 4 [])) (Integer 4 []) (IntegerConstant -567 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-567" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (StringConstant "-567" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 str () [((IntegerConstant 4 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "4" (Character 1 1 () [])) ()) Eq (StringConstant "4" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 str () [((UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-5" (Character 1 1 () [])) ()) Eq (StringConstant "-5" (Character 1 2 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_list_concat-41d186f.stdout b/tests/reference/asr-test_list_concat-41d186f.stdout new file mode 100644 index 0000000000..ebb51fc3ad --- /dev/null +++ b/tests/reference/asr-test_list_concat-41d186f.stdout @@ -0,0 +1 @@ +(TranslationUnit (SymbolTable 1 {main: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (List (Integer 4 [])) Source Public Required .false.), b: (Variable 2 b Local () () Default (List (Real 4 [])) Source Public Required .false.)}) main [] [(= (Var 2 a) (ListConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 []))] (List (Integer 4 []))) ()) (= (Var 2 b) (ListConstant [(RealConstant 1.200000 (Real 8 [])) (RealConstant 3.400000 (Real 8 []))] (List (Real 8 []))) ()) (= (Var 2 a) (ListConcat (Var 2 a) (Var 2 b) (List (Integer 4 [])) ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 3 {}) main_program [] [])}) []) diff --git a/tests/reference/asr-test_max_min-3c2fc51.json b/tests/reference/asr-test_max_min-3c2fc51.json index 603e07e4eb..f792a7e735 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.json +++ b/tests/reference/asr-test_max_min-3c2fc51.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_max_min-3c2fc51.stdout", - "stdout_hash": "e2533628dcc91553b33df1d2e628c8f52f5420f8f3df1f4234258e62", + "stdout_hash": "ce739149ef22b49c0024d69c1ea65c2cb6ddf75962df3b2a2ada5014", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_max_min-3c2fc51.stdout b/tests/reference/asr-test_max_min-3c2fc51.stdout index 9ddce66daf..91fc79b521 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.stdout +++ b/tests/reference/asr-test_max_min-3c2fc51.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 101 {}) _lpython_main_program [] [(SubroutineCall 1 check () [] ())] Source Public Implementation () .false. .false.), check: (Subroutine (SymbolTable 6 {}) check [] [(SubroutineCall 1 test_max_int () [] ()) (SubroutineCall 1 test_max_float () [] ()) (SubroutineCall 1 test_min_int () [] ()) (SubroutineCall 1 test_min_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 100 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), max@__lpython_overloaded_0__max: (ExternalSymbol 1 max@__lpython_overloaded_0__max 8 __lpython_overloaded_0__max lpython_builtin [] __lpython_overloaded_0__max Public), max@__lpython_overloaded_1__max: (ExternalSymbol 1 max@__lpython_overloaded_1__max 8 __lpython_overloaded_1__max lpython_builtin [] __lpython_overloaded_1__max Public), max@__lpython_overloaded_2__max: (ExternalSymbol 1 max@__lpython_overloaded_2__max 8 __lpython_overloaded_2__max lpython_builtin [] __lpython_overloaded_2__max Public), max@__lpython_overloaded_3__max: (ExternalSymbol 1 max@__lpython_overloaded_3__max 8 __lpython_overloaded_3__max lpython_builtin [] __lpython_overloaded_3__max Public), min@__lpython_overloaded_0__min: (ExternalSymbol 1 min@__lpython_overloaded_0__min 8 __lpython_overloaded_0__min lpython_builtin [] __lpython_overloaded_0__min Public), min@__lpython_overloaded_1__min: (ExternalSymbol 1 min@__lpython_overloaded_1__min 8 __lpython_overloaded_1__min lpython_builtin [] __lpython_overloaded_1__min Public), min@__lpython_overloaded_2__min: (ExternalSymbol 1 min@__lpython_overloaded_2__min 8 __lpython_overloaded_2__min lpython_builtin [] __lpython_overloaded_2__min Public), min@__lpython_overloaded_3__min: (ExternalSymbol 1 min@__lpython_overloaded_3__min 8 __lpython_overloaded_3__min lpython_builtin [] __lpython_overloaded_3__min Public), test_max_float: (Subroutine (SymbolTable 3 {d: (Variable 3 d Local () (RealConstant 23.233000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), e: (Variable 3 e Local () (RealConstant 23.223300 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), f: (Variable 3 f Local () (RealConstant 21.230000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), max: (ExternalSymbol 3 max 8 max lpython_builtin [] max Private)}) test_max_float [] [(Assert (Compare (FunctionCall 1 max@__lpython_overloaded_2__max 3 max [((Var 3 d)) ((Var 3 e)) ((Var 3 f))] (Real 8 []) (RealConstant 23.233000 (Real 8 [])) ()) Eq (Var 3 d) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_3__max 3 max [((Var 3 e)) ((Var 3 f))] (Real 8 []) (RealConstant 23.223300 (Real 8 [])) ()) Eq (Var 3 e) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_max_int: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () (IntegerConstant 1 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () (IntegerConstant 2 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), c: (Variable 2 c Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), max: (ExternalSymbol 2 max 8 max lpython_builtin [] max Private)}) test_max_int [] [(Assert (Compare (FunctionCall 1 max@__lpython_overloaded_0__max 2 max [((Var 2 a)) ((Var 2 b))] (Integer 4 []) (IntegerConstant 2 (Integer 4 [])) ()) Eq (Var 2 b) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_1__max 2 max [((Var 2 a)) ((Var 2 b)) ((Var 2 c))] (Integer 4 []) (IntegerConstant 3 (Integer 4 [])) ()) Eq (Var 2 c) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_1__max 2 max [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 3 (Integer 4 [])) ()) Eq (IntegerConstant 3 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_0__max 2 max [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 6 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 6 (Integer 4 [])) ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_min_float: (Subroutine (SymbolTable 5 {d: (Variable 5 d Local () (RealConstant 23.233000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), e: (Variable 5 e Local () (RealConstant 23.223300 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), f: (Variable 5 f Local () (RealConstant 21.230000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), min: (ExternalSymbol 5 min 8 min lpython_builtin [] min Private)}) test_min_float [] [(Assert (Compare (FunctionCall 1 min@__lpython_overloaded_2__min 5 min [((Var 5 d)) ((Var 5 e)) ((Var 5 f))] (Real 8 []) (RealConstant 21.230000 (Real 8 [])) ()) Eq (Var 5 f) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_3__min 5 min [((Var 5 e)) ((Var 5 f))] (Real 8 []) (RealConstant 21.230000 (Real 8 [])) ()) Eq (Var 5 f) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_min_int: (Subroutine (SymbolTable 4 {a: (Variable 4 a Local () (IntegerConstant 1 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), b: (Variable 4 b Local () (IntegerConstant 2 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), c: (Variable 4 c Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), min: (ExternalSymbol 4 min 8 min lpython_builtin [] min Private)}) test_min_int [] [(Assert (Compare (FunctionCall 1 min@__lpython_overloaded_0__min 4 min [((Var 4 a)) ((Var 4 b))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (Var 4 a) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_1__min 4 min [((Var 4 a)) ((Var 4 b)) ((Var 4 c))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (Var 4 a) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_1__min 4 min [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_0__min 4 min [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 6 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 99 {}) _lpython_main_program [] [(SubroutineCall 1 check () [] ())] Source Public Implementation () .false. .false.), check: (Subroutine (SymbolTable 6 {}) check [] [(SubroutineCall 1 test_max_int () [] ()) (SubroutineCall 1 test_max_float () [] ()) (SubroutineCall 1 test_min_int () [] ()) (SubroutineCall 1 test_min_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 98 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), max@__lpython_overloaded_0__max: (ExternalSymbol 1 max@__lpython_overloaded_0__max 8 __lpython_overloaded_0__max lpython_builtin [] __lpython_overloaded_0__max Public), max@__lpython_overloaded_1__max: (ExternalSymbol 1 max@__lpython_overloaded_1__max 8 __lpython_overloaded_1__max lpython_builtin [] __lpython_overloaded_1__max Public), max@__lpython_overloaded_2__max: (ExternalSymbol 1 max@__lpython_overloaded_2__max 8 __lpython_overloaded_2__max lpython_builtin [] __lpython_overloaded_2__max Public), max@__lpython_overloaded_3__max: (ExternalSymbol 1 max@__lpython_overloaded_3__max 8 __lpython_overloaded_3__max lpython_builtin [] __lpython_overloaded_3__max Public), min@__lpython_overloaded_0__min: (ExternalSymbol 1 min@__lpython_overloaded_0__min 8 __lpython_overloaded_0__min lpython_builtin [] __lpython_overloaded_0__min Public), min@__lpython_overloaded_1__min: (ExternalSymbol 1 min@__lpython_overloaded_1__min 8 __lpython_overloaded_1__min lpython_builtin [] __lpython_overloaded_1__min Public), min@__lpython_overloaded_2__min: (ExternalSymbol 1 min@__lpython_overloaded_2__min 8 __lpython_overloaded_2__min lpython_builtin [] __lpython_overloaded_2__min Public), min@__lpython_overloaded_3__min: (ExternalSymbol 1 min@__lpython_overloaded_3__min 8 __lpython_overloaded_3__min lpython_builtin [] __lpython_overloaded_3__min Public), test_max_float: (Subroutine (SymbolTable 3 {d: (Variable 3 d Local () (RealConstant 23.233000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), e: (Variable 3 e Local () (RealConstant 23.223300 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), f: (Variable 3 f Local () (RealConstant 21.230000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), max: (ExternalSymbol 3 max 8 max lpython_builtin [] max Private)}) test_max_float [] [(Assert (Compare (FunctionCall 1 max@__lpython_overloaded_2__max 3 max [((Var 3 d)) ((Var 3 e)) ((Var 3 f))] (Real 8 []) (RealConstant 23.233000 (Real 8 [])) ()) Eq (Var 3 d) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_3__max 3 max [((Var 3 e)) ((Var 3 f))] (Real 8 []) (RealConstant 23.223300 (Real 8 [])) ()) Eq (Var 3 e) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_max_int: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () (IntegerConstant 1 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () (IntegerConstant 2 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), c: (Variable 2 c Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), max: (ExternalSymbol 2 max 8 max lpython_builtin [] max Private)}) test_max_int [] [(Assert (Compare (FunctionCall 1 max@__lpython_overloaded_0__max 2 max [((Var 2 a)) ((Var 2 b))] (Integer 4 []) (IntegerConstant 2 (Integer 4 [])) ()) Eq (Var 2 b) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_1__max 2 max [((Var 2 a)) ((Var 2 b)) ((Var 2 c))] (Integer 4 []) (IntegerConstant 3 (Integer 4 [])) ()) Eq (Var 2 c) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_1__max 2 max [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 3 (Integer 4 [])) ()) Eq (IntegerConstant 3 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_0__max 2 max [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 6 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 6 (Integer 4 [])) ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_min_float: (Subroutine (SymbolTable 5 {d: (Variable 5 d Local () (RealConstant 23.233000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), e: (Variable 5 e Local () (RealConstant 23.223300 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), f: (Variable 5 f Local () (RealConstant 21.230000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), min: (ExternalSymbol 5 min 8 min lpython_builtin [] min Private)}) test_min_float [] [(Assert (Compare (FunctionCall 1 min@__lpython_overloaded_2__min 5 min [((Var 5 d)) ((Var 5 e)) ((Var 5 f))] (Real 8 []) (RealConstant 21.230000 (Real 8 [])) ()) Eq (Var 5 f) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_3__min 5 min [((Var 5 e)) ((Var 5 f))] (Real 8 []) (RealConstant 21.230000 (Real 8 [])) ()) Eq (Var 5 f) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_min_int: (Subroutine (SymbolTable 4 {a: (Variable 4 a Local () (IntegerConstant 1 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), b: (Variable 4 b Local () (IntegerConstant 2 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), c: (Variable 4 c Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), min: (ExternalSymbol 4 min 8 min lpython_builtin [] min Private)}) test_min_int [] [(Assert (Compare (FunctionCall 1 min@__lpython_overloaded_0__min 4 min [((Var 4 a)) ((Var 4 b))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (Var 4 a) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_1__min 4 min [((Var 4 a)) ((Var 4 b)) ((Var 4 c))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (Var 4 a) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_1__min 4 min [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_0__min 4 min [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 6 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_pow-3f5d550.json b/tests/reference/asr-test_pow-3f5d550.json index 90fca31226..03188cbebf 100644 --- a/tests/reference/asr-test_pow-3f5d550.json +++ b/tests/reference/asr-test_pow-3f5d550.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_pow-3f5d550.stdout", - "stdout_hash": "1d95b02ebb991f178184b28e37de1d4482d196ccf25c24e31e04684d", + "stdout_hash": "f858dfd71bd4743a60b2677bfe94886076efd1e87e78c295c00c8dd4", "stderr": "asr-test_pow-3f5d550.stderr", "stderr_hash": "3d950301563cce75654f28bf41f6f53428ed1f5ae997774345f374a3", "returncode": 0 diff --git a/tests/reference/asr-test_pow-3f5d550.stdout b/tests/reference/asr-test_pow-3f5d550.stdout index d99f001522..e7444c7cb4 100644 --- a/tests/reference/asr-test_pow-3f5d550.stdout +++ b/tests/reference/asr-test_pow-3f5d550.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 97 {}) _lpython_main_program [] [(SubroutineCall 1 main () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main: (Subroutine (SymbolTable 2 {pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private)}) main [] [(Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ())]) (Print () [(BinOp (IntegerConstant 2 (Integer 4 [])) Pow (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 96 {}) 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)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 95 {}) _lpython_main_program [] [(SubroutineCall 1 main () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main: (Subroutine (SymbolTable 2 {pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private)}) main [] [(Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ())]) (Print () [(BinOp (IntegerConstant 2 (Integer 4 [])) Pow (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 94 {}) 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)}) []) diff --git a/tests/reference/ast-constants1-91cb6ff.json b/tests/reference/ast-constants1-91cb6ff.json index 174a6f18db..e7e792678e 100644 --- a/tests/reference/ast-constants1-91cb6ff.json +++ b/tests/reference/ast-constants1-91cb6ff.json @@ -2,11 +2,11 @@ "basename": "ast-constants1-91cb6ff", "cmd": "lpython --show-ast --no-color {infile} -o {outfile}", "infile": "tests/constants1.py", - "infile_hash": "0410dc29468f90206a5c2aab56a9761c8d2ffcb239de210d3df2b14f", + "infile_hash": "86d7dacf1572246948121f4ef0aaddd1cb8be614c003453e8faae162", "outfile": null, "outfile_hash": null, "stdout": "ast-constants1-91cb6ff.stdout", - "stdout_hash": "8deb8a82c17881db182de12815703c8c157c6fb6bb9a219b3ed28a81", + "stdout_hash": "79aad97436e7b1514a6f3f74210accc7ab2cacb0f17203e5bbffdd29", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-constants1-91cb6ff.stdout b/tests/reference/ast-constants1-91cb6ff.stdout index 1683f367a5..bffcaf9299 100644 --- a/tests/reference/ast-constants1-91cb6ff.stdout +++ b/tests/reference/ast-constants1-91cb6ff.stdout @@ -1 +1 @@ -(Module [(FunctionDef test_boz ([] [] [] [] [] [] []) [(AnnAssign (Name b Store) (Name str Load) () 1) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 64 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 8 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 56 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 42 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 12648430 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ())] [] () ()) (FunctionDef test_ord_chr ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name ord Load) [(ConstantStr "5" ())] []) ()) (Assign [(Name s Store)] (Call (Name chr Load) [(ConstantInt 43 ())] []) ())] [] () ()) (FunctionDef test_abs ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantInt 500 ()))] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .true. ())] []) ()) (AnnAssign (Name b Store) (Name f32 Load) () 1) (Assign [(Name b Store)] (Call (Name abs Load) [(ConstantFloat 3.450000 ())] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantFloat 5346.340000 ()))] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(Call (Name complex Load) [(ConstantFloat 3.450000 ()) (ConstantFloat 5.600000 ())] [])] []) ())] [] () ()) (FunctionDef test_len ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "this is a test" ())] []) ())] [] () ()) (FunctionDef test_bool ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantInt 0 ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(Call (Name complex Load) [(ConstantInt 0 ()) (ConstantInt 0 ())] [])] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "t" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantFloat 2.300000 ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ())] [] () ()) (FunctionDef test_str ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (Assign [(Name s Store)] (Call (Name str Load) [] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(UnaryOp USub (ConstantInt 4 ()))] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantFloat 5.600000 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_callable ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (AnnAssign (Name b Store) (Name i32 Load) () 1) (Assign [(Name b Store)] (ConstantInt 2 ()) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name test_len Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name b Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(ConstantStr "c" ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ())] [] () ()) (FunctionDef test_int ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i64 Load) () 1) (Assign [(Name a Store)] (Call (Name int Load) [] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(UnaryOp USub (ConstantFloat 5.000010 ()))] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .false. ())] []) ())] [] () ()) (FunctionDef test_float ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name f64 Load) () 1) (Assign [(Name a Store)] (Call (Name float Load) [] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .false. ())] []) ())] [] () ()) (FunctionDef test_divmod ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Subscript (Name tuple Load) (Tuple [(Name i32 Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (UnaryOp USub (ConstantInt 3 ()))] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 3 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 4 ()) (ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 0 ()) (ConstantInt 5 ())] []) ())] [] () ())] []) +(Module [(FunctionDef test_boz ([] [] [] [] [] [] []) [(AnnAssign (Name b Store) (Name str Load) () 1) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 64 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 8 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 56 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 42 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 12648430 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ())] [] () ()) (FunctionDef test_ord_chr ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name ord Load) [(ConstantStr "5" ())] []) ()) (Assign [(Name s Store)] (Call (Name chr Load) [(ConstantInt 43 ())] []) ())] [] () ()) (FunctionDef test_abs ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantInt 500 ()))] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .true. ())] []) ()) (AnnAssign (Name b Store) (Name f32 Load) () 1) (Assign [(Name b Store)] (Call (Name abs Load) [(ConstantFloat 3.450000 ())] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantFloat 5346.340000 ()))] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(Call (Name complex Load) [(ConstantFloat 3.450000 ()) (ConstantFloat 5.600000 ())] [])] []) ())] [] () ()) (FunctionDef test_len ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "this is a test" ())] []) ())] [] () ()) (FunctionDef test_bool ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantInt 0 ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(Call (Name complex Load) [(ConstantInt 0 ()) (ConstantInt 0 ())] [])] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantFloat 2.300000 ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ())] [] () ()) (FunctionDef test_str ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (Assign [(Name s Store)] (Call (Name str Load) [] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(UnaryOp USub (ConstantInt 4 ()))] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantFloat 5.600000 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_callable ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (AnnAssign (Name b Store) (Name i32 Load) () 1) (Assign [(Name b Store)] (ConstantInt 2 ()) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name test_len Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name b Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(ConstantStr "c" ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ())] [] () ()) (FunctionDef test_int ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i64 Load) () 1) (Assign [(Name a Store)] (Call (Name int Load) [] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(UnaryOp USub (ConstantFloat 5.000010 ()))] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .false. ())] []) ())] [] () ()) (FunctionDef test_float ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name f64 Load) () 1) (Assign [(Name a Store)] (Call (Name float Load) [] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .false. ())] []) ())] [] () ()) (FunctionDef test_divmod ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Subscript (Name tuple Load) (Tuple [(Name i32 Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (UnaryOp USub (ConstantInt 3 ()))] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 3 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 4 ()) (ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 0 ()) (ConstantInt 5 ())] []) ())] [] () ())] []) diff --git a/tests/tests.toml b/tests/tests.toml index 3c42cd0926..86fa88f248 100644 --- a/tests/tests.toml +++ b/tests/tests.toml @@ -198,7 +198,7 @@ asr = true [[test]] filename = "../integration_tests/test_builtin_len.py" -asr = true +# asr = true [[test]] filename = "../integration_tests/test_builtin_pow.py" From 0fca107c254e757855ca7a453b9b3f57e0a4cdfe Mon Sep 17 00:00:00 2001 From: Naman Gera Date: Wed, 27 Apr 2022 15:32:47 +0530 Subject: [PATCH 07/14] Apply suggestions from @certik --- src/libasr/ASR.asdl | 10 ++--- src/libasr/asr_utils.h | 1 + src/lpython/semantics/python_ast_to_asr.cpp | 49 ++++++++++++++++++--- 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/src/libasr/ASR.asdl b/src/libasr/ASR.asdl index d4bd813a21..47a0bd4fd7 100644 --- a/src/libasr/ASR.asdl +++ b/src/libasr/ASR.asdl @@ -227,22 +227,22 @@ expr | LogicalConstant(bool value, ttype type) | ListConstant(expr* args, ttype type) - | ListLen(expr arg, ttype type) + | ListLen(expr arg, ttype type, expr? value) | ListConcat(expr left, expr right, ttype type, expr? value) | ArrayConstant(expr* args, ttype type) | SetConstant(expr* elements, ttype type) - | SetLen(expr arg, ttype type) + | SetLen(expr arg, ttype type, expr? value) | TupleConstant(expr* elements, ttype type) - | TupleLen(expr arg, ttype type) + | TupleLen(expr arg, ttype type, expr? value) | StringConstant(string s, ttype type) - | StringLen(expr arg, ttype type) + | StringLen(expr arg, ttype type, expr? value) | DictConstant(expr* keys, expr* values, ttype type) - | DictLen(expr arg, ttype type) + | DictLen(expr arg, ttype type, expr? value) | Var(symbol v) | ArrayRef(symbol v, array_index* args, ttype type, expr? value) | DerivedRef(expr v, symbol m, ttype type, expr? value) diff --git a/src/libasr/asr_utils.h b/src/libasr/asr_utils.h index cd57702495..0ecd0ff9ea 100644 --- a/src/libasr/asr_utils.h +++ b/src/libasr/asr_utils.h @@ -280,6 +280,7 @@ static inline ASR::expr_t* expr_value(ASR::expr_t *f) case ASR::exprType::TupleConstant: // Drop through case ASR::exprType::DictConstant: // Drop through case ASR::exprType::SetConstant: // Drop through + case ASR::exprType::ListConstant: // Drop through case ASR::exprType::StringConstant:{ // For all Constants return f; } diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 4270b17a25..664383cb52 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -2686,17 +2686,54 @@ class BodyVisitor : public CommonVisitor { ASR::expr_t *arg = args[0].m_value; ASR::ttype_t *type = ASRUtils::expr_type(arg); ASR::ttype_t *to_type = ASRUtils::TYPE(ASR::make_Integer_t(al, loc, - 4, nullptr, 0)); + 4, nullptr, 0)); + ASR::expr_t *value = nullptr; if (ASRUtils::is_character(*type)) { - return (ASR::asr_t *)ASR::down_cast(ASR::make_StringLen_t(al, loc, arg, to_type)); + if (ASRUtils::expr_value(arg) != nullptr) { + char* c = ASR::down_cast( + ASRUtils::expr_value(arg))->m_s; + int64_t ival = std::string(c).size(); + value = ASR::down_cast(make_IntegerConstant_t(al, + loc, ival, to_type)); + } + return (ASR::asr_t *)ASR::down_cast( + ASR::make_StringLen_t(al, loc, arg, to_type, value)); } else if (ASR::is_a(*type)) { - return (ASR::asr_t *)ASR::down_cast(ASR::make_SetLen_t(al, loc, arg, to_type)); + if (ASRUtils::expr_value(arg) != nullptr) { + int64_t ival = (int64_t)ASR::down_cast( + ASRUtils::expr_value(arg))->n_elements; + value = ASR::down_cast(make_IntegerConstant_t(al, + loc, ival, to_type)); + } + return (ASR::asr_t *)ASR::down_cast( + ASR::make_SetLen_t(al, loc, arg, to_type, value)); } else if (ASR::is_a(*type)) { - return (ASR::asr_t *)ASR::down_cast(ASR::make_TupleLen_t(al, loc, arg, to_type)); + if (ASRUtils::expr_value(arg) != nullptr) { + int64_t ival = (int64_t)ASR::down_cast( + ASRUtils::expr_value(arg))->n_elements; + value = ASR::down_cast(make_IntegerConstant_t(al, + loc, ival, to_type)); + } + return (ASR::asr_t *)ASR::down_cast( + ASR::make_TupleLen_t(al, loc, arg, to_type, value)); } else if (ASR::is_a(*type)) { - return (ASR::asr_t *)ASR::down_cast(ASR::make_ListLen_t(al, loc, arg, to_type)); + if (ASRUtils::expr_value(arg) != nullptr) { + int64_t ival = (int64_t)ASR::down_cast( + ASRUtils::expr_value(arg))->n_args; + value = ASR::down_cast(make_IntegerConstant_t(al, + loc, ival, to_type)); + } + return (ASR::asr_t *)ASR::down_cast( + ASR::make_ListLen_t(al, loc, arg, to_type, value)); } else if (ASR::is_a(*type)) { - return (ASR::asr_t *)ASR::down_cast(ASR::make_DictLen_t(al, loc, arg, to_type)); + if (ASRUtils::expr_value(arg) != nullptr) { + int64_t ival = (int64_t)ASR::down_cast( + ASRUtils::expr_value(arg))->n_keys; + value = ASR::down_cast(make_IntegerConstant_t(al, + loc, ival, to_type)); + } + return (ASR::asr_t *)ASR::down_cast( + ASR::make_DictLen_t(al, loc, arg, to_type, value)); } return nullptr; } From 34eb3577ec1b80c18b7cdd902358581212524cbd Mon Sep 17 00:00:00 2001 From: Naman Gera Date: Wed, 27 Apr 2022 15:43:44 +0530 Subject: [PATCH 08/14] Make `ASRUtils::expr_value` work for these "len" nodes --- integration_tests/test_builtin_bool.py | 14 +++++++------- src/libasr/asr_utils.h | 5 +++++ src/runtime/lpython_builtin.py | 6 ++++++ 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-expr8-6beda60.json | 2 +- tests/reference/asr-expr8-6beda60.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 | 4 ++-- .../reference/asr-test_builtin_bool-330223a.stdout | 2 +- tests/reference/asr-test_builtin_hex-64bd268.json | 2 +- .../reference/asr-test_builtin_hex-64bd268.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 +- tests/reference/asr-test_max_min-3c2fc51.json | 2 +- tests/reference/asr-test_max_min-3c2fc51.stdout | 2 +- tests/reference/asr-test_pow-3f5d550.json | 2 +- tests/reference/asr-test_pow-3f5d550.stdout | 2 +- 39 files changed, 55 insertions(+), 44 deletions(-) diff --git a/integration_tests/test_builtin_bool.py b/integration_tests/test_builtin_bool.py index ca6007543e..f34e1ec773 100644 --- a/integration_tests/test_builtin_bool.py +++ b/integration_tests/test_builtin_bool.py @@ -33,13 +33,13 @@ def test_bool(): f2 = -235.6 assert bool(f2) - # s: str - # s = "" - # assert not bool(s) - # s = "str" - # assert bool(s) - # assert not bool('') - # assert bool("str") + s: str + s = "" + assert not bool(s) + s = "str" + assert bool(s) + assert not bool('') + assert bool("str") b: bool b = True diff --git a/src/libasr/asr_utils.h b/src/libasr/asr_utils.h index 0ecd0ff9ea..8190559f1f 100644 --- a/src/libasr/asr_utils.h +++ b/src/libasr/asr_utils.h @@ -272,6 +272,11 @@ static inline ASR::expr_t* expr_value(ASR::expr_t *f) case ASR::exprType::Var: { return EXPR2VAR(f)->m_value; } case ASR::exprType::StrOp: { return ASR::down_cast(f)->m_value; } case ASR::exprType::ImpliedDoLoop: { return ASR::down_cast(f)->m_value; } + case ASR::exprType::StringLen: { return ASR::down_cast(f)->m_value; } + case ASR::exprType::DictLen: { return ASR::down_cast(f)->m_value; } + case ASR::exprType::ListLen: { return ASR::down_cast(f)->m_value; } + case ASR::exprType::TupleLen: { return ASR::down_cast(f)->m_value; } + case ASR::exprType::SetLen: { return ASR::down_cast(f)->m_value; } case ASR::exprType::ArrayConstant: // Drop through case ASR::exprType::IntegerConstant: // Drop through case ASR::exprType::RealConstant: // Drop through diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index 0fb34fe7af..00be5947bc 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -170,6 +170,12 @@ def bool(c: c32) -> bool: def bool(c: c64) -> bool: return c.real != 0.0 or _lfortran_zaimag(c) != 0.0 +@overload +def bool(s: str) -> bool: + """ + Return False when the argument `s` is an empty string, True otherwise. + """ + return len(s) > 0 #: pow() as a generic procedure. #: supported types for arguments: diff --git a/tests/reference/asr-complex1-f26c460.json b/tests/reference/asr-complex1-f26c460.json index cfc9b1337b..57c07435eb 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": "3f26a999449c70080ff395831083d05eaa6af5c852c1a17a7874d5df", + "stdout_hash": "4915e17b7b2faf7fb5eea992a3316a7de12ff06aa99d8be5872e25d5", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex1-f26c460.stdout b/tests/reference/asr-complex1-f26c460.stdout index 8685fbe7de..f69ee2b7f6 100644 --- a/tests/reference/asr-complex1-f26c460.stdout +++ b/tests/reference/asr-complex1-f26c460.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_0__complex: (ExternalSymbol 1 complex@__lpython_overloaded_0__complex 5 __lpython_overloaded_0__complex lpython_builtin [] __lpython_overloaded_0__complex Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 5 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_1__complex: (ExternalSymbol 1 complex@__lpython_overloaded_1__complex 5 __lpython_overloaded_1__complex lpython_builtin [] __lpython_overloaded_1__complex Public), complex@__lpython_overloaded_2__complex: (ExternalSymbol 1 complex@__lpython_overloaded_2__complex 5 __lpython_overloaded_2__complex lpython_builtin [] __lpython_overloaded_2__complex Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 5 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 5 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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 (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 y) (BinOp (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 z) (Cast (BinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (BinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (BinOp (Cast (IntegerConstant 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) (Cast (FunctionCall 1 complex@__lpython_overloaded_0__complex 2 complex [] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_1__complex 2 complex [((RealConstant 3.400000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 5.000000 (Real 8 []))) ((RealConstant 4.300000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (FunctionCall 1 complex@__lpython_overloaded_2__complex 2 complex [((IntegerConstant 1 (Integer 4 [])))] (Complex 4 []) (ComplexConstant 1.000000 0.000000 (Complex 8 [])) ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c2) (Cast (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 4.500000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c3) (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (Cast (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) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.345340 (Real 8 []))) ((RealConstant 4.867868 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 0.015553 0.065561 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -5.000000 10.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 1.000000 1.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_0__complex: (ExternalSymbol 1 complex@__lpython_overloaded_0__complex 5 __lpython_overloaded_0__complex lpython_builtin [] __lpython_overloaded_0__complex Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 5 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_1__complex: (ExternalSymbol 1 complex@__lpython_overloaded_1__complex 5 __lpython_overloaded_1__complex lpython_builtin [] __lpython_overloaded_1__complex Public), complex@__lpython_overloaded_2__complex: (ExternalSymbol 1 complex@__lpython_overloaded_2__complex 5 __lpython_overloaded_2__complex lpython_builtin [] __lpython_overloaded_2__complex Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 5 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 5 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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 (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 y) (BinOp (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 z) (Cast (BinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (BinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (BinOp (Cast (IntegerConstant 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) (Cast (FunctionCall 1 complex@__lpython_overloaded_0__complex 2 complex [] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_1__complex 2 complex [((RealConstant 3.400000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 5.000000 (Real 8 []))) ((RealConstant 4.300000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (FunctionCall 1 complex@__lpython_overloaded_2__complex 2 complex [((IntegerConstant 1 (Integer 4 [])))] (Complex 4 []) (ComplexConstant 1.000000 0.000000 (Complex 8 [])) ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c2) (Cast (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 4.500000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c3) (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (Cast (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) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.345340 (Real 8 []))) ((RealConstant 4.867868 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 0.015553 0.065561 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -5.000000 10.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 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 323fc22ad4..6eb6bf5aa1 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": "cfec8129cae95991ee82c0d138d4915468ffe701deda58a3997ad5b0", + "stdout_hash": "1c9ab679ec42e21b37f91626980d61b1bb1e33c427ead9c07098cd7e", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-constants1-5828e8a.stdout b/tests/reference/asr-constants1-5828e8a.stdout index f5039c27bb..c38a55371d 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_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 13 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 13 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), abs@__lpython_overloaded_8__abs: (ExternalSymbol 1 abs@__lpython_overloaded_8__abs 13 __lpython_overloaded_8__abs lpython_builtin [] __lpython_overloaded_8__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_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 13 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 13 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 13 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 13 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 103 {}) 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) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((IntegerConstant 5 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 5 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 500 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .true. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((RealConstant 3.450000 (Real 8 [])))] (Real 8 []) (RealConstant 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((UnaryOp USub (RealConstant 5346.340000 (Real 8 [])) (Real 8 []) (RealConstant -5346.340000 (Real 8 []))))] (Real 8 []) (RealConstant 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_8__abs 4 abs [((FunctionCall 1 complex@__lpython_overloaded_5__complex 4 complex [((RealConstant 3.450000 (Real 8 []))) ((RealConstant 5.600000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.450000 5.600000 (Complex 8 [])) ()))] (Real 8 []) (RealConstant 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 [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_8__bool 6 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 6 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_5__bool 6 bool [((RealConstant 2.300000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .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 () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 8 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 56 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 42 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 12648430 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-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) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 8 a) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .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 () [((IntegerConstant 9 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 9 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant -3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 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.)}) test_float [] [(= (Var 10 a) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 10 a) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToReal (Real 8 []) (RealConstant 5.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant -1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 0.000000 (Real 8 []))) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.)}) test_int [] [(= (Var 9 a) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (RealConstant 4.560000 (Real 8 [])) RealToInteger (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (UnaryOp USub (RealConstant 5.000010 (Real 8 [])) (Real 8 []) (RealConstant -5.000010 (Real 8 []))) RealToInteger (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (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.)}) test_len [] [(= (Var 5 a) (StringLen (StringConstant "" (Character 1 0 () [])) (Integer 4 [])) ()) (= (Var 5 a) (StringLen (StringConstant "test" (Character 1 4 () [])) (Integer 4 [])) ()) (= (Var 5 a) (StringLen (StringConstant "this is a test" (Character 1 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 () [((StringConstant "5" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (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 () []) (StringConstant "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((RealConstant 5.600000 (Real 8 [])))] (Character 1 -2 () []) (StringConstant "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .true. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .false. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((StringConstant "5346" (Character 1 4 () [])))] (Character 1 -2 () []) (StringConstant "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_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 13 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 13 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), abs@__lpython_overloaded_8__abs: (ExternalSymbol 1 abs@__lpython_overloaded_8__abs 13 __lpython_overloaded_8__abs lpython_builtin [] __lpython_overloaded_8__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_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 13 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 13 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 13 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 13 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 104 {}) 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) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((IntegerConstant 5 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 5 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 500 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .true. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((RealConstant 3.450000 (Real 8 [])))] (Real 8 []) (RealConstant 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((UnaryOp USub (RealConstant 5346.340000 (Real 8 [])) (Real 8 []) (RealConstant -5346.340000 (Real 8 []))))] (Real 8 []) (RealConstant 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_8__abs 4 abs [((FunctionCall 1 complex@__lpython_overloaded_5__complex 4 complex [((RealConstant 3.450000 (Real 8 []))) ((RealConstant 5.600000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.450000 5.600000 (Complex 8 [])) ()))] (Real 8 []) (RealConstant 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 [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_8__bool 6 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 6 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_5__bool 6 bool [((RealConstant 2.300000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .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 () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 8 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 56 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 42 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 12648430 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-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) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 8 a) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .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 () [((IntegerConstant 9 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 9 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant -3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 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.)}) test_float [] [(= (Var 10 a) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 10 a) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToReal (Real 8 []) (RealConstant 5.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant -1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 0.000000 (Real 8 []))) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.)}) test_int [] [(= (Var 9 a) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (RealConstant 4.560000 (Real 8 [])) RealToInteger (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (UnaryOp USub (RealConstant 5.000010 (Real 8 [])) (Real 8 []) (RealConstant -5.000010 (Real 8 []))) RealToInteger (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (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.)}) test_len [] [(= (Var 5 a) (StringLen (StringConstant "" (Character 1 0 () [])) (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) ()) (= (Var 5 a) (StringLen (StringConstant "test" (Character 1 4 () [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) ()) (= (Var 5 a) (StringLen (StringConstant "this is a test" (Character 1 14 () [])) (Integer 4 []) (IntegerConstant 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 () [((StringConstant "5" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (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 () []) (StringConstant "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((RealConstant 5.600000 (Real 8 [])))] (Character 1 -2 () []) (StringConstant "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .true. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .false. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((StringConstant "5346" (Character 1 4 () [])))] (Character 1 -2 () []) (StringConstant "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 279ee2a1b2..5f15a3c55a 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": "68befed0a476b8a704a4eace939367f7e2004c42a4d58fe7a46410df", + "stdout_hash": "2030130b0705a7db2dccaa839d6429cb7683f9db7eeb62b467c86064", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr1-8df2d66.stdout b/tests/reference/asr-expr1-8df2d66.stdout index c6f1909ddf..f15ce4dae5 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 94 {}) 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) (IntegerConstant 0 (Integer 4 [])) (Integer 4 [])) ()) (If (NamedExpr (Var 2 a) (FunctionCall 2 ord () [((StringConstant "3" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 51 (Integer 4 [])) ()) (Integer 4 [])) [(= (Var 2 x) (IntegerConstant 1 (Integer 4 [])) ())] []) (WhileLoop (NamedExpr (Var 2 a) (IntegerConstant 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 y) (IntegerConstant 1 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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) (IntegerConstant 0 (Integer 4 [])) (Integer 4 [])) ()) (If (NamedExpr (Var 2 a) (FunctionCall 2 ord () [((StringConstant "3" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 51 (Integer 4 [])) ()) (Integer 4 [])) [(= (Var 2 x) (IntegerConstant 1 (Integer 4 [])) ())] []) (WhileLoop (NamedExpr (Var 2 a) (IntegerConstant 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 y) (IntegerConstant 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 ccf8391dcc..1865cd8e62 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": "9ddd745019307388c658a3214661e4b6d93835146e1d92c620147097", + "stdout_hash": "391b7ad45fb1014d6ac6d32da3a24cc3c08a3615d8f63852921b5a28", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr10-efcbb1b.stdout b/tests/reference/asr-expr10-efcbb1b.stdout index 5ff1d7e38b..a2f9ed5f53 100644 --- a/tests/reference/asr-expr10-efcbb1b.stdout +++ b/tests/reference/asr-expr10-efcbb1b.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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 (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 []))) ()) (= (Var 2 b) (UnaryOp Not (IntegerConstant 5 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f) (Cast (UnaryOp UAdd (RealConstant 1.000000 (Real 8 [])) (Real 8 []) (RealConstant 1.000000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 f) (Cast (UnaryOp USub (RealConstant 183745.534000 (Real 8 [])) (Real 8 []) (RealConstant -183745.534000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 b1) (LogicalConstant .true. (Logical 1 [])) ()) (= (Var 2 b2) (UnaryOp Not (LogicalConstant .false. (Logical 1 [])) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 b3) (UnaryOp Not (Var 2 b2) (Logical 1 []) ()) ()) (= (Var 2 a) (UnaryOp UAdd (LogicalConstant .true. (Logical 1 [])) (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (LogicalConstant .false. (Logical 1 [])) (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (LogicalConstant .true. (Logical 1 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 []))) ()) (= (Var 2 c) (Cast (UnaryOp UAdd (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (UnaryOp USub (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((RealConstant 65.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 65.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -3.000000 -65.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 b1) (UnaryOp Not (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b2) (UnaryOp Not (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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 (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 []))) ()) (= (Var 2 b) (UnaryOp Not (IntegerConstant 5 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f) (Cast (UnaryOp UAdd (RealConstant 1.000000 (Real 8 [])) (Real 8 []) (RealConstant 1.000000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 f) (Cast (UnaryOp USub (RealConstant 183745.534000 (Real 8 [])) (Real 8 []) (RealConstant -183745.534000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 b1) (LogicalConstant .true. (Logical 1 [])) ()) (= (Var 2 b2) (UnaryOp Not (LogicalConstant .false. (Logical 1 [])) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 b3) (UnaryOp Not (Var 2 b2) (Logical 1 []) ()) ()) (= (Var 2 a) (UnaryOp UAdd (LogicalConstant .true. (Logical 1 [])) (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (LogicalConstant .false. (Logical 1 [])) (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (LogicalConstant .true. (Logical 1 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 []))) ()) (= (Var 2 c) (Cast (UnaryOp UAdd (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (UnaryOp USub (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((RealConstant 65.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 65.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -3.000000 -65.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 b1) (UnaryOp Not (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b2) (UnaryOp Not (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .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 53bd088695..7c0b7ad546 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": "36d733486029c8047fd4d3798fc40f356bb23f6902179b0873672455", + "stdout_hash": "51d5b700d3840ba03aecc56e1efc8e18808f97b64e686c4276562d57", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr13-81bdb5a.stdout b/tests/reference/asr-expr13-81bdb5a.stdout index be4297ace2..309e35836e 100644 --- a/tests/reference/asr-expr13-81bdb5a.stdout +++ b/tests/reference/asr-expr13-81bdb5a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 4 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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 (IntegerConstant 5 (Integer 4 [])) Gt (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (IntegerConstant 5 (Integer 4 [])) LtE (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (IntegerConstant 5 (Integer 4 [])) Lt (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 5.600000 (Real 8 [])) GtE (RealConstant 5.599990 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 3.300000 (Real 8 [])) Eq (RealConstant 3.300000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 3.300000 (Real 8 [])) NotEq (RealConstant 3.400000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) Eq (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) Gt (StringConstant "abd" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "" (Character 1 0 () [])) Lt (StringConstant "s" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "-abs" (Character 1 4 () [])) GtE (StringConstant "abs" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abcd" (Character 1 4 () [])) LtE (StringConstant "abcde" (Character 1 5 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) Eq (StringConstant "abc" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) NotEq (StringConstant "abd" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "" (Character 1 0 () [])) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .true. (Logical 1 [])) Gt (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .true. (Logical 1 [])) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .false. (Logical 1 [])) NotEq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .false. (Logical 1 [])) GtE (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 4 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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 (IntegerConstant 5 (Integer 4 [])) Gt (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (IntegerConstant 5 (Integer 4 [])) LtE (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (IntegerConstant 5 (Integer 4 [])) Lt (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 5.600000 (Real 8 [])) GtE (RealConstant 5.599990 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 3.300000 (Real 8 [])) Eq (RealConstant 3.300000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 3.300000 (Real 8 [])) NotEq (RealConstant 3.400000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) Eq (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) Gt (StringConstant "abd" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "" (Character 1 0 () [])) Lt (StringConstant "s" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "-abs" (Character 1 4 () [])) GtE (StringConstant "abs" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abcd" (Character 1 4 () [])) LtE (StringConstant "abcde" (Character 1 5 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) Eq (StringConstant "abc" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) NotEq (StringConstant "abd" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "" (Character 1 0 () [])) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .true. (Logical 1 [])) Gt (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .true. (Logical 1 [])) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .false. (Logical 1 [])) NotEq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .false. (Logical 1 [])) GtE (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .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 724a94513d..a703b53e0d 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": "9720e949c4f121f07e4d80f50904488352611cd7cadd552bcaa0a9dc", + "stdout_hash": "73cce70b561dd5ac974f890286ff6ccd6ff9c97753e2bb7193919e14", "stderr": "asr-expr7-480ba2f.stderr", "stderr_hash": "28509dd59a386eebd632340a550d14299cd2a921ef6dc3ac7dbe7fe9", "returncode": 0 diff --git a/tests/reference/asr-expr7-480ba2f.stdout b/tests/reference/asr-expr7-480ba2f.stdout index 3307db6882..22360827c7 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 97 {}) _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 () [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 96 {}) 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 [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 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 98 {}) _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 () [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 97 {}) 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 [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 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-expr8-6beda60.json b/tests/reference/asr-expr8-6beda60.json index d8eb8d83f2..2db525391f 100644 --- a/tests/reference/asr-expr8-6beda60.json +++ b/tests/reference/asr-expr8-6beda60.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr8-6beda60.stdout", - "stdout_hash": "2f8a598a36d854691ea0df208d560b9eed70b37a6632678ef65f9b08", + "stdout_hash": "dec4f5b9b64bd149a69b9609642a379194e41751f3841cbe0f2d830e", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr8-6beda60.stdout b/tests/reference/asr-expr8-6beda60.stdout index 95d78cbd99..4c3334946a 100644 --- a/tests/reference/asr-expr8-6beda60.stdout +++ b/tests/reference/asr-expr8-6beda60.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_floordiv@__lpython_overloaded_2___lpython_floordiv: (ExternalSymbol 1 _lpython_floordiv@__lpython_overloaded_2___lpython_floordiv 4 __lpython_overloaded_2___lpython_floordiv lpython_builtin [] __lpython_overloaded_2___lpython_floordiv Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) main_program [] []), test_binop: (Subroutine (SymbolTable 2 {_lpython_floordiv: (ExternalSymbol 2 _lpython_floordiv 4 _lpython_floordiv lpython_builtin [] _lpython_floordiv Private), b1: (Variable 2 b1 Local () () Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () () Default (Logical 1 []) Source Public Required .false.), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), x2: (Variable 2 x2 Local () () Default (Real 4 []) Source Public Required .false.)}) test_binop [] [(= (Var 2 x) (BinOp (IntegerConstant 2 (Integer 4 [])) Pow (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant 8 (Integer 4 [])) ()) ()) (= (Var 2 x2) (Cast (BinOp (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Pow (RealConstant 3.500000 (Real 8 [])) (Real 8 []) () ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x) (BinOp (IntegerConstant 54 (Integer 4 [])) Sub (IntegerConstant 100 (Integer 4 [])) (Integer 4 []) (IntegerConstant -46 (Integer 4 [])) ()) ()) (= (Var 2 x2) (Cast (BinOp (BinOp (RealConstant 3.454000 (Real 8 [])) Sub (RealConstant 765.430000 (Real 8 [])) (Real 8 []) (RealConstant -761.976000 (Real 8 [])) ()) Add (RealConstant 534.600000 (Real 8 [])) (Real 8 []) (RealConstant -227.376000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x2) (Cast (BinOp (RealConstant 5346.565000 (Real 8 [])) Mul (RealConstant 3.450000 (Real 8 [])) (Real 8 []) (RealConstant 18445.649250 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x2) (Cast (BinOp (RealConstant 5346.565000 (Real 8 [])) Pow (RealConstant 3.450000 (Real 8 [])) (Real 8 []) (RealConstant 7275422789925.217773 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Add (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Sub (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Mul (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Pow (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 b1) (LogicalConstant .true. (Logical 1 [])) ()) (= (Var 2 b2) (LogicalConstant .false. (Logical 1 [])) ()) (= (Var 2 x) (FunctionCall 1 _lpython_floordiv@__lpython_overloaded_2___lpython_floordiv 2 _lpython_floordiv [((Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ())) ((Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ()))] (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ()) Pow (Cast (Var 2 b2) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_floordiv@__lpython_overloaded_2___lpython_floordiv: (ExternalSymbol 1 _lpython_floordiv@__lpython_overloaded_2___lpython_floordiv 4 __lpython_overloaded_2___lpython_floordiv lpython_builtin [] __lpython_overloaded_2___lpython_floordiv Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) main_program [] []), test_binop: (Subroutine (SymbolTable 2 {_lpython_floordiv: (ExternalSymbol 2 _lpython_floordiv 4 _lpython_floordiv lpython_builtin [] _lpython_floordiv Private), b1: (Variable 2 b1 Local () () Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () () Default (Logical 1 []) Source Public Required .false.), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), x2: (Variable 2 x2 Local () () Default (Real 4 []) Source Public Required .false.)}) test_binop [] [(= (Var 2 x) (BinOp (IntegerConstant 2 (Integer 4 [])) Pow (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant 8 (Integer 4 [])) ()) ()) (= (Var 2 x2) (Cast (BinOp (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Pow (RealConstant 3.500000 (Real 8 [])) (Real 8 []) () ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x) (BinOp (IntegerConstant 54 (Integer 4 [])) Sub (IntegerConstant 100 (Integer 4 [])) (Integer 4 []) (IntegerConstant -46 (Integer 4 [])) ()) ()) (= (Var 2 x2) (Cast (BinOp (BinOp (RealConstant 3.454000 (Real 8 [])) Sub (RealConstant 765.430000 (Real 8 [])) (Real 8 []) (RealConstant -761.976000 (Real 8 [])) ()) Add (RealConstant 534.600000 (Real 8 [])) (Real 8 []) (RealConstant -227.376000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x2) (Cast (BinOp (RealConstant 5346.565000 (Real 8 [])) Mul (RealConstant 3.450000 (Real 8 [])) (Real 8 []) (RealConstant 18445.649250 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x2) (Cast (BinOp (RealConstant 5346.565000 (Real 8 [])) Pow (RealConstant 3.450000 (Real 8 [])) (Real 8 []) (RealConstant 7275422789925.217773 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Add (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Sub (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Mul (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Pow (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 b1) (LogicalConstant .true. (Logical 1 [])) ()) (= (Var 2 b2) (LogicalConstant .false. (Logical 1 [])) ()) (= (Var 2 x) (FunctionCall 1 _lpython_floordiv@__lpython_overloaded_2___lpython_floordiv 2 _lpython_floordiv [((Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ())) ((Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ()))] (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ()) Pow (Cast (Var 2 b2) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin-aa64615.json b/tests/reference/asr-test_builtin-aa64615.json index e15a929a0a..cf724e56d3 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": "04d44bf32d15548557bc01aa312832044215930671038b138bd373c1", + "stdout_hash": "c76cc62f119c96355c5335c05ef16d052f1117644cbae78e21f548bb", "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 d4fb960a3f..c0af2d65a8 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 96 {}) _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 95 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_chr: (Subroutine (SymbolTable 3 {capital_a: (Variable 3 capital_a Local () () Default (Character 1 -2 () []) Source Public Required .false.), capital_z: (Variable 3 capital_z Local () () Default (Character 1 -2 () []) Source Public Required .false.), chr: (ExternalSymbol 3 chr 5 chr lpython_builtin [] chr Private), dollar: (Variable 3 dollar Local () () Default (Character 1 -2 () []) Source Public Required .false.), exclamation: (Variable 3 exclamation Local () () Default (Character 1 -2 () []) Source Public Required .false.), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), left_parenthesis: (Variable 3 left_parenthesis Local () () Default (Character 1 -2 () []) Source Public Required .false.), nine: (Variable 3 nine Local () () Default (Character 1 -2 () []) Source Public Required .false.), plus: (Variable 3 plus Local () () Default (Character 1 -2 () []) Source Public Required .false.), right_brace: (Variable 3 right_brace Local () () Default (Character 1 -2 () []) Source Public Required .false.), right_bracket: (Variable 3 right_bracket Local () () Default (Character 1 -2 () []) Source Public Required .false.), semicolon: (Variable 3 semicolon Local () () Default (Character 1 -2 () []) Source Public Required .false.), small_a: (Variable 3 small_a Local () () Default (Character 1 -2 () []) Source Public Required .false.), small_z: (Variable 3 small_z Local () () Default (Character 1 -2 () []) Source Public Required .false.), zero: (Variable 3 zero Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_chr [] [(= (Var 3 i) (IntegerConstant 33 (Integer 4 [])) ()) (= (Var 3 exclamation) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 33 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "!" (Character 1 1 () [])) ()) Eq (StringConstant "!" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 exclamation) Eq (StringConstant "!" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 36 (Integer 4 [])) ()) (= (Var 3 dollar) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 36 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "$" (Character 1 1 () [])) ()) Eq (StringConstant "$" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 dollar) Eq (StringConstant "$" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 40 (Integer 4 [])) ()) (= (Var 3 left_parenthesis) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 40 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "(" (Character 1 1 () [])) ()) Eq (StringConstant "(" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 left_parenthesis) Eq (StringConstant "(" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 43 (Integer 4 [])) ()) (= (Var 3 plus) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (Character 1 1 () [])) ()) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 plus) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 48 (Integer 4 [])) ()) (= (Var 3 zero) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 48 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0" (Character 1 1 () [])) ()) Eq (StringConstant "0" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 zero) Eq (StringConstant "0" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 57 (Integer 4 [])) ()) (= (Var 3 nine) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 57 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "9" (Character 1 1 () [])) ()) Eq (StringConstant "9" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 nine) Eq (StringConstant "9" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 59 (Integer 4 [])) ()) (= (Var 3 semicolon) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 59 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant ";" (Character 1 1 () [])) ()) Eq (StringConstant ";" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 semicolon) Eq (StringConstant ";" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 65 (Integer 4 [])) ()) (= (Var 3 capital_a) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 65 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "A" (Character 1 1 () [])) ()) Eq (StringConstant "A" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 capital_a) Eq (StringConstant "A" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 90 (Integer 4 [])) ()) (= (Var 3 capital_z) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 90 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "Z" (Character 1 1 () [])) ()) Eq (StringConstant "Z" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 capital_z) Eq (StringConstant "Z" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 93 (Integer 4 [])) ()) (= (Var 3 right_bracket) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 93 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "]" (Character 1 1 () [])) ()) Eq (StringConstant "]" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 right_bracket) Eq (StringConstant "]" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 97 (Integer 4 [])) ()) (= (Var 3 small_a) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 97 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "a" (Character 1 1 () [])) ()) Eq (StringConstant "a" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 small_a) Eq (StringConstant "a" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 122 (Integer 4 [])) ()) (= (Var 3 small_z) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 122 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "z" (Character 1 1 () [])) ()) Eq (StringConstant "z" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 small_z) Eq (StringConstant "z" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 125 (Integer 4 [])) ()) (= (Var 3 right_brace) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 125 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "}" (Character 1 1 () [])) ()) Eq (StringConstant "}" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 right_brace) Eq (StringConstant "}" (Character 1 1 () [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_ord: (Subroutine (SymbolTable 2 {capital_a_unicode: (Variable 2 capital_a_unicode Local () () Default (Integer 4 []) Source Public Required .false.), capital_z_unicode: (Variable 2 capital_z_unicode Local () () Default (Integer 4 []) Source Public Required .false.), dollar_unicode: (Variable 2 dollar_unicode Local () () Default (Integer 4 []) Source Public Required .false.), exclamation_unicode: (Variable 2 exclamation_unicode Local () () Default (Integer 4 []) Source Public Required .false.), left_parenthesis_unicode: (Variable 2 left_parenthesis_unicode Local () () Default (Integer 4 []) Source Public Required .false.), nine_unicode: (Variable 2 nine_unicode Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 5 ord lpython_builtin [] ord Private), plus_unicode: (Variable 2 plus_unicode Local () () Default (Integer 4 []) Source Public Required .false.), right_brace_unicode: (Variable 2 right_brace_unicode Local () () Default (Integer 4 []) Source Public Required .false.), right_bracket_unicode: (Variable 2 right_bracket_unicode Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), semicolon_unicode: (Variable 2 semicolon_unicode Local () () Default (Integer 4 []) Source Public Required .false.), small_a_unicode: (Variable 2 small_a_unicode Local () () Default (Integer 4 []) Source Public Required .false.), small_z_unicode: (Variable 2 small_z_unicode Local () () Default (Integer 4 []) Source Public Required .false.), zero_unicode: (Variable 2 zero_unicode Local () () Default (Integer 4 []) Source Public Required .false.)}) test_ord [] [(= (Var 2 s) (StringConstant "!" (Character 1 1 () [])) ()) (= (Var 2 exclamation_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "!" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 33 (Integer 4 [])) ()) Eq (IntegerConstant 33 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 exclamation_unicode) Eq (IntegerConstant 33 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "$" (Character 1 1 () [])) ()) (= (Var 2 dollar_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "$" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 36 (Integer 4 [])) ()) Eq (IntegerConstant 36 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 dollar_unicode) Eq (IntegerConstant 36 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "(" (Character 1 1 () [])) ()) (= (Var 2 left_parenthesis_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "(" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 40 (Integer 4 [])) ()) Eq (IntegerConstant 40 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 left_parenthesis_unicode) Eq (IntegerConstant 40 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "+" (Character 1 1 () [])) ()) (= (Var 2 plus_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "+" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 43 (Integer 4 [])) ()) Eq (IntegerConstant 43 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 plus_unicode) Eq (IntegerConstant 43 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "0" (Character 1 1 () [])) ()) (= (Var 2 zero_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "0" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 48 (Integer 4 [])) ()) Eq (IntegerConstant 48 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 zero_unicode) Eq (IntegerConstant 48 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "9" (Character 1 1 () [])) ()) (= (Var 2 nine_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "9" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 57 (Integer 4 [])) ()) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 nine_unicode) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant ";" (Character 1 1 () [])) ()) (= (Var 2 semicolon_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant ";" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 59 (Integer 4 [])) ()) Eq (IntegerConstant 59 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 semicolon_unicode) Eq (IntegerConstant 59 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "A" (Character 1 1 () [])) ()) (= (Var 2 capital_a_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "A" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 65 (Integer 4 [])) ()) Eq (IntegerConstant 65 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 capital_a_unicode) Eq (IntegerConstant 65 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "Z" (Character 1 1 () [])) ()) (= (Var 2 capital_z_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "Z" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 90 (Integer 4 [])) ()) Eq (IntegerConstant 90 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 capital_z_unicode) Eq (IntegerConstant 90 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "]" (Character 1 1 () [])) ()) (= (Var 2 right_bracket_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "]" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 93 (Integer 4 [])) ()) Eq (IntegerConstant 93 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 right_bracket_unicode) Eq (IntegerConstant 93 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "a" (Character 1 1 () [])) ()) (= (Var 2 small_a_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "a" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 97 (Integer 4 [])) ()) Eq (IntegerConstant 97 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 small_a_unicode) Eq (IntegerConstant 97 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "z" (Character 1 1 () [])) ()) (= (Var 2 small_z_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "z" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 122 (Integer 4 [])) ()) Eq (IntegerConstant 122 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 small_z_unicode) Eq (IntegerConstant 122 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "}" (Character 1 1 () [])) ()) (= (Var 2 right_brace_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "}" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 125 (Integer 4 [])) ()) Eq (IntegerConstant 125 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 right_brace_unicode) Eq (IntegerConstant 125 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 97 {}) _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 96 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_chr: (Subroutine (SymbolTable 3 {capital_a: (Variable 3 capital_a Local () () Default (Character 1 -2 () []) Source Public Required .false.), capital_z: (Variable 3 capital_z Local () () Default (Character 1 -2 () []) Source Public Required .false.), chr: (ExternalSymbol 3 chr 5 chr lpython_builtin [] chr Private), dollar: (Variable 3 dollar Local () () Default (Character 1 -2 () []) Source Public Required .false.), exclamation: (Variable 3 exclamation Local () () Default (Character 1 -2 () []) Source Public Required .false.), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), left_parenthesis: (Variable 3 left_parenthesis Local () () Default (Character 1 -2 () []) Source Public Required .false.), nine: (Variable 3 nine Local () () Default (Character 1 -2 () []) Source Public Required .false.), plus: (Variable 3 plus Local () () Default (Character 1 -2 () []) Source Public Required .false.), right_brace: (Variable 3 right_brace Local () () Default (Character 1 -2 () []) Source Public Required .false.), right_bracket: (Variable 3 right_bracket Local () () Default (Character 1 -2 () []) Source Public Required .false.), semicolon: (Variable 3 semicolon Local () () Default (Character 1 -2 () []) Source Public Required .false.), small_a: (Variable 3 small_a Local () () Default (Character 1 -2 () []) Source Public Required .false.), small_z: (Variable 3 small_z Local () () Default (Character 1 -2 () []) Source Public Required .false.), zero: (Variable 3 zero Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_chr [] [(= (Var 3 i) (IntegerConstant 33 (Integer 4 [])) ()) (= (Var 3 exclamation) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 33 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "!" (Character 1 1 () [])) ()) Eq (StringConstant "!" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 exclamation) Eq (StringConstant "!" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 36 (Integer 4 [])) ()) (= (Var 3 dollar) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 36 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "$" (Character 1 1 () [])) ()) Eq (StringConstant "$" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 dollar) Eq (StringConstant "$" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 40 (Integer 4 [])) ()) (= (Var 3 left_parenthesis) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 40 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "(" (Character 1 1 () [])) ()) Eq (StringConstant "(" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 left_parenthesis) Eq (StringConstant "(" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 43 (Integer 4 [])) ()) (= (Var 3 plus) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (Character 1 1 () [])) ()) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 plus) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 48 (Integer 4 [])) ()) (= (Var 3 zero) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 48 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0" (Character 1 1 () [])) ()) Eq (StringConstant "0" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 zero) Eq (StringConstant "0" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 57 (Integer 4 [])) ()) (= (Var 3 nine) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 57 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "9" (Character 1 1 () [])) ()) Eq (StringConstant "9" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 nine) Eq (StringConstant "9" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 59 (Integer 4 [])) ()) (= (Var 3 semicolon) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 59 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant ";" (Character 1 1 () [])) ()) Eq (StringConstant ";" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 semicolon) Eq (StringConstant ";" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 65 (Integer 4 [])) ()) (= (Var 3 capital_a) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 65 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "A" (Character 1 1 () [])) ()) Eq (StringConstant "A" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 capital_a) Eq (StringConstant "A" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 90 (Integer 4 [])) ()) (= (Var 3 capital_z) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 90 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "Z" (Character 1 1 () [])) ()) Eq (StringConstant "Z" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 capital_z) Eq (StringConstant "Z" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 93 (Integer 4 [])) ()) (= (Var 3 right_bracket) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 93 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "]" (Character 1 1 () [])) ()) Eq (StringConstant "]" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 right_bracket) Eq (StringConstant "]" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 97 (Integer 4 [])) ()) (= (Var 3 small_a) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 97 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "a" (Character 1 1 () [])) ()) Eq (StringConstant "a" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 small_a) Eq (StringConstant "a" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 122 (Integer 4 [])) ()) (= (Var 3 small_z) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 122 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "z" (Character 1 1 () [])) ()) Eq (StringConstant "z" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 small_z) Eq (StringConstant "z" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 125 (Integer 4 [])) ()) (= (Var 3 right_brace) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 125 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "}" (Character 1 1 () [])) ()) Eq (StringConstant "}" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 right_brace) Eq (StringConstant "}" (Character 1 1 () [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_ord: (Subroutine (SymbolTable 2 {capital_a_unicode: (Variable 2 capital_a_unicode Local () () Default (Integer 4 []) Source Public Required .false.), capital_z_unicode: (Variable 2 capital_z_unicode Local () () Default (Integer 4 []) Source Public Required .false.), dollar_unicode: (Variable 2 dollar_unicode Local () () Default (Integer 4 []) Source Public Required .false.), exclamation_unicode: (Variable 2 exclamation_unicode Local () () Default (Integer 4 []) Source Public Required .false.), left_parenthesis_unicode: (Variable 2 left_parenthesis_unicode Local () () Default (Integer 4 []) Source Public Required .false.), nine_unicode: (Variable 2 nine_unicode Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 5 ord lpython_builtin [] ord Private), plus_unicode: (Variable 2 plus_unicode Local () () Default (Integer 4 []) Source Public Required .false.), right_brace_unicode: (Variable 2 right_brace_unicode Local () () Default (Integer 4 []) Source Public Required .false.), right_bracket_unicode: (Variable 2 right_bracket_unicode Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), semicolon_unicode: (Variable 2 semicolon_unicode Local () () Default (Integer 4 []) Source Public Required .false.), small_a_unicode: (Variable 2 small_a_unicode Local () () Default (Integer 4 []) Source Public Required .false.), small_z_unicode: (Variable 2 small_z_unicode Local () () Default (Integer 4 []) Source Public Required .false.), zero_unicode: (Variable 2 zero_unicode Local () () Default (Integer 4 []) Source Public Required .false.)}) test_ord [] [(= (Var 2 s) (StringConstant "!" (Character 1 1 () [])) ()) (= (Var 2 exclamation_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "!" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 33 (Integer 4 [])) ()) Eq (IntegerConstant 33 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 exclamation_unicode) Eq (IntegerConstant 33 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "$" (Character 1 1 () [])) ()) (= (Var 2 dollar_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "$" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 36 (Integer 4 [])) ()) Eq (IntegerConstant 36 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 dollar_unicode) Eq (IntegerConstant 36 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "(" (Character 1 1 () [])) ()) (= (Var 2 left_parenthesis_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "(" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 40 (Integer 4 [])) ()) Eq (IntegerConstant 40 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 left_parenthesis_unicode) Eq (IntegerConstant 40 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "+" (Character 1 1 () [])) ()) (= (Var 2 plus_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "+" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 43 (Integer 4 [])) ()) Eq (IntegerConstant 43 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 plus_unicode) Eq (IntegerConstant 43 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "0" (Character 1 1 () [])) ()) (= (Var 2 zero_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "0" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 48 (Integer 4 [])) ()) Eq (IntegerConstant 48 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 zero_unicode) Eq (IntegerConstant 48 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "9" (Character 1 1 () [])) ()) (= (Var 2 nine_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "9" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 57 (Integer 4 [])) ()) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 nine_unicode) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant ";" (Character 1 1 () [])) ()) (= (Var 2 semicolon_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant ";" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 59 (Integer 4 [])) ()) Eq (IntegerConstant 59 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 semicolon_unicode) Eq (IntegerConstant 59 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "A" (Character 1 1 () [])) ()) (= (Var 2 capital_a_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "A" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 65 (Integer 4 [])) ()) Eq (IntegerConstant 65 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 capital_a_unicode) Eq (IntegerConstant 65 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "Z" (Character 1 1 () [])) ()) (= (Var 2 capital_z_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "Z" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 90 (Integer 4 [])) ()) Eq (IntegerConstant 90 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 capital_z_unicode) Eq (IntegerConstant 90 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "]" (Character 1 1 () [])) ()) (= (Var 2 right_bracket_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "]" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 93 (Integer 4 [])) ()) Eq (IntegerConstant 93 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 right_bracket_unicode) Eq (IntegerConstant 93 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "a" (Character 1 1 () [])) ()) (= (Var 2 small_a_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "a" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 97 (Integer 4 [])) ()) Eq (IntegerConstant 97 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 small_a_unicode) Eq (IntegerConstant 97 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "z" (Character 1 1 () [])) ()) (= (Var 2 small_z_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "z" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 122 (Integer 4 [])) ()) Eq (IntegerConstant 122 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 small_z_unicode) Eq (IntegerConstant 122 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "}" (Character 1 1 () [])) ()) (= (Var 2 right_brace_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "}" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 125 (Integer 4 [])) ()) Eq (IntegerConstant 125 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 right_brace_unicode) Eq (IntegerConstant 125 (Integer 4 [])) (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 dbb14b48ad..bb71e619f8 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": "b207d735c7faceec3bebeec75fffa059142a0b9971f57adb667f729f", + "stdout_hash": "9024d304ed31e94eca15c2c0cddf4f973c068d26f40d5de34f28533e", "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 20b9519aff..b3b473f557 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 95 {}) _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), abs@__lpython_overloaded_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 4 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_5__abs: (ExternalSymbol 1 abs@__lpython_overloaded_5__abs 4 __lpython_overloaded_5__abs lpython_builtin [] __lpython_overloaded_5__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 4 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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.), i2: (Variable 2 i2 Local () () Default (Integer 8 []) Source Public Required .false.), i3: (Variable 2 i3 Local () () Default (Integer 1 []) Source Public Required .false.), i4: (Variable 2 i4 Local () () Default (Integer 2 []) 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) (RealConstant 5.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 x) (UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((RealConstant 5.500000 (Real 8 [])))] (Real 8 []) (RealConstant 5.500000 (Real 8 [])) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))))] (Real 8 []) (RealConstant 5.500000 (Real 8 [])) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 x2) (Cast (UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_1__abs 2 abs [((Var 2 x2))] (Real 4 []) () ()) RealToReal (Real 8 []) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_4__abs 2 abs [((Var 2 i))] (Integer 4 []) () ()) Eq (IntegerConstant 5 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_4__abs 2 abs [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 i2) (Cast (UnaryOp USub (IntegerConstant 6 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_5__abs 2 abs [((Var 2 i2))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 6 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 i3) (Cast (UnaryOp USub (IntegerConstant 7 (Integer 4 [])) (Integer 4 []) (IntegerConstant -7 (Integer 4 []))) IntegerToInteger (Integer 1 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((Var 2 i3))] (Integer 1 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 7 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i4) (Cast (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 i4))] (Integer 2 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 8 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_6__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_6__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 96 {}) _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), abs@__lpython_overloaded_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 4 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_5__abs: (ExternalSymbol 1 abs@__lpython_overloaded_5__abs 4 __lpython_overloaded_5__abs lpython_builtin [] __lpython_overloaded_5__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 4 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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.), i2: (Variable 2 i2 Local () () Default (Integer 8 []) Source Public Required .false.), i3: (Variable 2 i3 Local () () Default (Integer 1 []) Source Public Required .false.), i4: (Variable 2 i4 Local () () Default (Integer 2 []) 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) (RealConstant 5.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 x) (UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((RealConstant 5.500000 (Real 8 [])))] (Real 8 []) (RealConstant 5.500000 (Real 8 [])) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))))] (Real 8 []) (RealConstant 5.500000 (Real 8 [])) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 x2) (Cast (UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_1__abs 2 abs [((Var 2 x2))] (Real 4 []) () ()) RealToReal (Real 8 []) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_4__abs 2 abs [((Var 2 i))] (Integer 4 []) () ()) Eq (IntegerConstant 5 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_4__abs 2 abs [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 i2) (Cast (UnaryOp USub (IntegerConstant 6 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_5__abs 2 abs [((Var 2 i2))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 6 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 i3) (Cast (UnaryOp USub (IntegerConstant 7 (Integer 4 [])) (Integer 4 []) (IntegerConstant -7 (Integer 4 []))) IntegerToInteger (Integer 1 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((Var 2 i3))] (Integer 1 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 7 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i4) (Cast (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 i4))] (Integer 2 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 8 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_6__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_6__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 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 9b53ce7c26..1809bef485 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": "e22d1fcc06063becc20f2d6114948a3a3c8d1c5e2a00a8563963fe8a", + "stdout_hash": "7ee8c4f01242f46f2db0f4205384e066d2b966642b4855cdb580b0ad", "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 9e17dccea2..bea54d497c 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 95 {}) _lpython_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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) (IntegerConstant 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0b101" (Character 1 5 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (IntegerConstant 64 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0b1000000" (Character 1 9 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) Eq (StringConstant "0b1000000" (Character 1 9 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) Eq (StringConstant "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 96 {}) _lpython_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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) (IntegerConstant 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0b101" (Character 1 5 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (IntegerConstant 64 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0b1000000" (Character 1 9 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) Eq (StringConstant "0b1000000" (Character 1 9 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) Eq (StringConstant "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) (LogicalConstant .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 b5eb6fe694..087f43650a 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.json +++ b/tests/reference/asr-test_builtin_bool-330223a.json @@ -2,11 +2,11 @@ "basename": "asr-test_builtin_bool-330223a", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/test_builtin_bool.py", - "infile_hash": "6bd508b8960906f9b1c46ead5124a15a4bf3a6568f97e4ae536fda3a", + "infile_hash": "4dfa3350f4c58f8d6375fdde90997ef51a16035983c73dd391086149", "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_bool-330223a.stdout", - "stdout_hash": "c069d8c39fb7cf57ca661e8b1e5308c2f7a3c05b71cc22aa601c0074", + "stdout_hash": "be0c64b55a51d907af8ee2ba6bec6513e22bc75e499e163d864b8b45", "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 06bb0a663a..97bfe1ef9a 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 95 {}) _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), bool@__lpython_overloaded_6__bool: (ExternalSymbol 1 bool@__lpython_overloaded_6__bool 4 __lpython_overloaded_6__bool lpython_builtin [] __lpython_overloaded_6__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 4 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 4 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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.), a3: (Variable 2 a3 Local () () Default (Integer 1 []) Source Public Required .false.), a4: (Variable 2 a4 Local () () Default (Integer 2 []) 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), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex 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.)}) test_bool [] [(= (Var 2 a) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) ()) (= (Var 2 a) (IntegerConstant 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 (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 a2) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [((Var 2 a2))] (Logical 1 []) () ()) ()) (= (Var 2 a3) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [((Var 2 a3))] (Logical 1 []) () ()) ()) (= (Var 2 a4) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 a4))] (Logical 1 []) () ()) ()) (= (Var 2 f) (RealConstant 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (RealConstant 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 56.786866 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 0.000000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f2) (Cast (UnaryOp USub (RealConstant 235.600000 (Real 8 [])) (Real 8 []) (RealConstant -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 f2))] (Logical 1 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((LogicalConstant .true. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((LogicalConstant .false. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 2.000000 3.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((BinOp (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 0.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((RealConstant 0.100202 (Real 8 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.100202 (Complex 8 [])) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((Var 2 c1))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((BinOp (Cast (IntegerConstant 3 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 96 {}) _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), bool@__lpython_overloaded_6__bool: (ExternalSymbol 1 bool@__lpython_overloaded_6__bool 4 __lpython_overloaded_6__bool lpython_builtin [] __lpython_overloaded_6__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 4 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 4 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), bool@__lpython_overloaded_9__bool: (ExternalSymbol 1 bool@__lpython_overloaded_9__bool 4 __lpython_overloaded_9__bool lpython_builtin [] __lpython_overloaded_9__bool Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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.), a3: (Variable 2 a3 Local () () Default (Integer 1 []) Source Public Required .false.), a4: (Variable 2 a4 Local () () Default (Integer 2 []) 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), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) ()) (= (Var 2 a) (IntegerConstant 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 (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 a2) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [((Var 2 a2))] (Logical 1 []) () ()) ()) (= (Var 2 a3) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [((Var 2 a3))] (Logical 1 []) () ()) ()) (= (Var 2 a4) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 a4))] (Logical 1 []) () ()) ()) (= (Var 2 f) (RealConstant 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (RealConstant 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 56.786866 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 0.000000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f2) (Cast (UnaryOp USub (RealConstant 235.600000 (Real 8 [])) (Real 8 []) (RealConstant -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 f2))] (Logical 1 []) () ()) ()) (= (Var 2 s) (StringConstant "" (Character 1 0 () [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 s) (StringConstant "str" (Character 1 3 () [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((StringConstant "" (Character 1 0 () [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((StringConstant "str" (Character 1 3 () [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((LogicalConstant .true. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((LogicalConstant .false. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 2.000000 3.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((BinOp (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 0.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((RealConstant 0.100202 (Real 8 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.100202 (Complex 8 [])) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((Var 2 c1))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((BinOp (Cast (IntegerConstant 3 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) ())] 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 204bd2adaf..6a1bf75f3a 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": "dd522b179bfb00e2f2c0343225e871a6f09c6db8d068c0cefcdfa384", + "stdout_hash": "95c14a695b36831347a3a709fa011538a3d09ec2957ff99487f31ff5", "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 08f8f71e25..1bb324e13c 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 95 {}) _lpython_main_program [] [(SubroutineCall 1 test_hex () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0x22" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0x108b" (Character 1 7 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 hex () [((IntegerConstant 34 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x22" (Character 1 1 () [])) ()) Eq (StringConstant "0x22" (Character 1 4 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0x108b" (Character 1 1 () [])) ()) Eq (StringConstant "-0x108b" (Character 1 7 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 96 {}) _lpython_main_program [] [(SubroutineCall 1 test_hex () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0x22" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0x108b" (Character 1 7 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 hex () [((IntegerConstant 34 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x22" (Character 1 1 () [])) ()) Eq (StringConstant "0x22" (Character 1 4 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0x108b" (Character 1 1 () [])) ()) Eq (StringConstant "-0x108b" (Character 1 7 () [])) (Logical 4 []) (LogicalConstant .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 34f3a1e458..d62a954860 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": "5553d3c59975c637c8db8048d1f574f40036f3fdddfa9feb65b082d8", + "stdout_hash": "fe703a4c6bf89d43366ec035e9fef4dfaea0c099381e1f2577409bfc", "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 01df209098..824313bebd 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 95 {}) _lpython_main_program [] [(SubroutineCall 1 test_oct () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0o42" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0o10213" (Character 1 8 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 oct () [((IntegerConstant 34 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o42" (Character 1 1 () [])) ()) Eq (StringConstant "0o42" (Character 1 4 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o10213" (Character 1 1 () [])) ()) Eq (StringConstant "-0o10213" (Character 1 8 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 96 {}) _lpython_main_program [] [(SubroutineCall 1 test_oct () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0o42" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0o10213" (Character 1 8 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 oct () [((IntegerConstant 34 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o42" (Character 1 1 () [])) ()) Eq (StringConstant "0o42" (Character 1 4 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o10213" (Character 1 1 () [])) ()) Eq (StringConstant "-0o10213" (Character 1 8 () [])) (Logical 4 []) (LogicalConstant .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 cbae2db9ba..4b7b23f6d4 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": "f36a315a7ec4c341d33a1134111901220e9ea387c828ea85e7f14c97", + "stdout_hash": "a38bb3dc6e14fbcc129d5a1586e85451a774d2210a933f3517a258c9", "stderr": "asr-test_builtin_pow-f02fcda.stderr", "stderr_hash": "180e1adfbb0d9c63a2fffa31951bbd629b3f1950cf0d97ca1389efe5", "returncode": 0 diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.stdout b/tests/reference/asr-test_builtin_pow-f02fcda.stdout index d66f912218..9451a3e51d 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 95 {}) _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), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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), pow@__lpython_overloaded_4__pow: (ExternalSymbol 1 pow@__lpython_overloaded_4__pow 4 __lpython_overloaded_4__pow lpython_builtin [] __lpython_overloaded_4__pow Public), pow@__lpython_overloaded_5__pow: (ExternalSymbol 1 pow@__lpython_overloaded_5__pow 4 __lpython_overloaded_5__pow lpython_builtin [] __lpython_overloaded_5__pow Public), pow@__lpython_overloaded_6__pow: (ExternalSymbol 1 pow@__lpython_overloaded_6__pow 4 __lpython_overloaded_6__pow lpython_builtin [] __lpython_overloaded_6__pow Public), pow@__lpython_overloaded_7__pow: (ExternalSymbol 1 pow@__lpython_overloaded_7__pow 4 __lpython_overloaded_7__pow lpython_builtin [] __lpython_overloaded_7__pow Public), pow@__lpython_overloaded_8__pow: (ExternalSymbol 1 pow@__lpython_overloaded_8__pow 4 __lpython_overloaded_8__pow lpython_builtin [] __lpython_overloaded_8__pow Public), pow@__lpython_overloaded_9__pow: (ExternalSymbol 1 pow@__lpython_overloaded_9__pow 4 __lpython_overloaded_9__pow lpython_builtin [] __lpython_overloaded_9__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a1: (Variable 2 a1 Local () (RealConstant 4.500000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), a2: (Variable 2 a2 Local () (RealConstant 2.300000 (Real 8 [])) 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.), b1: (Variable 2 b1 Local () (LogicalConstant .true. (Logical 1 [])) Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () (LogicalConstant .false. (Logical 1 [])) Default (Logical 1 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private), eps: (Variable 2 eps Local () () Default (Real 8 []) Source Public Required .false.), f1: (Variable 2 f1 Local () () Default (Real 4 []) Source Public Required .false.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), i1: (Variable 2 i1 Local () () Default (Integer 8 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 8 []) Source Public Required .false.), p: (Variable 2 p Local () () Default (Real 4 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private), x: (Variable 2 x Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () (RealConstant 2.300000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.)}) test_pow [] [(= (Var 2 eps) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 32 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 6 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 3 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 216 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) ()) (= (Var 2 a) (IntegerConstant 6 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))) ()) (= (Var 2 i1) (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 i2) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 i1)) ((Var 2 i2))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 32 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 i1) (Cast (IntegerConstant 6 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 i2) (Cast (UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 f1) (Cast (BinOp (Cast (IntegerConstant 525346 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Div (Cast (IntegerConstant 66456 (Integer 4 [])) IntegerToReal (Real 8 []) ()) (Real 8 []) () ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 f2) (Cast (RealConstant 3.000000 (Real 8 [])) RealToReal (Real 4 []) ()) ()) (= (Var 2 p) (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 f1)) ((Var 2 f2))] (Real 4 []) () ()) ()) (= (Var 2 f1) (FunctionCall 1 pow@__lpython_overloaded_4__pow 2 pow [((Var 2 a)) ((Var 2 f2))] (Real 4 []) () ()) ()) (= (Var 2 f1) (FunctionCall 1 pow@__lpython_overloaded_5__pow 2 pow [((Var 2 f2)) ((Var 2 a))] (Real 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b1)) ((Var 2 b2))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b2)) ((Var 2 b1))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b1)) ((Var 2 b2))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((LogicalConstant .false. (Logical 1 []))) ((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (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 a1)) ((Var 2 a2))] (Real 8 []) (RealConstant 31.797193 (Real 8 [])) ()) Sub (RealConstant 31.797193 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((Var 2 a2)) ((Var 2 a1))] (Real 8 []) (RealConstant 42.439989 (Real 8 [])) ()) Sub (RealConstant 42.439989 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((Var 2 x)) ((Var 2 y))] (Real 8 []) (RealConstant 12.513503 (Real 8 [])) ()) Sub (RealConstant 12.513503 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((Var 2 y)) ((Var 2 x))] (Real 8 []) (RealConstant 12.167000 (Real 8 [])) ()) Sub (RealConstant 12.167000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((Var 2 x)) ((RealConstant 5.500000 (Real 8 [])))] (Real 8 []) (RealConstant 420.888346 (Real 8 [])) ()) Sub (RealConstant 420.888346 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.500000 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 6 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 [])))) ((UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))))] (Integer 4 []) (RealConstant -0.004115 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Add (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 6 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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_3__pow 2 pow [((RealConstant 4.500000 (Real 8 []))) ((RealConstant 2.300000 (Real 8 [])))] (Real 8 []) (RealConstant 31.797193 (Real 8 [])) ()) Sub (RealConstant 31.797193 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((RealConstant 2.300000 (Real 8 []))) ((RealConstant 0.000000 (Real 8 [])))] (Real 8 []) (RealConstant 1.000000 (Real 8 [])) ()) Sub (RealConstant 1.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((RealConstant 2.300000 (Real 8 []))) ((UnaryOp USub (RealConstant 1.500000 (Real 8 [])) (Real 8 []) (RealConstant -1.500000 (Real 8 []))))] (Real 8 []) (RealConstant 0.286687 (Real 8 [])) ()) Sub (RealConstant 0.286687 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 3.400000 (Real 8 [])))] (Real 8 []) (RealConstant 10.556063 (Real 8 [])) ()) Sub (RealConstant 10.556063 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((UnaryOp USub (RealConstant 3.400000 (Real 8 [])) (Real 8 []) (RealConstant -3.400000 (Real 8 []))))] (Real 8 []) (RealConstant 0.094732 (Real 8 [])) ()) Sub (RealConstant 0.094732 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((RealConstant 3.400000 (Real 8 []))) ((IntegerConstant 9 (Integer 4 [])))] (Real 8 []) (RealConstant 60716.992766 (Real 8 [])) ()) Sub (RealConstant 60716.992766 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((RealConstant 0.000000 (Real 8 []))) ((IntegerConstant 53 (Integer 4 [])))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Sub (RealConstant 0.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 16 (Integer 4 [])) ()) Eq (IntegerConstant 16 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_7__pow 2 pow [((UnaryOp USub (RealConstant 4235.000000 (Real 8 [])) (Real 8 []) (RealConstant -4235.000000 (Real 8 [])))) ((IntegerConstant 52 (Integer 4 [])))] (Real 8 []) (RealConstant 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) ()) Sub (RealConstant 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 pow@__lpython_overloaded_9__pow 2 pow [((Var 2 c1)) ((IntegerConstant 4 (Integer 4 [])))] (Complex 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 96 {}) _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), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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), pow@__lpython_overloaded_4__pow: (ExternalSymbol 1 pow@__lpython_overloaded_4__pow 4 __lpython_overloaded_4__pow lpython_builtin [] __lpython_overloaded_4__pow Public), pow@__lpython_overloaded_5__pow: (ExternalSymbol 1 pow@__lpython_overloaded_5__pow 4 __lpython_overloaded_5__pow lpython_builtin [] __lpython_overloaded_5__pow Public), pow@__lpython_overloaded_6__pow: (ExternalSymbol 1 pow@__lpython_overloaded_6__pow 4 __lpython_overloaded_6__pow lpython_builtin [] __lpython_overloaded_6__pow Public), pow@__lpython_overloaded_7__pow: (ExternalSymbol 1 pow@__lpython_overloaded_7__pow 4 __lpython_overloaded_7__pow lpython_builtin [] __lpython_overloaded_7__pow Public), pow@__lpython_overloaded_8__pow: (ExternalSymbol 1 pow@__lpython_overloaded_8__pow 4 __lpython_overloaded_8__pow lpython_builtin [] __lpython_overloaded_8__pow Public), pow@__lpython_overloaded_9__pow: (ExternalSymbol 1 pow@__lpython_overloaded_9__pow 4 __lpython_overloaded_9__pow lpython_builtin [] __lpython_overloaded_9__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a1: (Variable 2 a1 Local () (RealConstant 4.500000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), a2: (Variable 2 a2 Local () (RealConstant 2.300000 (Real 8 [])) 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.), b1: (Variable 2 b1 Local () (LogicalConstant .true. (Logical 1 [])) Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () (LogicalConstant .false. (Logical 1 [])) Default (Logical 1 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private), eps: (Variable 2 eps Local () () Default (Real 8 []) Source Public Required .false.), f1: (Variable 2 f1 Local () () Default (Real 4 []) Source Public Required .false.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), i1: (Variable 2 i1 Local () () Default (Integer 8 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 8 []) Source Public Required .false.), p: (Variable 2 p Local () () Default (Real 4 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private), x: (Variable 2 x Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () (RealConstant 2.300000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.)}) test_pow [] [(= (Var 2 eps) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 32 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 6 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 3 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 216 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) ()) (= (Var 2 a) (IntegerConstant 6 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))) ()) (= (Var 2 i1) (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 i2) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 i1)) ((Var 2 i2))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 32 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 i1) (Cast (IntegerConstant 6 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 i2) (Cast (UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 f1) (Cast (BinOp (Cast (IntegerConstant 525346 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Div (Cast (IntegerConstant 66456 (Integer 4 [])) IntegerToReal (Real 8 []) ()) (Real 8 []) () ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 f2) (Cast (RealConstant 3.000000 (Real 8 [])) RealToReal (Real 4 []) ()) ()) (= (Var 2 p) (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 f1)) ((Var 2 f2))] (Real 4 []) () ()) ()) (= (Var 2 f1) (FunctionCall 1 pow@__lpython_overloaded_4__pow 2 pow [((Var 2 a)) ((Var 2 f2))] (Real 4 []) () ()) ()) (= (Var 2 f1) (FunctionCall 1 pow@__lpython_overloaded_5__pow 2 pow [((Var 2 f2)) ((Var 2 a))] (Real 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b1)) ((Var 2 b2))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b2)) ((Var 2 b1))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b1)) ((Var 2 b2))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((LogicalConstant .false. (Logical 1 []))) ((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (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 a1)) ((Var 2 a2))] (Real 8 []) (RealConstant 31.797193 (Real 8 [])) ()) Sub (RealConstant 31.797193 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((Var 2 a2)) ((Var 2 a1))] (Real 8 []) (RealConstant 42.439989 (Real 8 [])) ()) Sub (RealConstant 42.439989 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((Var 2 x)) ((Var 2 y))] (Real 8 []) (RealConstant 12.513503 (Real 8 [])) ()) Sub (RealConstant 12.513503 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((Var 2 y)) ((Var 2 x))] (Real 8 []) (RealConstant 12.167000 (Real 8 [])) ()) Sub (RealConstant 12.167000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((Var 2 x)) ((RealConstant 5.500000 (Real 8 [])))] (Real 8 []) (RealConstant 420.888346 (Real 8 [])) ()) Sub (RealConstant 420.888346 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.500000 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 6 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 [])))) ((UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))))] (Integer 4 []) (RealConstant -0.004115 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Add (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 6 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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_3__pow 2 pow [((RealConstant 4.500000 (Real 8 []))) ((RealConstant 2.300000 (Real 8 [])))] (Real 8 []) (RealConstant 31.797193 (Real 8 [])) ()) Sub (RealConstant 31.797193 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((RealConstant 2.300000 (Real 8 []))) ((RealConstant 0.000000 (Real 8 [])))] (Real 8 []) (RealConstant 1.000000 (Real 8 [])) ()) Sub (RealConstant 1.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((RealConstant 2.300000 (Real 8 []))) ((UnaryOp USub (RealConstant 1.500000 (Real 8 [])) (Real 8 []) (RealConstant -1.500000 (Real 8 []))))] (Real 8 []) (RealConstant 0.286687 (Real 8 [])) ()) Sub (RealConstant 0.286687 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 3.400000 (Real 8 [])))] (Real 8 []) (RealConstant 10.556063 (Real 8 [])) ()) Sub (RealConstant 10.556063 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((UnaryOp USub (RealConstant 3.400000 (Real 8 [])) (Real 8 []) (RealConstant -3.400000 (Real 8 []))))] (Real 8 []) (RealConstant 0.094732 (Real 8 [])) ()) Sub (RealConstant 0.094732 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((RealConstant 3.400000 (Real 8 []))) ((IntegerConstant 9 (Integer 4 [])))] (Real 8 []) (RealConstant 60716.992766 (Real 8 [])) ()) Sub (RealConstant 60716.992766 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((RealConstant 0.000000 (Real 8 []))) ((IntegerConstant 53 (Integer 4 [])))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Sub (RealConstant 0.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 16 (Integer 4 [])) ()) Eq (IntegerConstant 16 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_7__pow 2 pow [((UnaryOp USub (RealConstant 4235.000000 (Real 8 [])) (Real 8 []) (RealConstant -4235.000000 (Real 8 [])))) ((IntegerConstant 52 (Integer 4 [])))] (Real 8 []) (RealConstant 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) ()) Sub (RealConstant 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 pow@__lpython_overloaded_9__pow 2 pow [((Var 2 c1)) ((IntegerConstant 4 (Integer 4 [])))] (Complex 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 9b8dda1c1c..c440f37f2c 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": "5ff8351a86651e338380cd112bd849b23edc5c0cfe6b5dec98344899", + "stdout_hash": "403eb34f246f40dd6ca37383cd575fa8bd8a0fd2d416e13d235fff9b", "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 1e76870f2d..e921bdb632 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 95 {}) _lpython_main_program [] [(SubroutineCall 1 test_round () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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), round@__lpython_overloaded_3__round: (ExternalSymbol 1 round@__lpython_overloaded_3__round 4 __lpython_overloaded_3__round lpython_builtin [] __lpython_overloaded_3__round Public), round@__lpython_overloaded_4__round: (ExternalSymbol 1 round@__lpython_overloaded_4__round 4 __lpython_overloaded_4__round lpython_builtin [] __lpython_overloaded_4__round Public), round@__lpython_overloaded_5__round: (ExternalSymbol 1 round@__lpython_overloaded_5__round 4 __lpython_overloaded_5__round lpython_builtin [] __lpython_overloaded_5__round Public), round@__lpython_overloaded_6__round: (ExternalSymbol 1 round@__lpython_overloaded_6__round 4 __lpython_overloaded_6__round lpython_builtin [] __lpython_overloaded_6__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.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 1 []) Source Public Required .false.), i3: (Variable 2 i3 Local () () Default (Integer 2 []) Source Public Required .false.), i4: (Variable 2 i4 Local () () Default (Integer 8 []) Source Public Required .false.), round: (ExternalSymbol 2 round 4 round lpython_builtin [] round Private)}) test_round [] [(= (Var 2 f) (RealConstant 5.678000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (UnaryOp USub (RealConstant 183745.230000 (Real 8 [])) (Real 8 []) (RealConstant -183745.230000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 183745 (Integer 4 [])) (Integer 4 []) (IntegerConstant -183745 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 44.340000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 44 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 0.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (UnaryOp USub (RealConstant 50.500000 (Real 8 [])) (Real 8 []) (RealConstant -50.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 50 (Integer 4 [])) (Integer 4 []) (IntegerConstant -50 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 1.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 13.001000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 13 (Integer 4 [])) ()) Eq (IntegerConstant 13 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (RealConstant 40.499990 (Real 8 [])) (Real 8 []) (RealConstant -40.499990 (Real 8 []))))] (Integer 4 []) (IntegerConstant -40 (Integer 4 [])) ()) Eq (UnaryOp USub (IntegerConstant 40 (Integer 4 [])) (Integer 4 []) (IntegerConstant -40 (Integer 4 []))) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 0.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (RealConstant 0.500000 (Real 8 [])) (Real 8 []) (RealConstant -0.500000 (Real 8 []))))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 1.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 2 (Integer 4 [])) ()) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 50.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 50 (Integer 4 [])) ()) Eq (IntegerConstant 50 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 56.780000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 57 (Integer 4 [])) ()) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 f2) (Cast (RealConstant 5.678000 (Real 8 [])) RealToReal (Real 4 []) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((Var 2 f2))] (Integer 4 []) () ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 i))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((IntegerConstant 4 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ()) Eq (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 i2) (Cast (IntegerConstant 7 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 round@__lpython_overloaded_4__round 2 round [((Var 2 i2))] (Integer 1 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 7 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i3) (Cast (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 round@__lpython_overloaded_5__round 2 round [((Var 2 i3))] (Integer 2 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 i4) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_3__round 2 round [((Var 2 i4))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 96 {}) _lpython_main_program [] [(SubroutineCall 1 test_round () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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), round@__lpython_overloaded_3__round: (ExternalSymbol 1 round@__lpython_overloaded_3__round 4 __lpython_overloaded_3__round lpython_builtin [] __lpython_overloaded_3__round Public), round@__lpython_overloaded_4__round: (ExternalSymbol 1 round@__lpython_overloaded_4__round 4 __lpython_overloaded_4__round lpython_builtin [] __lpython_overloaded_4__round Public), round@__lpython_overloaded_5__round: (ExternalSymbol 1 round@__lpython_overloaded_5__round 4 __lpython_overloaded_5__round lpython_builtin [] __lpython_overloaded_5__round Public), round@__lpython_overloaded_6__round: (ExternalSymbol 1 round@__lpython_overloaded_6__round 4 __lpython_overloaded_6__round lpython_builtin [] __lpython_overloaded_6__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.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 1 []) Source Public Required .false.), i3: (Variable 2 i3 Local () () Default (Integer 2 []) Source Public Required .false.), i4: (Variable 2 i4 Local () () Default (Integer 8 []) Source Public Required .false.), round: (ExternalSymbol 2 round 4 round lpython_builtin [] round Private)}) test_round [] [(= (Var 2 f) (RealConstant 5.678000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (UnaryOp USub (RealConstant 183745.230000 (Real 8 [])) (Real 8 []) (RealConstant -183745.230000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 183745 (Integer 4 [])) (Integer 4 []) (IntegerConstant -183745 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 44.340000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 44 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 0.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (UnaryOp USub (RealConstant 50.500000 (Real 8 [])) (Real 8 []) (RealConstant -50.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 50 (Integer 4 [])) (Integer 4 []) (IntegerConstant -50 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 1.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 13.001000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 13 (Integer 4 [])) ()) Eq (IntegerConstant 13 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (RealConstant 40.499990 (Real 8 [])) (Real 8 []) (RealConstant -40.499990 (Real 8 []))))] (Integer 4 []) (IntegerConstant -40 (Integer 4 [])) ()) Eq (UnaryOp USub (IntegerConstant 40 (Integer 4 [])) (Integer 4 []) (IntegerConstant -40 (Integer 4 []))) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 0.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (RealConstant 0.500000 (Real 8 [])) (Real 8 []) (RealConstant -0.500000 (Real 8 []))))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 1.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 2 (Integer 4 [])) ()) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 50.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 50 (Integer 4 [])) ()) Eq (IntegerConstant 50 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 56.780000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 57 (Integer 4 [])) ()) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 f2) (Cast (RealConstant 5.678000 (Real 8 [])) RealToReal (Real 4 []) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((Var 2 f2))] (Integer 4 []) () ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 i))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((IntegerConstant 4 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ()) Eq (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 i2) (Cast (IntegerConstant 7 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 round@__lpython_overloaded_4__round 2 round [((Var 2 i2))] (Integer 1 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 7 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i3) (Cast (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 round@__lpython_overloaded_5__round 2 round [((Var 2 i3))] (Integer 2 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 i4) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_3__round 2 round [((Var 2 i4))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .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 2ea0b3475e..7597e663a3 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": "6c389bcb6e7ee40ce8ba0f55489c3fca8e62ca6e05ec5d699668fe1f", + "stdout_hash": "0b7d4dde13b30c17ff71ebf3ad9a5b1fb03ae41e91a92ef44550ec27", "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 99467a3cbb..1af8e1cc1d 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 95 {}) _lpython_main_program [] [(SubroutineCall 1 test_str_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 94 {}) 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 () [((IntegerConstant 356 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "356" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (StringConstant "356" (Character 1 3 () [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (FunctionCall 2 str () [((UnaryOp USub (IntegerConstant 567 (Integer 4 [])) (Integer 4 []) (IntegerConstant -567 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-567" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (StringConstant "-567" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 str () [((IntegerConstant 4 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "4" (Character 1 1 () [])) ()) Eq (StringConstant "4" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 str () [((UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-5" (Character 1 1 () [])) ()) Eq (StringConstant "-5" (Character 1 2 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 96 {}) _lpython_main_program [] [(SubroutineCall 1 test_str_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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 () [((IntegerConstant 356 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "356" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (StringConstant "356" (Character 1 3 () [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (FunctionCall 2 str () [((UnaryOp USub (IntegerConstant 567 (Integer 4 [])) (Integer 4 []) (IntegerConstant -567 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-567" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (StringConstant "-567" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 str () [((IntegerConstant 4 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "4" (Character 1 1 () [])) ()) Eq (StringConstant "4" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 str () [((UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-5" (Character 1 1 () [])) ()) Eq (StringConstant "-5" (Character 1 2 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_max_min-3c2fc51.json b/tests/reference/asr-test_max_min-3c2fc51.json index f792a7e735..39b1edb54e 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.json +++ b/tests/reference/asr-test_max_min-3c2fc51.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_max_min-3c2fc51.stdout", - "stdout_hash": "ce739149ef22b49c0024d69c1ea65c2cb6ddf75962df3b2a2ada5014", + "stdout_hash": "8847038dc2c663f1eeb3493fb6663e5450b85e6dc20d1b4e9f73de02", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_max_min-3c2fc51.stdout b/tests/reference/asr-test_max_min-3c2fc51.stdout index 91fc79b521..91c39b28e5 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.stdout +++ b/tests/reference/asr-test_max_min-3c2fc51.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 99 {}) _lpython_main_program [] [(SubroutineCall 1 check () [] ())] Source Public Implementation () .false. .false.), check: (Subroutine (SymbolTable 6 {}) check [] [(SubroutineCall 1 test_max_int () [] ()) (SubroutineCall 1 test_max_float () [] ()) (SubroutineCall 1 test_min_int () [] ()) (SubroutineCall 1 test_min_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 98 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), max@__lpython_overloaded_0__max: (ExternalSymbol 1 max@__lpython_overloaded_0__max 8 __lpython_overloaded_0__max lpython_builtin [] __lpython_overloaded_0__max Public), max@__lpython_overloaded_1__max: (ExternalSymbol 1 max@__lpython_overloaded_1__max 8 __lpython_overloaded_1__max lpython_builtin [] __lpython_overloaded_1__max Public), max@__lpython_overloaded_2__max: (ExternalSymbol 1 max@__lpython_overloaded_2__max 8 __lpython_overloaded_2__max lpython_builtin [] __lpython_overloaded_2__max Public), max@__lpython_overloaded_3__max: (ExternalSymbol 1 max@__lpython_overloaded_3__max 8 __lpython_overloaded_3__max lpython_builtin [] __lpython_overloaded_3__max Public), min@__lpython_overloaded_0__min: (ExternalSymbol 1 min@__lpython_overloaded_0__min 8 __lpython_overloaded_0__min lpython_builtin [] __lpython_overloaded_0__min Public), min@__lpython_overloaded_1__min: (ExternalSymbol 1 min@__lpython_overloaded_1__min 8 __lpython_overloaded_1__min lpython_builtin [] __lpython_overloaded_1__min Public), min@__lpython_overloaded_2__min: (ExternalSymbol 1 min@__lpython_overloaded_2__min 8 __lpython_overloaded_2__min lpython_builtin [] __lpython_overloaded_2__min Public), min@__lpython_overloaded_3__min: (ExternalSymbol 1 min@__lpython_overloaded_3__min 8 __lpython_overloaded_3__min lpython_builtin [] __lpython_overloaded_3__min Public), test_max_float: (Subroutine (SymbolTable 3 {d: (Variable 3 d Local () (RealConstant 23.233000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), e: (Variable 3 e Local () (RealConstant 23.223300 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), f: (Variable 3 f Local () (RealConstant 21.230000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), max: (ExternalSymbol 3 max 8 max lpython_builtin [] max Private)}) test_max_float [] [(Assert (Compare (FunctionCall 1 max@__lpython_overloaded_2__max 3 max [((Var 3 d)) ((Var 3 e)) ((Var 3 f))] (Real 8 []) (RealConstant 23.233000 (Real 8 [])) ()) Eq (Var 3 d) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_3__max 3 max [((Var 3 e)) ((Var 3 f))] (Real 8 []) (RealConstant 23.223300 (Real 8 [])) ()) Eq (Var 3 e) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_max_int: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () (IntegerConstant 1 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () (IntegerConstant 2 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), c: (Variable 2 c Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), max: (ExternalSymbol 2 max 8 max lpython_builtin [] max Private)}) test_max_int [] [(Assert (Compare (FunctionCall 1 max@__lpython_overloaded_0__max 2 max [((Var 2 a)) ((Var 2 b))] (Integer 4 []) (IntegerConstant 2 (Integer 4 [])) ()) Eq (Var 2 b) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_1__max 2 max [((Var 2 a)) ((Var 2 b)) ((Var 2 c))] (Integer 4 []) (IntegerConstant 3 (Integer 4 [])) ()) Eq (Var 2 c) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_1__max 2 max [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 3 (Integer 4 [])) ()) Eq (IntegerConstant 3 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_0__max 2 max [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 6 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 6 (Integer 4 [])) ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_min_float: (Subroutine (SymbolTable 5 {d: (Variable 5 d Local () (RealConstant 23.233000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), e: (Variable 5 e Local () (RealConstant 23.223300 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), f: (Variable 5 f Local () (RealConstant 21.230000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), min: (ExternalSymbol 5 min 8 min lpython_builtin [] min Private)}) test_min_float [] [(Assert (Compare (FunctionCall 1 min@__lpython_overloaded_2__min 5 min [((Var 5 d)) ((Var 5 e)) ((Var 5 f))] (Real 8 []) (RealConstant 21.230000 (Real 8 [])) ()) Eq (Var 5 f) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_3__min 5 min [((Var 5 e)) ((Var 5 f))] (Real 8 []) (RealConstant 21.230000 (Real 8 [])) ()) Eq (Var 5 f) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_min_int: (Subroutine (SymbolTable 4 {a: (Variable 4 a Local () (IntegerConstant 1 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), b: (Variable 4 b Local () (IntegerConstant 2 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), c: (Variable 4 c Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), min: (ExternalSymbol 4 min 8 min lpython_builtin [] min Private)}) test_min_int [] [(Assert (Compare (FunctionCall 1 min@__lpython_overloaded_0__min 4 min [((Var 4 a)) ((Var 4 b))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (Var 4 a) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_1__min 4 min [((Var 4 a)) ((Var 4 b)) ((Var 4 c))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (Var 4 a) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_1__min 4 min [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_0__min 4 min [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 6 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 100 {}) _lpython_main_program [] [(SubroutineCall 1 check () [] ())] Source Public Implementation () .false. .false.), check: (Subroutine (SymbolTable 6 {}) check [] [(SubroutineCall 1 test_max_int () [] ()) (SubroutineCall 1 test_max_float () [] ()) (SubroutineCall 1 test_min_int () [] ()) (SubroutineCall 1 test_min_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 99 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), max@__lpython_overloaded_0__max: (ExternalSymbol 1 max@__lpython_overloaded_0__max 8 __lpython_overloaded_0__max lpython_builtin [] __lpython_overloaded_0__max Public), max@__lpython_overloaded_1__max: (ExternalSymbol 1 max@__lpython_overloaded_1__max 8 __lpython_overloaded_1__max lpython_builtin [] __lpython_overloaded_1__max Public), max@__lpython_overloaded_2__max: (ExternalSymbol 1 max@__lpython_overloaded_2__max 8 __lpython_overloaded_2__max lpython_builtin [] __lpython_overloaded_2__max Public), max@__lpython_overloaded_3__max: (ExternalSymbol 1 max@__lpython_overloaded_3__max 8 __lpython_overloaded_3__max lpython_builtin [] __lpython_overloaded_3__max Public), min@__lpython_overloaded_0__min: (ExternalSymbol 1 min@__lpython_overloaded_0__min 8 __lpython_overloaded_0__min lpython_builtin [] __lpython_overloaded_0__min Public), min@__lpython_overloaded_1__min: (ExternalSymbol 1 min@__lpython_overloaded_1__min 8 __lpython_overloaded_1__min lpython_builtin [] __lpython_overloaded_1__min Public), min@__lpython_overloaded_2__min: (ExternalSymbol 1 min@__lpython_overloaded_2__min 8 __lpython_overloaded_2__min lpython_builtin [] __lpython_overloaded_2__min Public), min@__lpython_overloaded_3__min: (ExternalSymbol 1 min@__lpython_overloaded_3__min 8 __lpython_overloaded_3__min lpython_builtin [] __lpython_overloaded_3__min Public), test_max_float: (Subroutine (SymbolTable 3 {d: (Variable 3 d Local () (RealConstant 23.233000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), e: (Variable 3 e Local () (RealConstant 23.223300 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), f: (Variable 3 f Local () (RealConstant 21.230000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), max: (ExternalSymbol 3 max 8 max lpython_builtin [] max Private)}) test_max_float [] [(Assert (Compare (FunctionCall 1 max@__lpython_overloaded_2__max 3 max [((Var 3 d)) ((Var 3 e)) ((Var 3 f))] (Real 8 []) (RealConstant 23.233000 (Real 8 [])) ()) Eq (Var 3 d) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_3__max 3 max [((Var 3 e)) ((Var 3 f))] (Real 8 []) (RealConstant 23.223300 (Real 8 [])) ()) Eq (Var 3 e) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_max_int: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () (IntegerConstant 1 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () (IntegerConstant 2 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), c: (Variable 2 c Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), max: (ExternalSymbol 2 max 8 max lpython_builtin [] max Private)}) test_max_int [] [(Assert (Compare (FunctionCall 1 max@__lpython_overloaded_0__max 2 max [((Var 2 a)) ((Var 2 b))] (Integer 4 []) (IntegerConstant 2 (Integer 4 [])) ()) Eq (Var 2 b) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_1__max 2 max [((Var 2 a)) ((Var 2 b)) ((Var 2 c))] (Integer 4 []) (IntegerConstant 3 (Integer 4 [])) ()) Eq (Var 2 c) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_1__max 2 max [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 3 (Integer 4 [])) ()) Eq (IntegerConstant 3 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_0__max 2 max [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 6 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 6 (Integer 4 [])) ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_min_float: (Subroutine (SymbolTable 5 {d: (Variable 5 d Local () (RealConstant 23.233000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), e: (Variable 5 e Local () (RealConstant 23.223300 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), f: (Variable 5 f Local () (RealConstant 21.230000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), min: (ExternalSymbol 5 min 8 min lpython_builtin [] min Private)}) test_min_float [] [(Assert (Compare (FunctionCall 1 min@__lpython_overloaded_2__min 5 min [((Var 5 d)) ((Var 5 e)) ((Var 5 f))] (Real 8 []) (RealConstant 21.230000 (Real 8 [])) ()) Eq (Var 5 f) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_3__min 5 min [((Var 5 e)) ((Var 5 f))] (Real 8 []) (RealConstant 21.230000 (Real 8 [])) ()) Eq (Var 5 f) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_min_int: (Subroutine (SymbolTable 4 {a: (Variable 4 a Local () (IntegerConstant 1 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), b: (Variable 4 b Local () (IntegerConstant 2 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), c: (Variable 4 c Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), min: (ExternalSymbol 4 min 8 min lpython_builtin [] min Private)}) test_min_int [] [(Assert (Compare (FunctionCall 1 min@__lpython_overloaded_0__min 4 min [((Var 4 a)) ((Var 4 b))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (Var 4 a) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_1__min 4 min [((Var 4 a)) ((Var 4 b)) ((Var 4 c))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (Var 4 a) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_1__min 4 min [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_0__min 4 min [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 6 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_pow-3f5d550.json b/tests/reference/asr-test_pow-3f5d550.json index 03188cbebf..2beaf469ed 100644 --- a/tests/reference/asr-test_pow-3f5d550.json +++ b/tests/reference/asr-test_pow-3f5d550.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_pow-3f5d550.stdout", - "stdout_hash": "f858dfd71bd4743a60b2677bfe94886076efd1e87e78c295c00c8dd4", + "stdout_hash": "140db37de9a507cc81dc9fab14f4e5f76f0e5e216312c9c5526f1570", "stderr": "asr-test_pow-3f5d550.stderr", "stderr_hash": "3d950301563cce75654f28bf41f6f53428ed1f5ae997774345f374a3", "returncode": 0 diff --git a/tests/reference/asr-test_pow-3f5d550.stdout b/tests/reference/asr-test_pow-3f5d550.stdout index e7444c7cb4..cf2b1e00d2 100644 --- a/tests/reference/asr-test_pow-3f5d550.stdout +++ b/tests/reference/asr-test_pow-3f5d550.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 95 {}) _lpython_main_program [] [(SubroutineCall 1 main () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main: (Subroutine (SymbolTable 2 {pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private)}) main [] [(Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ())]) (Print () [(BinOp (IntegerConstant 2 (Integer 4 [])) Pow (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 94 {}) 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)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 96 {}) _lpython_main_program [] [(SubroutineCall 1 main () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main: (Subroutine (SymbolTable 2 {pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private)}) main [] [(Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ())]) (Print () [(BinOp (IntegerConstant 2 (Integer 4 [])) Pow (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 95 {}) 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)}) []) From 6c3667571f41b82542a60416ebd438bbcfceb40f Mon Sep 17 00:00:00 2001 From: Naman Gera Date: Wed, 27 Apr 2022 15:53:00 +0530 Subject: [PATCH 09/14] Update tests and reference --- src/runtime/lpython_builtin.py | 4 ++++ tests/constants1.py | 17 ++++++++--------- tests/reference/asr-complex1-f26c460.json | 2 +- tests/reference/asr-complex1-f26c460.stdout | 2 +- tests/reference/asr-constants1-5828e8a.json | 4 ++-- 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-expr8-6beda60.json | 2 +- tests/reference/asr-expr8-6beda60.stdout | 2 +- tests/reference/asr-test_builtin-aa64615.json | 2 +- tests/reference/asr-test_builtin-aa64615.stdout | 2 +- .../reference/asr-test_builtin_abs-c74d2c9.json | 2 +- .../asr-test_builtin_abs-c74d2c9.stdout | 2 +- .../reference/asr-test_builtin_bin-52ba9fa.json | 2 +- .../asr-test_builtin_bin-52ba9fa.stdout | 2 +- .../asr-test_builtin_bool-330223a.json | 2 +- .../asr-test_builtin_bool-330223a.stdout | 2 +- .../reference/asr-test_builtin_hex-64bd268.json | 2 +- .../asr-test_builtin_hex-64bd268.stdout | 2 +- .../reference/asr-test_builtin_len-55b0dec.json | 10 +++++----- .../asr-test_builtin_len-55b0dec.stdout | 2 +- .../reference/asr-test_builtin_oct-20b9066.json | 2 +- .../asr-test_builtin_oct-20b9066.stdout | 2 +- .../reference/asr-test_builtin_pow-f02fcda.json | 2 +- .../asr-test_builtin_pow-f02fcda.stdout | 2 +- .../asr-test_builtin_round-7417a21.json | 2 +- .../asr-test_builtin_round-7417a21.stdout | 2 +- .../reference/asr-test_builtin_str-580e920.json | 2 +- .../asr-test_builtin_str-580e920.stdout | 2 +- tests/reference/asr-test_max_min-3c2fc51.json | 2 +- tests/reference/asr-test_max_min-3c2fc51.stdout | 2 +- tests/reference/asr-test_pow-3f5d550.json | 2 +- tests/reference/asr-test_pow-3f5d550.stdout | 2 +- tests/reference/ast-constants1-91cb6ff.json | 4 ++-- tests/reference/ast-constants1-91cb6ff.stdout | 2 +- tests/tests.toml | 4 ++-- 43 files changed, 60 insertions(+), 57 deletions(-) diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index 00be5947bc..7f18e792f5 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -177,6 +177,10 @@ def bool(s: str) -> bool: """ return len(s) > 0 +@interface +def len(s: str) -> i32: + pass + #: pow() as a generic procedure. #: supported types for arguments: #: (i32, i32), (i64, i64), (f64, f64), diff --git a/tests/constants1.py b/tests/constants1.py index 0e5923070c..a35d47a1c5 100644 --- a/tests/constants1.py +++ b/tests/constants1.py @@ -35,23 +35,22 @@ def test_len(): a = len('') a = len('test') a = len("this is a test") - # TODO(namannimmo10): These commented out tests should work - # a = len((1, 2, 3)) - # a = len((("c", "b", 3.4), ("c", 3, 5.6))) - # a = len([1, 2, 3]) - # a = len([[-4, -5, -6], [-1, -2, -3]]) - # a = len({1, 2, 3}) - # a = len({1: "c", 2: "b", 3: "c"}) + a = len((1, 2, 3)) + a = len((("c", "b", 3.4), ("c", 3, 5.6))) + a = len([1, 2, 3]) + a = len([[-4, -5, -6], [-1, -2, -3]]) + a = len({1, 2, 3}) + a = len({1: "c", 2: "b", 3: "c"}) def test_bool(): a: bool a = bool(0) a = bool(-1) - # a = bool('') + a = bool('') a = bool(complex(0, 0)) assert a == False - # a = bool('t') + a = bool('t') a = bool(2.3) assert a == True diff --git a/tests/reference/asr-complex1-f26c460.json b/tests/reference/asr-complex1-f26c460.json index 57c07435eb..47230f44b2 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": "4915e17b7b2faf7fb5eea992a3316a7de12ff06aa99d8be5872e25d5", + "stdout_hash": "5869e314cb005e53ec05365a2887376794de5ecb2148e5f049e51096", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex1-f26c460.stdout b/tests/reference/asr-complex1-f26c460.stdout index f69ee2b7f6..ff814ad255 100644 --- a/tests/reference/asr-complex1-f26c460.stdout +++ b/tests/reference/asr-complex1-f26c460.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_0__complex: (ExternalSymbol 1 complex@__lpython_overloaded_0__complex 5 __lpython_overloaded_0__complex lpython_builtin [] __lpython_overloaded_0__complex Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 5 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_1__complex: (ExternalSymbol 1 complex@__lpython_overloaded_1__complex 5 __lpython_overloaded_1__complex lpython_builtin [] __lpython_overloaded_1__complex Public), complex@__lpython_overloaded_2__complex: (ExternalSymbol 1 complex@__lpython_overloaded_2__complex 5 __lpython_overloaded_2__complex lpython_builtin [] __lpython_overloaded_2__complex Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 5 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 5 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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 (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 y) (BinOp (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 z) (Cast (BinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (BinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (BinOp (Cast (IntegerConstant 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) (Cast (FunctionCall 1 complex@__lpython_overloaded_0__complex 2 complex [] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_1__complex 2 complex [((RealConstant 3.400000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 5.000000 (Real 8 []))) ((RealConstant 4.300000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (FunctionCall 1 complex@__lpython_overloaded_2__complex 2 complex [((IntegerConstant 1 (Integer 4 [])))] (Complex 4 []) (ComplexConstant 1.000000 0.000000 (Complex 8 [])) ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c2) (Cast (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 4.500000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c3) (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (Cast (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) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.345340 (Real 8 []))) ((RealConstant 4.867868 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 0.015553 0.065561 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -5.000000 10.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 1.000000 1.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_0__complex: (ExternalSymbol 1 complex@__lpython_overloaded_0__complex 5 __lpython_overloaded_0__complex lpython_builtin [] __lpython_overloaded_0__complex Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 5 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_1__complex: (ExternalSymbol 1 complex@__lpython_overloaded_1__complex 5 __lpython_overloaded_1__complex lpython_builtin [] __lpython_overloaded_1__complex Public), complex@__lpython_overloaded_2__complex: (ExternalSymbol 1 complex@__lpython_overloaded_2__complex 5 __lpython_overloaded_2__complex lpython_builtin [] __lpython_overloaded_2__complex Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 5 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 5 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 97 {}) 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 (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 y) (BinOp (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()) ()) (= (Var 3 z) (Cast (BinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (BinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) () ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (BinOp (Cast (IntegerConstant 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) (Cast (FunctionCall 1 complex@__lpython_overloaded_0__complex 2 complex [] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_1__complex 2 complex [((RealConstant 3.400000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 5.000000 (Real 8 []))) ((RealConstant 4.300000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (FunctionCall 1 complex@__lpython_overloaded_2__complex 2 complex [((IntegerConstant 1 (Integer 4 [])))] (Complex 4 []) (ComplexConstant 1.000000 0.000000 (Complex 8 [])) ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c2) (Cast (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 4.500000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c3) (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (Compare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) () ()) ()) (= (Var 2 b) (Compare (Cast (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) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.345340 (Real 8 []))) ((RealConstant 4.867868 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 0.015553 0.065561 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -5.000000 10.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (BinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 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 6eb6bf5aa1..fd6f069dd2 100644 --- a/tests/reference/asr-constants1-5828e8a.json +++ b/tests/reference/asr-constants1-5828e8a.json @@ -2,11 +2,11 @@ "basename": "asr-constants1-5828e8a", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/constants1.py", - "infile_hash": "86d7dacf1572246948121f4ef0aaddd1cb8be614c003453e8faae162", + "infile_hash": "0353168d7f204b8ce707571434961e310c14a7714ba7ba3e87d0fbd5", "outfile": null, "outfile_hash": null, "stdout": "asr-constants1-5828e8a.stdout", - "stdout_hash": "1c9ab679ec42e21b37f91626980d61b1bb1e33c427ead9c07098cd7e", + "stdout_hash": "6ecd2b0f820bc997766cdb6916778daf70e82e354161635294892256", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-constants1-5828e8a.stdout b/tests/reference/asr-constants1-5828e8a.stdout index c38a55371d..fad03cc1ed 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_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 13 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 13 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), abs@__lpython_overloaded_8__abs: (ExternalSymbol 1 abs@__lpython_overloaded_8__abs 13 __lpython_overloaded_8__abs lpython_builtin [] __lpython_overloaded_8__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_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 13 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 13 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 13 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 13 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 104 {}) 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) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((IntegerConstant 5 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 5 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 500 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .true. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((RealConstant 3.450000 (Real 8 [])))] (Real 8 []) (RealConstant 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((UnaryOp USub (RealConstant 5346.340000 (Real 8 [])) (Real 8 []) (RealConstant -5346.340000 (Real 8 []))))] (Real 8 []) (RealConstant 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_8__abs 4 abs [((FunctionCall 1 complex@__lpython_overloaded_5__complex 4 complex [((RealConstant 3.450000 (Real 8 []))) ((RealConstant 5.600000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.450000 5.600000 (Complex 8 [])) ()))] (Real 8 []) (RealConstant 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 [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_8__bool 6 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 6 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_5__bool 6 bool [((RealConstant 2.300000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .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 () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 8 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 56 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 42 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 12648430 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-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) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 8 a) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .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 () [((IntegerConstant 9 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 9 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant -3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 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.)}) test_float [] [(= (Var 10 a) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 10 a) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToReal (Real 8 []) (RealConstant 5.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant -1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 0.000000 (Real 8 []))) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.)}) test_int [] [(= (Var 9 a) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (RealConstant 4.560000 (Real 8 [])) RealToInteger (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (UnaryOp USub (RealConstant 5.000010 (Real 8 [])) (Real 8 []) (RealConstant -5.000010 (Real 8 []))) RealToInteger (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (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.)}) test_len [] [(= (Var 5 a) (StringLen (StringConstant "" (Character 1 0 () [])) (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) ()) (= (Var 5 a) (StringLen (StringConstant "test" (Character 1 4 () [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) ()) (= (Var 5 a) (StringLen (StringConstant "this is a test" (Character 1 14 () [])) (Integer 4 []) (IntegerConstant 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 () [((StringConstant "5" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (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 () []) (StringConstant "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((RealConstant 5.600000 (Real 8 [])))] (Character 1 -2 () []) (StringConstant "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .true. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .false. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((StringConstant "5346" (Character 1 4 () [])))] (Character 1 -2 () []) (StringConstant "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_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 13 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 13 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), abs@__lpython_overloaded_8__abs: (ExternalSymbol 1 abs@__lpython_overloaded_8__abs 13 __lpython_overloaded_8__abs lpython_builtin [] __lpython_overloaded_8__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_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 13 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 13 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), bool@__lpython_overloaded_9__bool: (ExternalSymbol 1 bool@__lpython_overloaded_9__bool 13 __lpython_overloaded_9__bool lpython_builtin [] __lpython_overloaded_9__bool Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 13 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 13 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 105 {}) 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) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((IntegerConstant 5 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 5 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 500 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .true. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((RealConstant 3.450000 (Real 8 [])))] (Real 8 []) (RealConstant 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((UnaryOp USub (RealConstant 5346.340000 (Real 8 [])) (Real 8 []) (RealConstant -5346.340000 (Real 8 []))))] (Real 8 []) (RealConstant 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_8__abs 4 abs [((FunctionCall 1 complex@__lpython_overloaded_5__complex 4 complex [((RealConstant 3.450000 (Real 8 []))) ((RealConstant 5.600000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.450000 5.600000 (Complex 8 [])) ()))] (Real 8 []) (RealConstant 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 [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_9__bool 6 bool [((StringConstant "" (Character 1 0 () [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_8__bool 6 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 6 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_9__bool 6 bool [((StringConstant "t" (Character 1 1 () [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_5__bool 6 bool [((RealConstant 2.300000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .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 () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 8 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 56 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 42 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 12648430 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-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) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 8 a) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .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 () [((IntegerConstant 9 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 9 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant -3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 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.)}) test_float [] [(= (Var 10 a) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 10 a) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToReal (Real 8 []) (RealConstant 5.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant -1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 0.000000 (Real 8 []))) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.)}) test_int [] [(= (Var 9 a) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (RealConstant 4.560000 (Real 8 [])) RealToInteger (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (UnaryOp USub (RealConstant 5.000010 (Real 8 [])) (Real 8 []) (RealConstant -5.000010 (Real 8 []))) RealToInteger (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (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.)}) test_len [] [(= (Var 5 a) (StringLen (StringConstant "" (Character 1 0 () [])) (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) ()) (= (Var 5 a) (StringLen (StringConstant "test" (Character 1 4 () [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) ()) (= (Var 5 a) (StringLen (StringConstant "this is a test" (Character 1 14 () [])) (Integer 4 []) (IntegerConstant 14 (Integer 4 []))) ()) (= (Var 5 a) (TupleLen (TupleConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 []) (Integer 4 [])])) (Integer 4 []) (IntegerConstant 3 (Integer 4 []))) ()) (= (Var 5 a) (TupleLen (TupleConstant [(TupleConstant [(StringConstant "c" (Character 1 1 () [])) (StringConstant "b" (Character 1 1 () [])) (RealConstant 3.400000 (Real 8 []))] (Tuple [(Character 1 1 () []) (Character 1 1 () []) (Real 8 [])])) (TupleConstant [(StringConstant "c" (Character 1 1 () [])) (IntegerConstant 3 (Integer 4 [])) (RealConstant 5.600000 (Real 8 []))] (Tuple [(Character 1 1 () []) (Integer 4 []) (Real 8 [])]))] (Tuple [(Tuple [(Character 1 1 () []) (Character 1 1 () []) (Real 8 [])]) (Tuple [(Character 1 1 () []) (Integer 4 []) (Real 8 [])])])) (Integer 4 []) (IntegerConstant 2 (Integer 4 []))) ()) (= (Var 5 a) (ListLen (ListConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] (List (Integer 4 []))) (Integer 4 []) (IntegerConstant 3 (Integer 4 []))) ()) (= (Var 5 a) (ListLen (ListConstant [(ListConstant [(UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) (UnaryOp USub (IntegerConstant 6 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 [])))] (List (Integer 4 []))) (ListConstant [(UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (UnaryOp USub (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 []))) (UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 [])))] (List (Integer 4 [])))] (List (List (Integer 4 [])))) (Integer 4 []) (IntegerConstant 2 (Integer 4 []))) ()) (= (Var 5 a) (SetLen (SetConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] (Set (Integer 4 []))) (Integer 4 []) (IntegerConstant 3 (Integer 4 []))) ()) (= (Var 5 a) (DictLen (DictConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] [(StringConstant "c" (Character 1 1 () [])) (StringConstant "b" (Character 1 1 () [])) (StringConstant "c" (Character 1 1 () []))] (Dict (Integer 4 []) (Character 1 1 () []))) (Integer 4 []) (IntegerConstant 3 (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 () [((StringConstant "5" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (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 () []) (StringConstant "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((RealConstant 5.600000 (Real 8 [])))] (Character 1 -2 () []) (StringConstant "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .true. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .false. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((StringConstant "5346" (Character 1 4 () [])))] (Character 1 -2 () []) (StringConstant "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 5f15a3c55a..b958fc0032 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": "2030130b0705a7db2dccaa839d6429cb7683f9db7eeb62b467c86064", + "stdout_hash": "3e6010e171ba9438dae81691408224f63db3c4394d5026c89e2341ee", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr1-8df2d66.stdout b/tests/reference/asr-expr1-8df2d66.stdout index f15ce4dae5..600728e816 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 95 {}) 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) (IntegerConstant 0 (Integer 4 [])) (Integer 4 [])) ()) (If (NamedExpr (Var 2 a) (FunctionCall 2 ord () [((StringConstant "3" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 51 (Integer 4 [])) ()) (Integer 4 [])) [(= (Var 2 x) (IntegerConstant 1 (Integer 4 [])) ())] []) (WhileLoop (NamedExpr (Var 2 a) (IntegerConstant 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 y) (IntegerConstant 1 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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) (IntegerConstant 0 (Integer 4 [])) (Integer 4 [])) ()) (If (NamedExpr (Var 2 a) (FunctionCall 2 ord () [((StringConstant "3" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 51 (Integer 4 [])) ()) (Integer 4 [])) [(= (Var 2 x) (IntegerConstant 1 (Integer 4 [])) ())] []) (WhileLoop (NamedExpr (Var 2 a) (IntegerConstant 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 y) (IntegerConstant 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 1865cd8e62..8bd7d8b1dc 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": "391b7ad45fb1014d6ac6d32da3a24cc3c08a3615d8f63852921b5a28", + "stdout_hash": "986d149e69267800de0fa6ad20bbcedbf5230f227af6b6aad2056a9d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr10-efcbb1b.stdout b/tests/reference/asr-expr10-efcbb1b.stdout index a2f9ed5f53..fa09c8e489 100644 --- a/tests/reference/asr-expr10-efcbb1b.stdout +++ b/tests/reference/asr-expr10-efcbb1b.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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 (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 []))) ()) (= (Var 2 b) (UnaryOp Not (IntegerConstant 5 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f) (Cast (UnaryOp UAdd (RealConstant 1.000000 (Real 8 [])) (Real 8 []) (RealConstant 1.000000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 f) (Cast (UnaryOp USub (RealConstant 183745.534000 (Real 8 [])) (Real 8 []) (RealConstant -183745.534000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 b1) (LogicalConstant .true. (Logical 1 [])) ()) (= (Var 2 b2) (UnaryOp Not (LogicalConstant .false. (Logical 1 [])) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 b3) (UnaryOp Not (Var 2 b2) (Logical 1 []) ()) ()) (= (Var 2 a) (UnaryOp UAdd (LogicalConstant .true. (Logical 1 [])) (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (LogicalConstant .false. (Logical 1 [])) (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (LogicalConstant .true. (Logical 1 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 []))) ()) (= (Var 2 c) (Cast (UnaryOp UAdd (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (UnaryOp USub (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((RealConstant 65.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 65.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -3.000000 -65.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 b1) (UnaryOp Not (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b2) (UnaryOp Not (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .true. (Logical 4 []))) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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 (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 []))) ()) (= (Var 2 b) (UnaryOp Not (IntegerConstant 5 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b) (UnaryOp Not (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f) (Cast (UnaryOp UAdd (RealConstant 1.000000 (Real 8 [])) (Real 8 []) (RealConstant 1.000000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 f) (Cast (UnaryOp USub (RealConstant 183745.534000 (Real 8 [])) (Real 8 []) (RealConstant -183745.534000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (= (Var 2 b1) (LogicalConstant .true. (Logical 1 [])) ()) (= (Var 2 b2) (UnaryOp Not (LogicalConstant .false. (Logical 1 [])) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 b3) (UnaryOp Not (Var 2 b2) (Logical 1 []) ()) ()) (= (Var 2 a) (UnaryOp UAdd (LogicalConstant .true. (Logical 1 [])) (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp USub (LogicalConstant .false. (Logical 1 [])) (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) ()) (= (Var 2 a) (UnaryOp Invert (LogicalConstant .true. (Logical 1 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 []))) ()) (= (Var 2 c) (Cast (UnaryOp UAdd (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (UnaryOp USub (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((RealConstant 65.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 65.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -3.000000 -65.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 b1) (UnaryOp Not (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .false. (Logical 4 []))) ()) (= (Var 2 b2) (UnaryOp Not (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .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 7c0b7ad546..08ace0c39b 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": "51d5b700d3840ba03aecc56e1efc8e18808f97b64e686c4276562d57", + "stdout_hash": "89a330afa217988aa2f7ec5b2a7fad74fd2c3869dd7afa0e3f8fe333", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr13-81bdb5a.stdout b/tests/reference/asr-expr13-81bdb5a.stdout index 309e35836e..06f0777edf 100644 --- a/tests/reference/asr-expr13-81bdb5a.stdout +++ b/tests/reference/asr-expr13-81bdb5a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 4 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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 (IntegerConstant 5 (Integer 4 [])) Gt (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (IntegerConstant 5 (Integer 4 [])) LtE (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (IntegerConstant 5 (Integer 4 [])) Lt (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 5.600000 (Real 8 [])) GtE (RealConstant 5.599990 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 3.300000 (Real 8 [])) Eq (RealConstant 3.300000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 3.300000 (Real 8 [])) NotEq (RealConstant 3.400000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) Eq (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) Gt (StringConstant "abd" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "" (Character 1 0 () [])) Lt (StringConstant "s" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "-abs" (Character 1 4 () [])) GtE (StringConstant "abs" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abcd" (Character 1 4 () [])) LtE (StringConstant "abcde" (Character 1 5 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) Eq (StringConstant "abc" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) NotEq (StringConstant "abd" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "" (Character 1 0 () [])) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .true. (Logical 1 [])) Gt (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .true. (Logical 1 [])) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .false. (Logical 1 [])) NotEq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .false. (Logical 1 [])) GtE (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 4 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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 (IntegerConstant 5 (Integer 4 [])) Gt (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (IntegerConstant 5 (Integer 4 [])) LtE (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (IntegerConstant 5 (Integer 4 [])) Lt (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 5.600000 (Real 8 [])) GtE (RealConstant 5.599990 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 3.300000 (Real 8 [])) Eq (RealConstant 3.300000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (RealConstant 3.300000 (Real 8 [])) NotEq (RealConstant 3.400000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) Eq (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) Gt (StringConstant "abd" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "" (Character 1 0 () [])) Lt (StringConstant "s" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "-abs" (Character 1 4 () [])) GtE (StringConstant "abs" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abcd" (Character 1 4 () [])) LtE (StringConstant "abcde" (Character 1 5 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) Eq (StringConstant "abc" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "abc" (Character 1 3 () [])) NotEq (StringConstant "abd" (Character 1 3 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (StringConstant "" (Character 1 0 () [])) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .false. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .true. (Logical 1 [])) Gt (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .true. (Logical 1 [])) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .false. (Logical 1 [])) NotEq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 a) (Compare (LogicalConstant .false. (Logical 1 [])) GtE (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) (LogicalConstant .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 a703b53e0d..53698b4fc1 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": "73cce70b561dd5ac974f890286ff6ccd6ff9c97753e2bb7193919e14", + "stdout_hash": "46baddcc31f19815c2225c526120c9ccae116a233cffa6b21f0ad4d4", "stderr": "asr-expr7-480ba2f.stderr", "stderr_hash": "28509dd59a386eebd632340a550d14299cd2a921ef6dc3ac7dbe7fe9", "returncode": 0 diff --git a/tests/reference/asr-expr7-480ba2f.stdout b/tests/reference/asr-expr7-480ba2f.stdout index 22360827c7..c018c168b1 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 98 {}) _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 () [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 97 {}) 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 [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 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 99 {}) _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 () [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 98 {}) 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 [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 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-expr8-6beda60.json b/tests/reference/asr-expr8-6beda60.json index 2db525391f..2a986a2737 100644 --- a/tests/reference/asr-expr8-6beda60.json +++ b/tests/reference/asr-expr8-6beda60.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr8-6beda60.stdout", - "stdout_hash": "dec4f5b9b64bd149a69b9609642a379194e41751f3841cbe0f2d830e", + "stdout_hash": "603d1df54942732f122b3e5408a3151904cba04f65a9cf229fa5b4b1", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr8-6beda60.stdout b/tests/reference/asr-expr8-6beda60.stdout index 4c3334946a..2c487c7be4 100644 --- a/tests/reference/asr-expr8-6beda60.stdout +++ b/tests/reference/asr-expr8-6beda60.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_floordiv@__lpython_overloaded_2___lpython_floordiv: (ExternalSymbol 1 _lpython_floordiv@__lpython_overloaded_2___lpython_floordiv 4 __lpython_overloaded_2___lpython_floordiv lpython_builtin [] __lpython_overloaded_2___lpython_floordiv Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) main_program [] []), test_binop: (Subroutine (SymbolTable 2 {_lpython_floordiv: (ExternalSymbol 2 _lpython_floordiv 4 _lpython_floordiv lpython_builtin [] _lpython_floordiv Private), b1: (Variable 2 b1 Local () () Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () () Default (Logical 1 []) Source Public Required .false.), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), x2: (Variable 2 x2 Local () () Default (Real 4 []) Source Public Required .false.)}) test_binop [] [(= (Var 2 x) (BinOp (IntegerConstant 2 (Integer 4 [])) Pow (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant 8 (Integer 4 [])) ()) ()) (= (Var 2 x2) (Cast (BinOp (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Pow (RealConstant 3.500000 (Real 8 [])) (Real 8 []) () ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x) (BinOp (IntegerConstant 54 (Integer 4 [])) Sub (IntegerConstant 100 (Integer 4 [])) (Integer 4 []) (IntegerConstant -46 (Integer 4 [])) ()) ()) (= (Var 2 x2) (Cast (BinOp (BinOp (RealConstant 3.454000 (Real 8 [])) Sub (RealConstant 765.430000 (Real 8 [])) (Real 8 []) (RealConstant -761.976000 (Real 8 [])) ()) Add (RealConstant 534.600000 (Real 8 [])) (Real 8 []) (RealConstant -227.376000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x2) (Cast (BinOp (RealConstant 5346.565000 (Real 8 [])) Mul (RealConstant 3.450000 (Real 8 [])) (Real 8 []) (RealConstant 18445.649250 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x2) (Cast (BinOp (RealConstant 5346.565000 (Real 8 [])) Pow (RealConstant 3.450000 (Real 8 [])) (Real 8 []) (RealConstant 7275422789925.217773 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Add (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Sub (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Mul (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Pow (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 b1) (LogicalConstant .true. (Logical 1 [])) ()) (= (Var 2 b2) (LogicalConstant .false. (Logical 1 [])) ()) (= (Var 2 x) (FunctionCall 1 _lpython_floordiv@__lpython_overloaded_2___lpython_floordiv 2 _lpython_floordiv [((Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ())) ((Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ()))] (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ()) Pow (Cast (Var 2 b2) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_floordiv@__lpython_overloaded_2___lpython_floordiv: (ExternalSymbol 1 _lpython_floordiv@__lpython_overloaded_2___lpython_floordiv 4 __lpython_overloaded_2___lpython_floordiv lpython_builtin [] __lpython_overloaded_2___lpython_floordiv Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) main_program [] []), test_binop: (Subroutine (SymbolTable 2 {_lpython_floordiv: (ExternalSymbol 2 _lpython_floordiv 4 _lpython_floordiv lpython_builtin [] _lpython_floordiv Private), b1: (Variable 2 b1 Local () () Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () () Default (Logical 1 []) Source Public Required .false.), x: (Variable 2 x Local () () Default (Integer 4 []) Source Public Required .false.), x2: (Variable 2 x2 Local () () Default (Real 4 []) Source Public Required .false.)}) test_binop [] [(= (Var 2 x) (BinOp (IntegerConstant 2 (Integer 4 [])) Pow (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant 8 (Integer 4 [])) ()) ()) (= (Var 2 x2) (Cast (BinOp (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Pow (RealConstant 3.500000 (Real 8 [])) (Real 8 []) () ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x) (BinOp (IntegerConstant 54 (Integer 4 [])) Sub (IntegerConstant 100 (Integer 4 [])) (Integer 4 []) (IntegerConstant -46 (Integer 4 [])) ()) ()) (= (Var 2 x2) (Cast (BinOp (BinOp (RealConstant 3.454000 (Real 8 [])) Sub (RealConstant 765.430000 (Real 8 [])) (Real 8 []) (RealConstant -761.976000 (Real 8 [])) ()) Add (RealConstant 534.600000 (Real 8 [])) (Real 8 []) (RealConstant -227.376000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x2) (Cast (BinOp (RealConstant 5346.565000 (Real 8 [])) Mul (RealConstant 3.450000 (Real 8 [])) (Real 8 []) (RealConstant 18445.649250 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x2) (Cast (BinOp (RealConstant 5346.565000 (Real 8 [])) Pow (RealConstant 3.450000 (Real 8 [])) (Real 8 []) (RealConstant 7275422789925.217773 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Add (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Sub (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Mul (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) Pow (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ()) (= (Var 2 b1) (LogicalConstant .true. (Logical 1 [])) ()) (= (Var 2 b2) (LogicalConstant .false. (Logical 1 [])) ()) (= (Var 2 x) (FunctionCall 1 _lpython_floordiv@__lpython_overloaded_2___lpython_floordiv 2 _lpython_floordiv [((Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ())) ((Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ()))] (Integer 4 []) () ()) ()) (= (Var 2 x) (BinOp (Cast (Var 2 b1) LogicalToInteger (Integer 4 []) ()) Pow (Cast (Var 2 b2) LogicalToInteger (Integer 4 []) ()) (Integer 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_builtin-aa64615.json b/tests/reference/asr-test_builtin-aa64615.json index cf724e56d3..1711e234a4 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": "c76cc62f119c96355c5335c05ef16d052f1117644cbae78e21f548bb", + "stdout_hash": "af9a5624280851a160124d6fd9d07ab531f2bb36f4ff7a4e2b02595b", "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 c0af2d65a8..9843554381 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 97 {}) _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 96 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_chr: (Subroutine (SymbolTable 3 {capital_a: (Variable 3 capital_a Local () () Default (Character 1 -2 () []) Source Public Required .false.), capital_z: (Variable 3 capital_z Local () () Default (Character 1 -2 () []) Source Public Required .false.), chr: (ExternalSymbol 3 chr 5 chr lpython_builtin [] chr Private), dollar: (Variable 3 dollar Local () () Default (Character 1 -2 () []) Source Public Required .false.), exclamation: (Variable 3 exclamation Local () () Default (Character 1 -2 () []) Source Public Required .false.), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), left_parenthesis: (Variable 3 left_parenthesis Local () () Default (Character 1 -2 () []) Source Public Required .false.), nine: (Variable 3 nine Local () () Default (Character 1 -2 () []) Source Public Required .false.), plus: (Variable 3 plus Local () () Default (Character 1 -2 () []) Source Public Required .false.), right_brace: (Variable 3 right_brace Local () () Default (Character 1 -2 () []) Source Public Required .false.), right_bracket: (Variable 3 right_bracket Local () () Default (Character 1 -2 () []) Source Public Required .false.), semicolon: (Variable 3 semicolon Local () () Default (Character 1 -2 () []) Source Public Required .false.), small_a: (Variable 3 small_a Local () () Default (Character 1 -2 () []) Source Public Required .false.), small_z: (Variable 3 small_z Local () () Default (Character 1 -2 () []) Source Public Required .false.), zero: (Variable 3 zero Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_chr [] [(= (Var 3 i) (IntegerConstant 33 (Integer 4 [])) ()) (= (Var 3 exclamation) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 33 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "!" (Character 1 1 () [])) ()) Eq (StringConstant "!" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 exclamation) Eq (StringConstant "!" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 36 (Integer 4 [])) ()) (= (Var 3 dollar) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 36 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "$" (Character 1 1 () [])) ()) Eq (StringConstant "$" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 dollar) Eq (StringConstant "$" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 40 (Integer 4 [])) ()) (= (Var 3 left_parenthesis) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 40 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "(" (Character 1 1 () [])) ()) Eq (StringConstant "(" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 left_parenthesis) Eq (StringConstant "(" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 43 (Integer 4 [])) ()) (= (Var 3 plus) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (Character 1 1 () [])) ()) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 plus) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 48 (Integer 4 [])) ()) (= (Var 3 zero) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 48 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0" (Character 1 1 () [])) ()) Eq (StringConstant "0" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 zero) Eq (StringConstant "0" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 57 (Integer 4 [])) ()) (= (Var 3 nine) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 57 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "9" (Character 1 1 () [])) ()) Eq (StringConstant "9" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 nine) Eq (StringConstant "9" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 59 (Integer 4 [])) ()) (= (Var 3 semicolon) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 59 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant ";" (Character 1 1 () [])) ()) Eq (StringConstant ";" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 semicolon) Eq (StringConstant ";" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 65 (Integer 4 [])) ()) (= (Var 3 capital_a) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 65 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "A" (Character 1 1 () [])) ()) Eq (StringConstant "A" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 capital_a) Eq (StringConstant "A" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 90 (Integer 4 [])) ()) (= (Var 3 capital_z) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 90 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "Z" (Character 1 1 () [])) ()) Eq (StringConstant "Z" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 capital_z) Eq (StringConstant "Z" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 93 (Integer 4 [])) ()) (= (Var 3 right_bracket) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 93 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "]" (Character 1 1 () [])) ()) Eq (StringConstant "]" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 right_bracket) Eq (StringConstant "]" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 97 (Integer 4 [])) ()) (= (Var 3 small_a) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 97 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "a" (Character 1 1 () [])) ()) Eq (StringConstant "a" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 small_a) Eq (StringConstant "a" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 122 (Integer 4 [])) ()) (= (Var 3 small_z) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 122 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "z" (Character 1 1 () [])) ()) Eq (StringConstant "z" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 small_z) Eq (StringConstant "z" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 125 (Integer 4 [])) ()) (= (Var 3 right_brace) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 125 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "}" (Character 1 1 () [])) ()) Eq (StringConstant "}" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 right_brace) Eq (StringConstant "}" (Character 1 1 () [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_ord: (Subroutine (SymbolTable 2 {capital_a_unicode: (Variable 2 capital_a_unicode Local () () Default (Integer 4 []) Source Public Required .false.), capital_z_unicode: (Variable 2 capital_z_unicode Local () () Default (Integer 4 []) Source Public Required .false.), dollar_unicode: (Variable 2 dollar_unicode Local () () Default (Integer 4 []) Source Public Required .false.), exclamation_unicode: (Variable 2 exclamation_unicode Local () () Default (Integer 4 []) Source Public Required .false.), left_parenthesis_unicode: (Variable 2 left_parenthesis_unicode Local () () Default (Integer 4 []) Source Public Required .false.), nine_unicode: (Variable 2 nine_unicode Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 5 ord lpython_builtin [] ord Private), plus_unicode: (Variable 2 plus_unicode Local () () Default (Integer 4 []) Source Public Required .false.), right_brace_unicode: (Variable 2 right_brace_unicode Local () () Default (Integer 4 []) Source Public Required .false.), right_bracket_unicode: (Variable 2 right_bracket_unicode Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), semicolon_unicode: (Variable 2 semicolon_unicode Local () () Default (Integer 4 []) Source Public Required .false.), small_a_unicode: (Variable 2 small_a_unicode Local () () Default (Integer 4 []) Source Public Required .false.), small_z_unicode: (Variable 2 small_z_unicode Local () () Default (Integer 4 []) Source Public Required .false.), zero_unicode: (Variable 2 zero_unicode Local () () Default (Integer 4 []) Source Public Required .false.)}) test_ord [] [(= (Var 2 s) (StringConstant "!" (Character 1 1 () [])) ()) (= (Var 2 exclamation_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "!" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 33 (Integer 4 [])) ()) Eq (IntegerConstant 33 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 exclamation_unicode) Eq (IntegerConstant 33 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "$" (Character 1 1 () [])) ()) (= (Var 2 dollar_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "$" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 36 (Integer 4 [])) ()) Eq (IntegerConstant 36 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 dollar_unicode) Eq (IntegerConstant 36 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "(" (Character 1 1 () [])) ()) (= (Var 2 left_parenthesis_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "(" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 40 (Integer 4 [])) ()) Eq (IntegerConstant 40 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 left_parenthesis_unicode) Eq (IntegerConstant 40 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "+" (Character 1 1 () [])) ()) (= (Var 2 plus_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "+" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 43 (Integer 4 [])) ()) Eq (IntegerConstant 43 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 plus_unicode) Eq (IntegerConstant 43 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "0" (Character 1 1 () [])) ()) (= (Var 2 zero_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "0" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 48 (Integer 4 [])) ()) Eq (IntegerConstant 48 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 zero_unicode) Eq (IntegerConstant 48 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "9" (Character 1 1 () [])) ()) (= (Var 2 nine_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "9" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 57 (Integer 4 [])) ()) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 nine_unicode) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant ";" (Character 1 1 () [])) ()) (= (Var 2 semicolon_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant ";" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 59 (Integer 4 [])) ()) Eq (IntegerConstant 59 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 semicolon_unicode) Eq (IntegerConstant 59 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "A" (Character 1 1 () [])) ()) (= (Var 2 capital_a_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "A" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 65 (Integer 4 [])) ()) Eq (IntegerConstant 65 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 capital_a_unicode) Eq (IntegerConstant 65 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "Z" (Character 1 1 () [])) ()) (= (Var 2 capital_z_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "Z" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 90 (Integer 4 [])) ()) Eq (IntegerConstant 90 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 capital_z_unicode) Eq (IntegerConstant 90 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "]" (Character 1 1 () [])) ()) (= (Var 2 right_bracket_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "]" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 93 (Integer 4 [])) ()) Eq (IntegerConstant 93 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 right_bracket_unicode) Eq (IntegerConstant 93 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "a" (Character 1 1 () [])) ()) (= (Var 2 small_a_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "a" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 97 (Integer 4 [])) ()) Eq (IntegerConstant 97 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 small_a_unicode) Eq (IntegerConstant 97 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "z" (Character 1 1 () [])) ()) (= (Var 2 small_z_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "z" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 122 (Integer 4 [])) ()) Eq (IntegerConstant 122 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 small_z_unicode) Eq (IntegerConstant 122 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "}" (Character 1 1 () [])) ()) (= (Var 2 right_brace_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "}" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 125 (Integer 4 [])) ()) Eq (IntegerConstant 125 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 right_brace_unicode) Eq (IntegerConstant 125 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 98 {}) _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 97 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_chr: (Subroutine (SymbolTable 3 {capital_a: (Variable 3 capital_a Local () () Default (Character 1 -2 () []) Source Public Required .false.), capital_z: (Variable 3 capital_z Local () () Default (Character 1 -2 () []) Source Public Required .false.), chr: (ExternalSymbol 3 chr 5 chr lpython_builtin [] chr Private), dollar: (Variable 3 dollar Local () () Default (Character 1 -2 () []) Source Public Required .false.), exclamation: (Variable 3 exclamation Local () () Default (Character 1 -2 () []) Source Public Required .false.), i: (Variable 3 i Local () () Default (Integer 4 []) Source Public Required .false.), left_parenthesis: (Variable 3 left_parenthesis Local () () Default (Character 1 -2 () []) Source Public Required .false.), nine: (Variable 3 nine Local () () Default (Character 1 -2 () []) Source Public Required .false.), plus: (Variable 3 plus Local () () Default (Character 1 -2 () []) Source Public Required .false.), right_brace: (Variable 3 right_brace Local () () Default (Character 1 -2 () []) Source Public Required .false.), right_bracket: (Variable 3 right_bracket Local () () Default (Character 1 -2 () []) Source Public Required .false.), semicolon: (Variable 3 semicolon Local () () Default (Character 1 -2 () []) Source Public Required .false.), small_a: (Variable 3 small_a Local () () Default (Character 1 -2 () []) Source Public Required .false.), small_z: (Variable 3 small_z Local () () Default (Character 1 -2 () []) Source Public Required .false.), zero: (Variable 3 zero Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_chr [] [(= (Var 3 i) (IntegerConstant 33 (Integer 4 [])) ()) (= (Var 3 exclamation) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 33 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "!" (Character 1 1 () [])) ()) Eq (StringConstant "!" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 exclamation) Eq (StringConstant "!" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 36 (Integer 4 [])) ()) (= (Var 3 dollar) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 36 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "$" (Character 1 1 () [])) ()) Eq (StringConstant "$" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 dollar) Eq (StringConstant "$" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 40 (Integer 4 [])) ()) (= (Var 3 left_parenthesis) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 40 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "(" (Character 1 1 () [])) ()) Eq (StringConstant "(" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 left_parenthesis) Eq (StringConstant "(" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 43 (Integer 4 [])) ()) (= (Var 3 plus) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (Character 1 1 () [])) ()) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 plus) Eq (StringConstant "+" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 48 (Integer 4 [])) ()) (= (Var 3 zero) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 48 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0" (Character 1 1 () [])) ()) Eq (StringConstant "0" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 zero) Eq (StringConstant "0" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 57 (Integer 4 [])) ()) (= (Var 3 nine) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 57 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "9" (Character 1 1 () [])) ()) Eq (StringConstant "9" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 nine) Eq (StringConstant "9" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 59 (Integer 4 [])) ()) (= (Var 3 semicolon) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 59 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant ";" (Character 1 1 () [])) ()) Eq (StringConstant ";" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 semicolon) Eq (StringConstant ";" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 65 (Integer 4 [])) ()) (= (Var 3 capital_a) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 65 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "A" (Character 1 1 () [])) ()) Eq (StringConstant "A" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 capital_a) Eq (StringConstant "A" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 90 (Integer 4 [])) ()) (= (Var 3 capital_z) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 90 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "Z" (Character 1 1 () [])) ()) Eq (StringConstant "Z" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 capital_z) Eq (StringConstant "Z" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 93 (Integer 4 [])) ()) (= (Var 3 right_bracket) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 93 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "]" (Character 1 1 () [])) ()) Eq (StringConstant "]" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 right_bracket) Eq (StringConstant "]" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 97 (Integer 4 [])) ()) (= (Var 3 small_a) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 97 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "a" (Character 1 1 () [])) ()) Eq (StringConstant "a" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 small_a) Eq (StringConstant "a" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 122 (Integer 4 [])) ()) (= (Var 3 small_z) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 122 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "z" (Character 1 1 () [])) ()) Eq (StringConstant "z" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 small_z) Eq (StringConstant "z" (Character 1 1 () [])) (Logical 4 []) () ()) ()) (= (Var 3 i) (IntegerConstant 125 (Integer 4 [])) ()) (= (Var 3 right_brace) (FunctionCall 3 chr () [((Var 3 i))] (Character 1 -2 () []) () ()) ()) (Assert (Compare (FunctionCall 3 chr () [((IntegerConstant 125 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "}" (Character 1 1 () [])) ()) Eq (StringConstant "}" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 3 right_brace) Eq (StringConstant "}" (Character 1 1 () [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.), test_ord: (Subroutine (SymbolTable 2 {capital_a_unicode: (Variable 2 capital_a_unicode Local () () Default (Integer 4 []) Source Public Required .false.), capital_z_unicode: (Variable 2 capital_z_unicode Local () () Default (Integer 4 []) Source Public Required .false.), dollar_unicode: (Variable 2 dollar_unicode Local () () Default (Integer 4 []) Source Public Required .false.), exclamation_unicode: (Variable 2 exclamation_unicode Local () () Default (Integer 4 []) Source Public Required .false.), left_parenthesis_unicode: (Variable 2 left_parenthesis_unicode Local () () Default (Integer 4 []) Source Public Required .false.), nine_unicode: (Variable 2 nine_unicode Local () () Default (Integer 4 []) Source Public Required .false.), ord: (ExternalSymbol 2 ord 5 ord lpython_builtin [] ord Private), plus_unicode: (Variable 2 plus_unicode Local () () Default (Integer 4 []) Source Public Required .false.), right_brace_unicode: (Variable 2 right_brace_unicode Local () () Default (Integer 4 []) Source Public Required .false.), right_bracket_unicode: (Variable 2 right_bracket_unicode Local () () Default (Integer 4 []) Source Public Required .false.), s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.), semicolon_unicode: (Variable 2 semicolon_unicode Local () () Default (Integer 4 []) Source Public Required .false.), small_a_unicode: (Variable 2 small_a_unicode Local () () Default (Integer 4 []) Source Public Required .false.), small_z_unicode: (Variable 2 small_z_unicode Local () () Default (Integer 4 []) Source Public Required .false.), zero_unicode: (Variable 2 zero_unicode Local () () Default (Integer 4 []) Source Public Required .false.)}) test_ord [] [(= (Var 2 s) (StringConstant "!" (Character 1 1 () [])) ()) (= (Var 2 exclamation_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "!" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 33 (Integer 4 [])) ()) Eq (IntegerConstant 33 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 exclamation_unicode) Eq (IntegerConstant 33 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "$" (Character 1 1 () [])) ()) (= (Var 2 dollar_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "$" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 36 (Integer 4 [])) ()) Eq (IntegerConstant 36 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 dollar_unicode) Eq (IntegerConstant 36 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "(" (Character 1 1 () [])) ()) (= (Var 2 left_parenthesis_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "(" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 40 (Integer 4 [])) ()) Eq (IntegerConstant 40 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 left_parenthesis_unicode) Eq (IntegerConstant 40 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "+" (Character 1 1 () [])) ()) (= (Var 2 plus_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "+" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 43 (Integer 4 [])) ()) Eq (IntegerConstant 43 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 plus_unicode) Eq (IntegerConstant 43 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "0" (Character 1 1 () [])) ()) (= (Var 2 zero_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "0" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 48 (Integer 4 [])) ()) Eq (IntegerConstant 48 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 zero_unicode) Eq (IntegerConstant 48 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "9" (Character 1 1 () [])) ()) (= (Var 2 nine_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "9" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 57 (Integer 4 [])) ()) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 nine_unicode) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant ";" (Character 1 1 () [])) ()) (= (Var 2 semicolon_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant ";" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 59 (Integer 4 [])) ()) Eq (IntegerConstant 59 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 semicolon_unicode) Eq (IntegerConstant 59 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "A" (Character 1 1 () [])) ()) (= (Var 2 capital_a_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "A" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 65 (Integer 4 [])) ()) Eq (IntegerConstant 65 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 capital_a_unicode) Eq (IntegerConstant 65 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "Z" (Character 1 1 () [])) ()) (= (Var 2 capital_z_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "Z" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 90 (Integer 4 [])) ()) Eq (IntegerConstant 90 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 capital_z_unicode) Eq (IntegerConstant 90 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "]" (Character 1 1 () [])) ()) (= (Var 2 right_bracket_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "]" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 93 (Integer 4 [])) ()) Eq (IntegerConstant 93 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 right_bracket_unicode) Eq (IntegerConstant 93 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "a" (Character 1 1 () [])) ()) (= (Var 2 small_a_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "a" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 97 (Integer 4 [])) ()) Eq (IntegerConstant 97 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 small_a_unicode) Eq (IntegerConstant 97 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "z" (Character 1 1 () [])) ()) (= (Var 2 small_z_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "z" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 122 (Integer 4 [])) ()) Eq (IntegerConstant 122 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 small_z_unicode) Eq (IntegerConstant 122 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "}" (Character 1 1 () [])) ()) (= (Var 2 right_brace_unicode) (FunctionCall 2 ord () [((Var 2 s))] (Integer 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 ord () [((StringConstant "}" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 125 (Integer 4 [])) ()) Eq (IntegerConstant 125 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (Var 2 right_brace_unicode) Eq (IntegerConstant 125 (Integer 4 [])) (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 bb71e619f8..e8a2be208a 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": "9024d304ed31e94eca15c2c0cddf4f973c068d26f40d5de34f28533e", + "stdout_hash": "19a099ceed89fff21910afe0a0d1dff2b294a08cabd58111602c447e", "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 b3b473f557..5694eb47e9 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 96 {}) _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), abs@__lpython_overloaded_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 4 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_5__abs: (ExternalSymbol 1 abs@__lpython_overloaded_5__abs 4 __lpython_overloaded_5__abs lpython_builtin [] __lpython_overloaded_5__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 4 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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.), i2: (Variable 2 i2 Local () () Default (Integer 8 []) Source Public Required .false.), i3: (Variable 2 i3 Local () () Default (Integer 1 []) Source Public Required .false.), i4: (Variable 2 i4 Local () () Default (Integer 2 []) 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) (RealConstant 5.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 x) (UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((RealConstant 5.500000 (Real 8 [])))] (Real 8 []) (RealConstant 5.500000 (Real 8 [])) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))))] (Real 8 []) (RealConstant 5.500000 (Real 8 [])) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 x2) (Cast (UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_1__abs 2 abs [((Var 2 x2))] (Real 4 []) () ()) RealToReal (Real 8 []) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_4__abs 2 abs [((Var 2 i))] (Integer 4 []) () ()) Eq (IntegerConstant 5 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_4__abs 2 abs [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 i2) (Cast (UnaryOp USub (IntegerConstant 6 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_5__abs 2 abs [((Var 2 i2))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 6 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 i3) (Cast (UnaryOp USub (IntegerConstant 7 (Integer 4 [])) (Integer 4 []) (IntegerConstant -7 (Integer 4 []))) IntegerToInteger (Integer 1 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((Var 2 i3))] (Integer 1 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 7 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i4) (Cast (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 i4))] (Integer 2 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 8 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_6__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_6__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 97 {}) _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), abs@__lpython_overloaded_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 4 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_5__abs: (ExternalSymbol 1 abs@__lpython_overloaded_5__abs 4 __lpython_overloaded_5__abs lpython_builtin [] __lpython_overloaded_5__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 4 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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.), i2: (Variable 2 i2 Local () () Default (Integer 8 []) Source Public Required .false.), i3: (Variable 2 i3 Local () () Default (Integer 1 []) Source Public Required .false.), i4: (Variable 2 i4 Local () () Default (Integer 2 []) 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) (RealConstant 5.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 x) (UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((Var 2 x))] (Real 8 []) () ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((RealConstant 5.500000 (Real 8 [])))] (Real 8 []) (RealConstant 5.500000 (Real 8 [])) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))))] (Real 8 []) (RealConstant 5.500000 (Real 8 [])) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 x2) (Cast (UnaryOp USub (RealConstant 5.500000 (Real 8 [])) (Real 8 []) (RealConstant -5.500000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_1__abs 2 abs [((Var 2 x2))] (Real 4 []) () ()) RealToReal (Real 8 []) ()) Eq (RealConstant 5.500000 (Real 8 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_4__abs 2 abs [((Var 2 i))] (Integer 4 []) () ()) Eq (IntegerConstant 5 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_4__abs 2 abs [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 i2) (Cast (UnaryOp USub (IntegerConstant 6 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_5__abs 2 abs [((Var 2 i2))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 6 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 i3) (Cast (UnaryOp USub (IntegerConstant 7 (Integer 4 [])) (Integer 4 []) (IntegerConstant -7 (Integer 4 []))) IntegerToInteger (Integer 1 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_2__abs 2 abs [((Var 2 i3))] (Integer 1 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 7 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i4) (Cast (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 abs@__lpython_overloaded_3__abs 2 abs [((Var 2 i4))] (Integer 2 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 8 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_6__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_6__abs 2 abs [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 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 1809bef485..72c2419617 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": "7ee8c4f01242f46f2db0f4205384e066d2b966642b4855cdb580b0ad", + "stdout_hash": "c2820513efd3ff7d8fca3d896f4a5ce4ea8f0f927dca26158a4f043c", "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 bea54d497c..de73adab7d 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 96 {}) _lpython_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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) (IntegerConstant 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0b101" (Character 1 5 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (IntegerConstant 64 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0b1000000" (Character 1 9 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) Eq (StringConstant "0b1000000" (Character 1 9 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) Eq (StringConstant "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 97 {}) _lpython_main_program [] [(SubroutineCall 1 test_bin () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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) (IntegerConstant 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0b101" (Character 1 5 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (IntegerConstant 64 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0b1000000" (Character 1 9 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 bin () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) Eq (StringConstant "0b1000000" (Character 1 9 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) Eq (StringConstant "-0b1000010110" (Character 1 13 () [])) (Logical 4 []) (LogicalConstant .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 087f43650a..1e4ade4c21 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": "be0c64b55a51d907af8ee2ba6bec6513e22bc75e499e163d864b8b45", + "stdout_hash": "e9947966454060f9db97a892542dd50c75b82b6ae74e2eb521310882", "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 97bfe1ef9a..45e23e811e 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 96 {}) _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), bool@__lpython_overloaded_6__bool: (ExternalSymbol 1 bool@__lpython_overloaded_6__bool 4 __lpython_overloaded_6__bool lpython_builtin [] __lpython_overloaded_6__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 4 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 4 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), bool@__lpython_overloaded_9__bool: (ExternalSymbol 1 bool@__lpython_overloaded_9__bool 4 __lpython_overloaded_9__bool lpython_builtin [] __lpython_overloaded_9__bool Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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.), a3: (Variable 2 a3 Local () () Default (Integer 1 []) Source Public Required .false.), a4: (Variable 2 a4 Local () () Default (Integer 2 []) 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), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) ()) (= (Var 2 a) (IntegerConstant 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 (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 a2) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [((Var 2 a2))] (Logical 1 []) () ()) ()) (= (Var 2 a3) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [((Var 2 a3))] (Logical 1 []) () ()) ()) (= (Var 2 a4) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 a4))] (Logical 1 []) () ()) ()) (= (Var 2 f) (RealConstant 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (RealConstant 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 56.786866 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 0.000000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f2) (Cast (UnaryOp USub (RealConstant 235.600000 (Real 8 [])) (Real 8 []) (RealConstant -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 f2))] (Logical 1 []) () ()) ()) (= (Var 2 s) (StringConstant "" (Character 1 0 () [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 s) (StringConstant "str" (Character 1 3 () [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((StringConstant "" (Character 1 0 () [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((StringConstant "str" (Character 1 3 () [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((LogicalConstant .true. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((LogicalConstant .false. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 2.000000 3.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((BinOp (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 0.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((RealConstant 0.100202 (Real 8 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.100202 (Complex 8 [])) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((Var 2 c1))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((BinOp (Cast (IntegerConstant 3 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 97 {}) _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), bool@__lpython_overloaded_6__bool: (ExternalSymbol 1 bool@__lpython_overloaded_6__bool 4 __lpython_overloaded_6__bool lpython_builtin [] __lpython_overloaded_6__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 4 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 4 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), bool@__lpython_overloaded_9__bool: (ExternalSymbol 1 bool@__lpython_overloaded_9__bool 4 __lpython_overloaded_9__bool lpython_builtin [] __lpython_overloaded_9__bool Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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.), a3: (Variable 2 a3 Local () () Default (Integer 1 []) Source Public Required .false.), a4: (Variable 2 a4 Local () () Default (Integer 2 []) 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), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) ()) (= (Var 2 a) (IntegerConstant 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 (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 a2) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [((Var 2 a2))] (Logical 1 []) () ()) ()) (= (Var 2 a3) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [((Var 2 a3))] (Logical 1 []) () ()) ()) (= (Var 2 a4) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 a4))] (Logical 1 []) () ()) ()) (= (Var 2 f) (RealConstant 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (RealConstant 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 56.786866 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 0.000000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f2) (Cast (UnaryOp USub (RealConstant 235.600000 (Real 8 [])) (Real 8 []) (RealConstant -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 f2))] (Logical 1 []) () ()) ()) (= (Var 2 s) (StringConstant "" (Character 1 0 () [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 s) (StringConstant "str" (Character 1 3 () [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((StringConstant "" (Character 1 0 () [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((StringConstant "str" (Character 1 3 () [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((LogicalConstant .true. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((LogicalConstant .false. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 2.000000 3.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((BinOp (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 0.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((RealConstant 0.100202 (Real 8 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.100202 (Complex 8 [])) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((Var 2 c1))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((BinOp (Cast (IntegerConstant 3 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) ())] 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 6a1bf75f3a..171d12f1e9 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": "95c14a695b36831347a3a709fa011538a3d09ec2957ff99487f31ff5", + "stdout_hash": "36bc32628917196579424e872a4788210ae67fabe317149970bcc08f", "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 1bb324e13c..87b1e23aad 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 96 {}) _lpython_main_program [] [(SubroutineCall 1 test_hex () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0x22" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0x108b" (Character 1 7 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 hex () [((IntegerConstant 34 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x22" (Character 1 1 () [])) ()) Eq (StringConstant "0x22" (Character 1 4 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0x108b" (Character 1 1 () [])) ()) Eq (StringConstant "-0x108b" (Character 1 7 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 97 {}) _lpython_main_program [] [(SubroutineCall 1 test_hex () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0x22" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 hex () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0x108b" (Character 1 7 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 hex () [((IntegerConstant 34 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x22" (Character 1 1 () [])) ()) Eq (StringConstant "0x22" (Character 1 4 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0x108b" (Character 1 1 () [])) ()) Eq (StringConstant "-0x108b" (Character 1 7 () [])) (Logical 4 []) (LogicalConstant .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 d46b8e5db5..f9ad257442 100644 --- a/tests/reference/asr-test_builtin_len-55b0dec.json +++ b/tests/reference/asr-test_builtin_len-55b0dec.json @@ -5,9 +5,9 @@ "infile_hash": "f1540b68424e3c8f59af07f56535997ceda392b5e9c16f1d32c8913e", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_builtin_len-55b0dec.stderr", - "stderr_hash": "7a3316e0d950e6cd4ac0f1cb958d3f3c36d6dbba1e1392d711fd43fd", - "returncode": 1 + "stdout": "asr-test_builtin_len-55b0dec.stdout", + "stdout_hash": "5848f4307a138db4aeb3df85134c377170b7bbbffdb4be980853260d", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_len-55b0dec.stdout b/tests/reference/asr-test_builtin_len-55b0dec.stdout index 273e0c93c0..64eacdf421 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 97 {}) _lpython_main_program [] [(SubroutineCall 1 test_len () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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) (StringConstant "abcd" (Character 1 4 () [])) ()) (Assert (Compare (FunctionCall 2 len () [((Var 2 s))] (Integer 4 []) () ()) Eq (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "" (Character 1 0 () [])) ()) (Assert (Compare (FunctionCall 2 len () [((Var 2 s))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 len () [((StringConstant "abcd" (Character 1 4 () [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ()) Eq (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 len () [((StringConstant "" (Character 1 0 () [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 4 {}) _lpython_main_program [] [(SubroutineCall 1 test_len () [] ())] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 3 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_len: (Subroutine (SymbolTable 2 {s: (Variable 2 s Local () () Default (Character 1 -2 () []) Source Public Required .false.)}) test_len [] [(= (Var 2 s) (StringConstant "abcd" (Character 1 4 () [])) ()) (Assert (Compare (StringLen (Var 2 s) (Integer 4 []) ()) Eq (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (StringConstant "" (Character 1 0 () [])) ()) (Assert (Compare (StringLen (Var 2 s) (Integer 4 []) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (StringLen (StringConstant "abcd" (Character 1 4 () [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) Eq (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (StringLen (StringConstant "" (Character 1 0 () [])) (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .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 d62a954860..53aeaf1bbd 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": "fe703a4c6bf89d43366ec035e9fef4dfaea0c099381e1f2577409bfc", + "stdout_hash": "e14d5015d4bb2be92a374be00ca92fcddd520b05f14f706d5cf8c17a", "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 824313bebd..6fae380958 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 96 {}) _lpython_main_program [] [(SubroutineCall 1 test_oct () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0o42" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0o10213" (Character 1 8 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 oct () [((IntegerConstant 34 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o42" (Character 1 1 () [])) ()) Eq (StringConstant "0o42" (Character 1 4 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o10213" (Character 1 1 () [])) ()) Eq (StringConstant "-0o10213" (Character 1 8 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 97 {}) _lpython_main_program [] [(SubroutineCall 1 test_oct () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "0o42" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 2 oct () [((Var 2 i))] (Character 1 -2 () []) () ()) Eq (StringConstant "-0o10213" (Character 1 8 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 oct () [((IntegerConstant 34 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o42" (Character 1 1 () [])) ()) Eq (StringConstant "0o42" (Character 1 4 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 4235 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4235 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o10213" (Character 1 1 () [])) ()) Eq (StringConstant "-0o10213" (Character 1 8 () [])) (Logical 4 []) (LogicalConstant .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 4b7b23f6d4..fd7bf7978e 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": "a38bb3dc6e14fbcc129d5a1586e85451a774d2210a933f3517a258c9", + "stdout_hash": "8de147b60237a40e4dd55c7a97b1f1a0f8a0b89d13907c5a5854a9b2", "stderr": "asr-test_builtin_pow-f02fcda.stderr", "stderr_hash": "180e1adfbb0d9c63a2fffa31951bbd629b3f1950cf0d97ca1389efe5", "returncode": 0 diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.stdout b/tests/reference/asr-test_builtin_pow-f02fcda.stdout index 9451a3e51d..71662545e7 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 96 {}) _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), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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), pow@__lpython_overloaded_4__pow: (ExternalSymbol 1 pow@__lpython_overloaded_4__pow 4 __lpython_overloaded_4__pow lpython_builtin [] __lpython_overloaded_4__pow Public), pow@__lpython_overloaded_5__pow: (ExternalSymbol 1 pow@__lpython_overloaded_5__pow 4 __lpython_overloaded_5__pow lpython_builtin [] __lpython_overloaded_5__pow Public), pow@__lpython_overloaded_6__pow: (ExternalSymbol 1 pow@__lpython_overloaded_6__pow 4 __lpython_overloaded_6__pow lpython_builtin [] __lpython_overloaded_6__pow Public), pow@__lpython_overloaded_7__pow: (ExternalSymbol 1 pow@__lpython_overloaded_7__pow 4 __lpython_overloaded_7__pow lpython_builtin [] __lpython_overloaded_7__pow Public), pow@__lpython_overloaded_8__pow: (ExternalSymbol 1 pow@__lpython_overloaded_8__pow 4 __lpython_overloaded_8__pow lpython_builtin [] __lpython_overloaded_8__pow Public), pow@__lpython_overloaded_9__pow: (ExternalSymbol 1 pow@__lpython_overloaded_9__pow 4 __lpython_overloaded_9__pow lpython_builtin [] __lpython_overloaded_9__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a1: (Variable 2 a1 Local () (RealConstant 4.500000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), a2: (Variable 2 a2 Local () (RealConstant 2.300000 (Real 8 [])) 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.), b1: (Variable 2 b1 Local () (LogicalConstant .true. (Logical 1 [])) Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () (LogicalConstant .false. (Logical 1 [])) Default (Logical 1 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private), eps: (Variable 2 eps Local () () Default (Real 8 []) Source Public Required .false.), f1: (Variable 2 f1 Local () () Default (Real 4 []) Source Public Required .false.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), i1: (Variable 2 i1 Local () () Default (Integer 8 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 8 []) Source Public Required .false.), p: (Variable 2 p Local () () Default (Real 4 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private), x: (Variable 2 x Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () (RealConstant 2.300000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.)}) test_pow [] [(= (Var 2 eps) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 32 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 6 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 3 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 216 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) ()) (= (Var 2 a) (IntegerConstant 6 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))) ()) (= (Var 2 i1) (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 i2) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 i1)) ((Var 2 i2))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 32 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 i1) (Cast (IntegerConstant 6 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 i2) (Cast (UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 f1) (Cast (BinOp (Cast (IntegerConstant 525346 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Div (Cast (IntegerConstant 66456 (Integer 4 [])) IntegerToReal (Real 8 []) ()) (Real 8 []) () ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 f2) (Cast (RealConstant 3.000000 (Real 8 [])) RealToReal (Real 4 []) ()) ()) (= (Var 2 p) (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 f1)) ((Var 2 f2))] (Real 4 []) () ()) ()) (= (Var 2 f1) (FunctionCall 1 pow@__lpython_overloaded_4__pow 2 pow [((Var 2 a)) ((Var 2 f2))] (Real 4 []) () ()) ()) (= (Var 2 f1) (FunctionCall 1 pow@__lpython_overloaded_5__pow 2 pow [((Var 2 f2)) ((Var 2 a))] (Real 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b1)) ((Var 2 b2))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b2)) ((Var 2 b1))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b1)) ((Var 2 b2))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((LogicalConstant .false. (Logical 1 []))) ((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (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 a1)) ((Var 2 a2))] (Real 8 []) (RealConstant 31.797193 (Real 8 [])) ()) Sub (RealConstant 31.797193 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((Var 2 a2)) ((Var 2 a1))] (Real 8 []) (RealConstant 42.439989 (Real 8 [])) ()) Sub (RealConstant 42.439989 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((Var 2 x)) ((Var 2 y))] (Real 8 []) (RealConstant 12.513503 (Real 8 [])) ()) Sub (RealConstant 12.513503 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((Var 2 y)) ((Var 2 x))] (Real 8 []) (RealConstant 12.167000 (Real 8 [])) ()) Sub (RealConstant 12.167000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((Var 2 x)) ((RealConstant 5.500000 (Real 8 [])))] (Real 8 []) (RealConstant 420.888346 (Real 8 [])) ()) Sub (RealConstant 420.888346 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.500000 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 6 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 [])))) ((UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))))] (Integer 4 []) (RealConstant -0.004115 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Add (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 6 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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_3__pow 2 pow [((RealConstant 4.500000 (Real 8 []))) ((RealConstant 2.300000 (Real 8 [])))] (Real 8 []) (RealConstant 31.797193 (Real 8 [])) ()) Sub (RealConstant 31.797193 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((RealConstant 2.300000 (Real 8 []))) ((RealConstant 0.000000 (Real 8 [])))] (Real 8 []) (RealConstant 1.000000 (Real 8 [])) ()) Sub (RealConstant 1.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((RealConstant 2.300000 (Real 8 []))) ((UnaryOp USub (RealConstant 1.500000 (Real 8 [])) (Real 8 []) (RealConstant -1.500000 (Real 8 []))))] (Real 8 []) (RealConstant 0.286687 (Real 8 [])) ()) Sub (RealConstant 0.286687 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 3.400000 (Real 8 [])))] (Real 8 []) (RealConstant 10.556063 (Real 8 [])) ()) Sub (RealConstant 10.556063 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((UnaryOp USub (RealConstant 3.400000 (Real 8 [])) (Real 8 []) (RealConstant -3.400000 (Real 8 []))))] (Real 8 []) (RealConstant 0.094732 (Real 8 [])) ()) Sub (RealConstant 0.094732 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((RealConstant 3.400000 (Real 8 []))) ((IntegerConstant 9 (Integer 4 [])))] (Real 8 []) (RealConstant 60716.992766 (Real 8 [])) ()) Sub (RealConstant 60716.992766 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((RealConstant 0.000000 (Real 8 []))) ((IntegerConstant 53 (Integer 4 [])))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Sub (RealConstant 0.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 16 (Integer 4 [])) ()) Eq (IntegerConstant 16 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_7__pow 2 pow [((UnaryOp USub (RealConstant 4235.000000 (Real 8 [])) (Real 8 []) (RealConstant -4235.000000 (Real 8 [])))) ((IntegerConstant 52 (Integer 4 [])))] (Real 8 []) (RealConstant 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) ()) Sub (RealConstant 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 pow@__lpython_overloaded_9__pow 2 pow [((Var 2 c1)) ((IntegerConstant 4 (Integer 4 [])))] (Complex 4 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 97 {}) _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), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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), pow@__lpython_overloaded_4__pow: (ExternalSymbol 1 pow@__lpython_overloaded_4__pow 4 __lpython_overloaded_4__pow lpython_builtin [] __lpython_overloaded_4__pow Public), pow@__lpython_overloaded_5__pow: (ExternalSymbol 1 pow@__lpython_overloaded_5__pow 4 __lpython_overloaded_5__pow lpython_builtin [] __lpython_overloaded_5__pow Public), pow@__lpython_overloaded_6__pow: (ExternalSymbol 1 pow@__lpython_overloaded_6__pow 4 __lpython_overloaded_6__pow lpython_builtin [] __lpython_overloaded_6__pow Public), pow@__lpython_overloaded_7__pow: (ExternalSymbol 1 pow@__lpython_overloaded_7__pow 4 __lpython_overloaded_7__pow lpython_builtin [] __lpython_overloaded_7__pow Public), pow@__lpython_overloaded_8__pow: (ExternalSymbol 1 pow@__lpython_overloaded_8__pow 4 __lpython_overloaded_8__pow lpython_builtin [] __lpython_overloaded_8__pow Public), pow@__lpython_overloaded_9__pow: (ExternalSymbol 1 pow@__lpython_overloaded_9__pow 4 __lpython_overloaded_9__pow lpython_builtin [] __lpython_overloaded_9__pow Public), test_pow: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () () Default (Integer 4 []) Source Public Required .false.), a1: (Variable 2 a1 Local () (RealConstant 4.500000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), a2: (Variable 2 a2 Local () (RealConstant 2.300000 (Real 8 [])) 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.), b1: (Variable 2 b1 Local () (LogicalConstant .true. (Logical 1 [])) Default (Logical 1 []) Source Public Required .false.), b2: (Variable 2 b2 Local () (LogicalConstant .false. (Logical 1 [])) Default (Logical 1 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex Private), eps: (Variable 2 eps Local () () Default (Real 8 []) Source Public Required .false.), f1: (Variable 2 f1 Local () () Default (Real 4 []) Source Public Required .false.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), i1: (Variable 2 i1 Local () () Default (Integer 8 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 8 []) Source Public Required .false.), p: (Variable 2 p Local () () Default (Real 4 []) Source Public Required .false.), pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private), x: (Variable 2 x Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), y: (Variable 2 y Local () (RealConstant 2.300000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.)}) test_pow [] [(= (Var 2 eps) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 5 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 32 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 6 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 3 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 216 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (IntegerConstant 0 (Integer 4 [])) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((Var 2 a)) ((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 a) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) ()) (= (Var 2 a) (IntegerConstant 6 (Integer 4 [])) ()) (= (Var 2 b) (UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))) ()) (= (Var 2 i1) (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 i2) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_1__pow 2 pow [((Var 2 i1)) ((Var 2 i2))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 32 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 i1) (Cast (IntegerConstant 6 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 i2) (Cast (UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 2 f1) (Cast (BinOp (Cast (IntegerConstant 525346 (Integer 4 [])) IntegerToReal (Real 8 []) ()) Div (Cast (IntegerConstant 66456 (Integer 4 [])) IntegerToReal (Real 8 []) ()) (Real 8 []) () ()) RealToReal (Real 4 []) ()) ()) (= (Var 2 f2) (Cast (RealConstant 3.000000 (Real 8 [])) RealToReal (Real 4 []) ()) ()) (= (Var 2 p) (FunctionCall 1 pow@__lpython_overloaded_2__pow 2 pow [((Var 2 f1)) ((Var 2 f2))] (Real 4 []) () ()) ()) (= (Var 2 f1) (FunctionCall 1 pow@__lpython_overloaded_4__pow 2 pow [((Var 2 a)) ((Var 2 f2))] (Real 4 []) () ()) ()) (= (Var 2 f1) (FunctionCall 1 pow@__lpython_overloaded_5__pow 2 pow [((Var 2 f2)) ((Var 2 a))] (Real 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b1)) ((Var 2 b2))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b2)) ((Var 2 b1))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((Var 2 b1)) ((Var 2 b2))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_8__pow 2 pow [((LogicalConstant .false. (Logical 1 []))) ((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (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 a1)) ((Var 2 a2))] (Real 8 []) (RealConstant 31.797193 (Real 8 [])) ()) Sub (RealConstant 31.797193 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((Var 2 a2)) ((Var 2 a1))] (Real 8 []) (RealConstant 42.439989 (Real 8 [])) ()) Sub (RealConstant 42.439989 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((Var 2 x)) ((Var 2 y))] (Real 8 []) (RealConstant 12.513503 (Real 8 [])) ()) Sub (RealConstant 12.513503 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((Var 2 y)) ((Var 2 x))] (Real 8 []) (RealConstant 12.167000 (Real 8 [])) ()) Sub (RealConstant 12.167000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((Var 2 x)) ((RealConstant 5.500000 (Real 8 [])))] (Real 8 []) (RealConstant 420.888346 (Real 8 [])) ()) Sub (RealConstant 420.888346 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.500000 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 6 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 [])))) ((UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))))] (Integer 4 []) (RealConstant -0.004115 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Add (RealConstant 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 (Cast (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 6 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Integer 4 []) (RealConstant 0.000772 (Real 8 [])) ()) IntegerToReal (Real 8 []) ()) Sub (RealConstant 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_3__pow 2 pow [((RealConstant 4.500000 (Real 8 []))) ((RealConstant 2.300000 (Real 8 [])))] (Real 8 []) (RealConstant 31.797193 (Real 8 [])) ()) Sub (RealConstant 31.797193 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((RealConstant 2.300000 (Real 8 []))) ((RealConstant 0.000000 (Real 8 [])))] (Real 8 []) (RealConstant 1.000000 (Real 8 [])) ()) Sub (RealConstant 1.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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 [((RealConstant 2.300000 (Real 8 []))) ((UnaryOp USub (RealConstant 1.500000 (Real 8 [])) (Real 8 []) (RealConstant -1.500000 (Real 8 []))))] (Real 8 []) (RealConstant 0.286687 (Real 8 [])) ()) Sub (RealConstant 0.286687 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 3.400000 (Real 8 [])))] (Real 8 []) (RealConstant 10.556063 (Real 8 [])) ()) Sub (RealConstant 10.556063 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_6__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((UnaryOp USub (RealConstant 3.400000 (Real 8 [])) (Real 8 []) (RealConstant -3.400000 (Real 8 []))))] (Real 8 []) (RealConstant 0.094732 (Real 8 [])) ()) Sub (RealConstant 0.094732 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((RealConstant 3.400000 (Real 8 []))) ((IntegerConstant 9 (Integer 4 [])))] (Real 8 []) (RealConstant 60716.992766 (Real 8 [])) ()) Sub (RealConstant 60716.992766 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 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_7__pow 2 pow [((RealConstant 0.000000 (Real 8 []))) ((IntegerConstant 53 (Integer 4 [])))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Sub (RealConstant 0.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 16 (Integer 4 [])) ()) Eq (IntegerConstant 16 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 abs@__lpython_overloaded_0__abs 2 abs [((BinOp (FunctionCall 1 pow@__lpython_overloaded_7__pow 2 pow [((UnaryOp USub (RealConstant 4235.000000 (Real 8 [])) (Real 8 []) (RealConstant -4235.000000 (Real 8 [])))) ((IntegerConstant 52 (Integer 4 [])))] (Real 8 []) (RealConstant 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) ()) Sub (RealConstant 394800380598526378720936476336799774273305305904443955996320177992404102454228192853661558132283280490733920647962082901303487965679010854404517306573035287122910924343151116372519789002752.000000 (Real 8 [])) (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()))] (Real 8 []) (RealConstant 0.000000 (Real 8 [])) ()) Lt (Var 2 eps) (Logical 4 []) () ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 pow@__lpython_overloaded_9__pow 2 pow [((Var 2 c1)) ((IntegerConstant 4 (Integer 4 [])))] (Complex 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 c440f37f2c..cac9fefdaa 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": "403eb34f246f40dd6ca37383cd575fa8bd8a0fd2d416e13d235fff9b", + "stdout_hash": "677ed9ad1fdaea8c1be96b015ee55b35923481a0f97d3c0bab596f2d", "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 e921bdb632..718b4717aa 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 96 {}) _lpython_main_program [] [(SubroutineCall 1 test_round () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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), round@__lpython_overloaded_3__round: (ExternalSymbol 1 round@__lpython_overloaded_3__round 4 __lpython_overloaded_3__round lpython_builtin [] __lpython_overloaded_3__round Public), round@__lpython_overloaded_4__round: (ExternalSymbol 1 round@__lpython_overloaded_4__round 4 __lpython_overloaded_4__round lpython_builtin [] __lpython_overloaded_4__round Public), round@__lpython_overloaded_5__round: (ExternalSymbol 1 round@__lpython_overloaded_5__round 4 __lpython_overloaded_5__round lpython_builtin [] __lpython_overloaded_5__round Public), round@__lpython_overloaded_6__round: (ExternalSymbol 1 round@__lpython_overloaded_6__round 4 __lpython_overloaded_6__round lpython_builtin [] __lpython_overloaded_6__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.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 1 []) Source Public Required .false.), i3: (Variable 2 i3 Local () () Default (Integer 2 []) Source Public Required .false.), i4: (Variable 2 i4 Local () () Default (Integer 8 []) Source Public Required .false.), round: (ExternalSymbol 2 round 4 round lpython_builtin [] round Private)}) test_round [] [(= (Var 2 f) (RealConstant 5.678000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (UnaryOp USub (RealConstant 183745.230000 (Real 8 [])) (Real 8 []) (RealConstant -183745.230000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 183745 (Integer 4 [])) (Integer 4 []) (IntegerConstant -183745 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 44.340000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 44 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 0.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (UnaryOp USub (RealConstant 50.500000 (Real 8 [])) (Real 8 []) (RealConstant -50.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 50 (Integer 4 [])) (Integer 4 []) (IntegerConstant -50 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 1.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 13.001000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 13 (Integer 4 [])) ()) Eq (IntegerConstant 13 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (RealConstant 40.499990 (Real 8 [])) (Real 8 []) (RealConstant -40.499990 (Real 8 []))))] (Integer 4 []) (IntegerConstant -40 (Integer 4 [])) ()) Eq (UnaryOp USub (IntegerConstant 40 (Integer 4 [])) (Integer 4 []) (IntegerConstant -40 (Integer 4 []))) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 0.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (RealConstant 0.500000 (Real 8 [])) (Real 8 []) (RealConstant -0.500000 (Real 8 []))))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 1.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 2 (Integer 4 [])) ()) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 50.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 50 (Integer 4 [])) ()) Eq (IntegerConstant 50 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 56.780000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 57 (Integer 4 [])) ()) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 f2) (Cast (RealConstant 5.678000 (Real 8 [])) RealToReal (Real 4 []) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((Var 2 f2))] (Integer 4 []) () ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 i))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((IntegerConstant 4 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ()) Eq (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 i2) (Cast (IntegerConstant 7 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 round@__lpython_overloaded_4__round 2 round [((Var 2 i2))] (Integer 1 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 7 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i3) (Cast (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 round@__lpython_overloaded_5__round 2 round [((Var 2 i3))] (Integer 2 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 i4) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_3__round 2 round [((Var 2 i4))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 97 {}) _lpython_main_program [] [(SubroutineCall 1 test_round () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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), round@__lpython_overloaded_3__round: (ExternalSymbol 1 round@__lpython_overloaded_3__round 4 __lpython_overloaded_3__round lpython_builtin [] __lpython_overloaded_3__round Public), round@__lpython_overloaded_4__round: (ExternalSymbol 1 round@__lpython_overloaded_4__round 4 __lpython_overloaded_4__round lpython_builtin [] __lpython_overloaded_4__round Public), round@__lpython_overloaded_5__round: (ExternalSymbol 1 round@__lpython_overloaded_5__round 4 __lpython_overloaded_5__round lpython_builtin [] __lpython_overloaded_5__round Public), round@__lpython_overloaded_6__round: (ExternalSymbol 1 round@__lpython_overloaded_6__round 4 __lpython_overloaded_6__round lpython_builtin [] __lpython_overloaded_6__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.), f2: (Variable 2 f2 Local () () Default (Real 4 []) Source Public Required .false.), i: (Variable 2 i Local () () Default (Integer 4 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 1 []) Source Public Required .false.), i3: (Variable 2 i3 Local () () Default (Integer 2 []) Source Public Required .false.), i4: (Variable 2 i4 Local () () Default (Integer 8 []) Source Public Required .false.), round: (ExternalSymbol 2 round 4 round lpython_builtin [] round Private)}) test_round [] [(= (Var 2 f) (RealConstant 5.678000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (UnaryOp USub (RealConstant 183745.230000 (Real 8 [])) (Real 8 []) (RealConstant -183745.230000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 183745 (Integer 4 [])) (Integer 4 []) (IntegerConstant -183745 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 44.340000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 44 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 0.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 f) (UnaryOp USub (RealConstant 50.500000 (Real 8 [])) (Real 8 []) (RealConstant -50.500000 (Real 8 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 50 (Integer 4 [])) (Integer 4 []) (IntegerConstant -50 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 f) (RealConstant 1.500000 (Real 8 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((Var 2 f))] (Integer 4 []) () ()) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 13.001000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 13 (Integer 4 [])) ()) Eq (IntegerConstant 13 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (RealConstant 40.499990 (Real 8 [])) (Real 8 []) (RealConstant -40.499990 (Real 8 []))))] (Integer 4 []) (IntegerConstant -40 (Integer 4 [])) ()) Eq (UnaryOp USub (IntegerConstant 40 (Integer 4 [])) (Integer 4 []) (IntegerConstant -40 (Integer 4 []))) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 0.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((UnaryOp USub (RealConstant 0.500000 (Real 8 [])) (Real 8 []) (RealConstant -0.500000 (Real 8 []))))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 1.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 2 (Integer 4 [])) ()) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 50.500000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 50 (Integer 4 [])) ()) Eq (IntegerConstant 50 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_0__round 2 round [((RealConstant 56.780000 (Real 8 [])))] (Integer 4 []) (IntegerConstant 57 (Integer 4 [])) ()) Eq (IntegerConstant 57 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 f2) (Cast (RealConstant 5.678000 (Real 8 [])) RealToReal (Real 4 []) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_1__round 2 round [((Var 2 f2))] (Integer 4 []) () ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((Var 2 i))] (Integer 4 []) () ()) Eq (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_2__round 2 round [((IntegerConstant 4 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ()) Eq (IntegerConstant 4 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (= (Var 2 i2) (Cast (IntegerConstant 7 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 round@__lpython_overloaded_4__round 2 round [((Var 2 i2))] (Integer 1 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (IntegerConstant 7 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 i3) (Cast (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (Compare (Cast (FunctionCall 1 round@__lpython_overloaded_5__round 2 round [((Var 2 i3))] (Integer 2 []) () ()) IntegerToInteger (Integer 4 []) ()) Eq (UnaryOp USub (IntegerConstant 8 (Integer 4 [])) (Integer 4 []) (IntegerConstant -8 (Integer 4 []))) (Logical 4 []) () ()) ()) (= (Var 2 i4) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_3__round 2 round [((Var 2 i4))] (Integer 8 []) () ()) Eq (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((Var 2 b))] (Integer 4 []) () ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 1 round@__lpython_overloaded_6__round 2 round [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) Eq (IntegerConstant 0 (Integer 4 [])) (Logical 4 []) (LogicalConstant .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 7597e663a3..59cf1529d7 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": "0b7d4dde13b30c17ff71ebf3ad9a5b1fb03ae41e91a92ef44550ec27", + "stdout_hash": "26ccda1447736d73f7e9dd377a9085ea6c7dff348dd956e1d5e2b47d", "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 1af8e1cc1d..4b0fda75a3 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 96 {}) _lpython_main_program [] [(SubroutineCall 1 test_str_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 95 {}) 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 () [((IntegerConstant 356 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "356" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (StringConstant "356" (Character 1 3 () [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (FunctionCall 2 str () [((UnaryOp USub (IntegerConstant 567 (Integer 4 [])) (Integer 4 []) (IntegerConstant -567 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-567" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (StringConstant "-567" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 str () [((IntegerConstant 4 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "4" (Character 1 1 () [])) ()) Eq (StringConstant "4" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 str () [((UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-5" (Character 1 1 () [])) ()) Eq (StringConstant "-5" (Character 1 2 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 97 {}) _lpython_main_program [] [(SubroutineCall 1 test_str_int () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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 () [((IntegerConstant 356 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "356" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (StringConstant "356" (Character 1 3 () [])) (Logical 4 []) () ()) ()) (= (Var 2 s) (FunctionCall 2 str () [((UnaryOp USub (IntegerConstant 567 (Integer 4 [])) (Integer 4 []) (IntegerConstant -567 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-567" (Character 1 1 () [])) ()) ()) (Assert (Compare (Var 2 s) Eq (StringConstant "-567" (Character 1 4 () [])) (Logical 4 []) () ()) ()) (Assert (Compare (FunctionCall 2 str () [((IntegerConstant 4 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "4" (Character 1 1 () [])) ()) Eq (StringConstant "4" (Character 1 1 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 2 str () [((UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-5" (Character 1 1 () [])) ()) Eq (StringConstant "-5" (Character 1 2 () [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_max_min-3c2fc51.json b/tests/reference/asr-test_max_min-3c2fc51.json index 39b1edb54e..603e07e4eb 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.json +++ b/tests/reference/asr-test_max_min-3c2fc51.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_max_min-3c2fc51.stdout", - "stdout_hash": "8847038dc2c663f1eeb3493fb6663e5450b85e6dc20d1b4e9f73de02", + "stdout_hash": "e2533628dcc91553b33df1d2e628c8f52f5420f8f3df1f4234258e62", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_max_min-3c2fc51.stdout b/tests/reference/asr-test_max_min-3c2fc51.stdout index 91c39b28e5..9ddce66daf 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.stdout +++ b/tests/reference/asr-test_max_min-3c2fc51.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 100 {}) _lpython_main_program [] [(SubroutineCall 1 check () [] ())] Source Public Implementation () .false. .false.), check: (Subroutine (SymbolTable 6 {}) check [] [(SubroutineCall 1 test_max_int () [] ()) (SubroutineCall 1 test_max_float () [] ()) (SubroutineCall 1 test_min_int () [] ()) (SubroutineCall 1 test_min_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 99 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), max@__lpython_overloaded_0__max: (ExternalSymbol 1 max@__lpython_overloaded_0__max 8 __lpython_overloaded_0__max lpython_builtin [] __lpython_overloaded_0__max Public), max@__lpython_overloaded_1__max: (ExternalSymbol 1 max@__lpython_overloaded_1__max 8 __lpython_overloaded_1__max lpython_builtin [] __lpython_overloaded_1__max Public), max@__lpython_overloaded_2__max: (ExternalSymbol 1 max@__lpython_overloaded_2__max 8 __lpython_overloaded_2__max lpython_builtin [] __lpython_overloaded_2__max Public), max@__lpython_overloaded_3__max: (ExternalSymbol 1 max@__lpython_overloaded_3__max 8 __lpython_overloaded_3__max lpython_builtin [] __lpython_overloaded_3__max Public), min@__lpython_overloaded_0__min: (ExternalSymbol 1 min@__lpython_overloaded_0__min 8 __lpython_overloaded_0__min lpython_builtin [] __lpython_overloaded_0__min Public), min@__lpython_overloaded_1__min: (ExternalSymbol 1 min@__lpython_overloaded_1__min 8 __lpython_overloaded_1__min lpython_builtin [] __lpython_overloaded_1__min Public), min@__lpython_overloaded_2__min: (ExternalSymbol 1 min@__lpython_overloaded_2__min 8 __lpython_overloaded_2__min lpython_builtin [] __lpython_overloaded_2__min Public), min@__lpython_overloaded_3__min: (ExternalSymbol 1 min@__lpython_overloaded_3__min 8 __lpython_overloaded_3__min lpython_builtin [] __lpython_overloaded_3__min Public), test_max_float: (Subroutine (SymbolTable 3 {d: (Variable 3 d Local () (RealConstant 23.233000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), e: (Variable 3 e Local () (RealConstant 23.223300 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), f: (Variable 3 f Local () (RealConstant 21.230000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), max: (ExternalSymbol 3 max 8 max lpython_builtin [] max Private)}) test_max_float [] [(Assert (Compare (FunctionCall 1 max@__lpython_overloaded_2__max 3 max [((Var 3 d)) ((Var 3 e)) ((Var 3 f))] (Real 8 []) (RealConstant 23.233000 (Real 8 [])) ()) Eq (Var 3 d) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_3__max 3 max [((Var 3 e)) ((Var 3 f))] (Real 8 []) (RealConstant 23.223300 (Real 8 [])) ()) Eq (Var 3 e) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_max_int: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () (IntegerConstant 1 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () (IntegerConstant 2 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), c: (Variable 2 c Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), max: (ExternalSymbol 2 max 8 max lpython_builtin [] max Private)}) test_max_int [] [(Assert (Compare (FunctionCall 1 max@__lpython_overloaded_0__max 2 max [((Var 2 a)) ((Var 2 b))] (Integer 4 []) (IntegerConstant 2 (Integer 4 [])) ()) Eq (Var 2 b) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_1__max 2 max [((Var 2 a)) ((Var 2 b)) ((Var 2 c))] (Integer 4 []) (IntegerConstant 3 (Integer 4 [])) ()) Eq (Var 2 c) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_1__max 2 max [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 3 (Integer 4 [])) ()) Eq (IntegerConstant 3 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_0__max 2 max [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 6 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 6 (Integer 4 [])) ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_min_float: (Subroutine (SymbolTable 5 {d: (Variable 5 d Local () (RealConstant 23.233000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), e: (Variable 5 e Local () (RealConstant 23.223300 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), f: (Variable 5 f Local () (RealConstant 21.230000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), min: (ExternalSymbol 5 min 8 min lpython_builtin [] min Private)}) test_min_float [] [(Assert (Compare (FunctionCall 1 min@__lpython_overloaded_2__min 5 min [((Var 5 d)) ((Var 5 e)) ((Var 5 f))] (Real 8 []) (RealConstant 21.230000 (Real 8 [])) ()) Eq (Var 5 f) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_3__min 5 min [((Var 5 e)) ((Var 5 f))] (Real 8 []) (RealConstant 21.230000 (Real 8 [])) ()) Eq (Var 5 f) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_min_int: (Subroutine (SymbolTable 4 {a: (Variable 4 a Local () (IntegerConstant 1 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), b: (Variable 4 b Local () (IntegerConstant 2 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), c: (Variable 4 c Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), min: (ExternalSymbol 4 min 8 min lpython_builtin [] min Private)}) test_min_int [] [(Assert (Compare (FunctionCall 1 min@__lpython_overloaded_0__min 4 min [((Var 4 a)) ((Var 4 b))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (Var 4 a) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_1__min 4 min [((Var 4 a)) ((Var 4 b)) ((Var 4 c))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (Var 4 a) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_1__min 4 min [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_0__min 4 min [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 6 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 101 {}) _lpython_main_program [] [(SubroutineCall 1 check () [] ())] Source Public Implementation () .false. .false.), check: (Subroutine (SymbolTable 6 {}) check [] [(SubroutineCall 1 test_max_int () [] ()) (SubroutineCall 1 test_max_float () [] ()) (SubroutineCall 1 test_min_int () [] ()) (SubroutineCall 1 test_min_float () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 100 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), max@__lpython_overloaded_0__max: (ExternalSymbol 1 max@__lpython_overloaded_0__max 8 __lpython_overloaded_0__max lpython_builtin [] __lpython_overloaded_0__max Public), max@__lpython_overloaded_1__max: (ExternalSymbol 1 max@__lpython_overloaded_1__max 8 __lpython_overloaded_1__max lpython_builtin [] __lpython_overloaded_1__max Public), max@__lpython_overloaded_2__max: (ExternalSymbol 1 max@__lpython_overloaded_2__max 8 __lpython_overloaded_2__max lpython_builtin [] __lpython_overloaded_2__max Public), max@__lpython_overloaded_3__max: (ExternalSymbol 1 max@__lpython_overloaded_3__max 8 __lpython_overloaded_3__max lpython_builtin [] __lpython_overloaded_3__max Public), min@__lpython_overloaded_0__min: (ExternalSymbol 1 min@__lpython_overloaded_0__min 8 __lpython_overloaded_0__min lpython_builtin [] __lpython_overloaded_0__min Public), min@__lpython_overloaded_1__min: (ExternalSymbol 1 min@__lpython_overloaded_1__min 8 __lpython_overloaded_1__min lpython_builtin [] __lpython_overloaded_1__min Public), min@__lpython_overloaded_2__min: (ExternalSymbol 1 min@__lpython_overloaded_2__min 8 __lpython_overloaded_2__min lpython_builtin [] __lpython_overloaded_2__min Public), min@__lpython_overloaded_3__min: (ExternalSymbol 1 min@__lpython_overloaded_3__min 8 __lpython_overloaded_3__min lpython_builtin [] __lpython_overloaded_3__min Public), test_max_float: (Subroutine (SymbolTable 3 {d: (Variable 3 d Local () (RealConstant 23.233000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), e: (Variable 3 e Local () (RealConstant 23.223300 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), f: (Variable 3 f Local () (RealConstant 21.230000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), max: (ExternalSymbol 3 max 8 max lpython_builtin [] max Private)}) test_max_float [] [(Assert (Compare (FunctionCall 1 max@__lpython_overloaded_2__max 3 max [((Var 3 d)) ((Var 3 e)) ((Var 3 f))] (Real 8 []) (RealConstant 23.233000 (Real 8 [])) ()) Eq (Var 3 d) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_3__max 3 max [((Var 3 e)) ((Var 3 f))] (Real 8 []) (RealConstant 23.223300 (Real 8 [])) ()) Eq (Var 3 e) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_max_int: (Subroutine (SymbolTable 2 {a: (Variable 2 a Local () (IntegerConstant 1 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), b: (Variable 2 b Local () (IntegerConstant 2 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), c: (Variable 2 c Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), max: (ExternalSymbol 2 max 8 max lpython_builtin [] max Private)}) test_max_int [] [(Assert (Compare (FunctionCall 1 max@__lpython_overloaded_0__max 2 max [((Var 2 a)) ((Var 2 b))] (Integer 4 []) (IntegerConstant 2 (Integer 4 [])) ()) Eq (Var 2 b) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_1__max 2 max [((Var 2 a)) ((Var 2 b)) ((Var 2 c))] (Integer 4 []) (IntegerConstant 3 (Integer 4 [])) ()) Eq (Var 2 c) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_1__max 2 max [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 3 (Integer 4 [])) ()) Eq (IntegerConstant 3 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 max@__lpython_overloaded_0__max 2 max [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 6 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 6 (Integer 4 [])) ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_min_float: (Subroutine (SymbolTable 5 {d: (Variable 5 d Local () (RealConstant 23.233000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), e: (Variable 5 e Local () (RealConstant 23.223300 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), f: (Variable 5 f Local () (RealConstant 21.230000 (Real 8 [])) Default (Real 8 []) Source Public Required .false.), min: (ExternalSymbol 5 min 8 min lpython_builtin [] min Private)}) test_min_float [] [(Assert (Compare (FunctionCall 1 min@__lpython_overloaded_2__min 5 min [((Var 5 d)) ((Var 5 e)) ((Var 5 f))] (Real 8 []) (RealConstant 21.230000 (Real 8 [])) ()) Eq (Var 5 f) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_3__min 5 min [((Var 5 e)) ((Var 5 f))] (Real 8 []) (RealConstant 21.230000 (Real 8 [])) ()) Eq (Var 5 f) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.), test_min_int: (Subroutine (SymbolTable 4 {a: (Variable 4 a Local () (IntegerConstant 1 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), b: (Variable 4 b Local () (IntegerConstant 2 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), c: (Variable 4 c Local () (IntegerConstant 3 (Integer 4 [])) Default (Integer 4 []) Source Public Required .false.), min: (ExternalSymbol 4 min 8 min lpython_builtin [] min Private)}) test_min_int [] [(Assert (Compare (FunctionCall 1 min@__lpython_overloaded_0__min 4 min [((Var 4 a)) ((Var 4 b))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (Var 4 a) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_1__min 4 min [((Var 4 a)) ((Var 4 b)) ((Var 4 c))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (Var 4 a) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_1__min 4 min [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ()) (Assert (Compare (FunctionCall 1 min@__lpython_overloaded_0__min 4 min [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 6 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) (LogicalConstant .true. (Logical 4 [])) ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/asr-test_pow-3f5d550.json b/tests/reference/asr-test_pow-3f5d550.json index 2beaf469ed..90fca31226 100644 --- a/tests/reference/asr-test_pow-3f5d550.json +++ b/tests/reference/asr-test_pow-3f5d550.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_pow-3f5d550.stdout", - "stdout_hash": "140db37de9a507cc81dc9fab14f4e5f76f0e5e216312c9c5526f1570", + "stdout_hash": "1d95b02ebb991f178184b28e37de1d4482d196ccf25c24e31e04684d", "stderr": "asr-test_pow-3f5d550.stderr", "stderr_hash": "3d950301563cce75654f28bf41f6f53428ed1f5ae997774345f374a3", "returncode": 0 diff --git a/tests/reference/asr-test_pow-3f5d550.stdout b/tests/reference/asr-test_pow-3f5d550.stdout index cf2b1e00d2..d99f001522 100644 --- a/tests/reference/asr-test_pow-3f5d550.stdout +++ b/tests/reference/asr-test_pow-3f5d550.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 96 {}) _lpython_main_program [] [(SubroutineCall 1 main () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main: (Subroutine (SymbolTable 2 {pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private)}) main [] [(Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ())]) (Print () [(BinOp (IntegerConstant 2 (Integer 4 [])) Pow (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 95 {}) 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)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 97 {}) _lpython_main_program [] [(SubroutineCall 1 main () [] ())] Source Public Implementation () .false. .false.), lpython_builtin: (IntrinsicModule lpython_builtin), main: (Subroutine (SymbolTable 2 {pow: (ExternalSymbol 2 pow 4 pow lpython_builtin [] pow Private)}) main [] [(Print () [(FunctionCall 1 pow@__lpython_overloaded_0__pow 2 pow [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ())]) (Print () [(BinOp (IntegerConstant 2 (Integer 4 [])) Pow (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 [])) ())])] Source Public Implementation () .false. .false.), main_program: (Program (SymbolTable 96 {}) 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)}) []) diff --git a/tests/reference/ast-constants1-91cb6ff.json b/tests/reference/ast-constants1-91cb6ff.json index e7e792678e..25d0db8ae3 100644 --- a/tests/reference/ast-constants1-91cb6ff.json +++ b/tests/reference/ast-constants1-91cb6ff.json @@ -2,11 +2,11 @@ "basename": "ast-constants1-91cb6ff", "cmd": "lpython --show-ast --no-color {infile} -o {outfile}", "infile": "tests/constants1.py", - "infile_hash": "86d7dacf1572246948121f4ef0aaddd1cb8be614c003453e8faae162", + "infile_hash": "0353168d7f204b8ce707571434961e310c14a7714ba7ba3e87d0fbd5", "outfile": null, "outfile_hash": null, "stdout": "ast-constants1-91cb6ff.stdout", - "stdout_hash": "79aad97436e7b1514a6f3f74210accc7ab2cacb0f17203e5bbffdd29", + "stdout_hash": "9605dbc993b2b6f9cddd10246cbd19d850674cca0352f5310c870ec3", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-constants1-91cb6ff.stdout b/tests/reference/ast-constants1-91cb6ff.stdout index bffcaf9299..9e625bb4ae 100644 --- a/tests/reference/ast-constants1-91cb6ff.stdout +++ b/tests/reference/ast-constants1-91cb6ff.stdout @@ -1 +1 @@ -(Module [(FunctionDef test_boz ([] [] [] [] [] [] []) [(AnnAssign (Name b Store) (Name str Load) () 1) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 64 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 8 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 56 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 42 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 12648430 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ())] [] () ()) (FunctionDef test_ord_chr ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name ord Load) [(ConstantStr "5" ())] []) ()) (Assign [(Name s Store)] (Call (Name chr Load) [(ConstantInt 43 ())] []) ())] [] () ()) (FunctionDef test_abs ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantInt 500 ()))] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .true. ())] []) ()) (AnnAssign (Name b Store) (Name f32 Load) () 1) (Assign [(Name b Store)] (Call (Name abs Load) [(ConstantFloat 3.450000 ())] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantFloat 5346.340000 ()))] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(Call (Name complex Load) [(ConstantFloat 3.450000 ()) (ConstantFloat 5.600000 ())] [])] []) ())] [] () ()) (FunctionDef test_len ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "this is a test" ())] []) ())] [] () ()) (FunctionDef test_bool ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantInt 0 ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(Call (Name complex Load) [(ConstantInt 0 ()) (ConstantInt 0 ())] [])] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantFloat 2.300000 ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ())] [] () ()) (FunctionDef test_str ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (Assign [(Name s Store)] (Call (Name str Load) [] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(UnaryOp USub (ConstantInt 4 ()))] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantFloat 5.600000 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_callable ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (AnnAssign (Name b Store) (Name i32 Load) () 1) (Assign [(Name b Store)] (ConstantInt 2 ()) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name test_len Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name b Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(ConstantStr "c" ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ())] [] () ()) (FunctionDef test_int ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i64 Load) () 1) (Assign [(Name a Store)] (Call (Name int Load) [] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(UnaryOp USub (ConstantFloat 5.000010 ()))] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .false. ())] []) ())] [] () ()) (FunctionDef test_float ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name f64 Load) () 1) (Assign [(Name a Store)] (Call (Name float Load) [] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .false. ())] []) ())] [] () ()) (FunctionDef test_divmod ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Subscript (Name tuple Load) (Tuple [(Name i32 Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (UnaryOp USub (ConstantInt 3 ()))] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 3 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 4 ()) (ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 0 ()) (ConstantInt 5 ())] []) ())] [] () ())] []) +(Module [(FunctionDef test_boz ([] [] [] [] [] [] []) [(AnnAssign (Name b Store) (Name str Load) () 1) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 64 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 8 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 56 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 42 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 12648430 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ())] [] () ()) (FunctionDef test_ord_chr ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name ord Load) [(ConstantStr "5" ())] []) ()) (Assign [(Name s Store)] (Call (Name chr Load) [(ConstantInt 43 ())] []) ())] [] () ()) (FunctionDef test_abs ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantInt 500 ()))] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .true. ())] []) ()) (AnnAssign (Name b Store) (Name f32 Load) () 1) (Assign [(Name b Store)] (Call (Name abs Load) [(ConstantFloat 3.450000 ())] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantFloat 5346.340000 ()))] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(Call (Name complex Load) [(ConstantFloat 3.450000 ()) (ConstantFloat 5.600000 ())] [])] []) ())] [] () ()) (FunctionDef test_len ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "this is a test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(Tuple [(ConstantStr "c" ()) (ConstantStr "b" ()) (ConstantFloat 3.400000 ())] Load) (Tuple [(ConstantStr "c" ()) (ConstantInt 3 ()) (ConstantFloat 5.600000 ())] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(List [(UnaryOp USub (ConstantInt 4 ())) (UnaryOp USub (ConstantInt 5 ())) (UnaryOp USub (ConstantInt 6 ()))] Load) (List [(UnaryOp USub (ConstantInt 1 ())) (UnaryOp USub (ConstantInt 2 ())) (UnaryOp USub (ConstantInt 3 ()))] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Set [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())])] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Dict [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] [(ConstantStr "c" ()) (ConstantStr "b" ()) (ConstantStr "c" ())])] []) ())] [] () ()) (FunctionDef test_bool ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantInt 0 ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(Call (Name complex Load) [(ConstantInt 0 ()) (ConstantInt 0 ())] [])] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "t" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantFloat 2.300000 ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ())] [] () ()) (FunctionDef test_str ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (Assign [(Name s Store)] (Call (Name str Load) [] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(UnaryOp USub (ConstantInt 4 ()))] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantFloat 5.600000 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_callable ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (AnnAssign (Name b Store) (Name i32 Load) () 1) (Assign [(Name b Store)] (ConstantInt 2 ()) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name test_len Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name b Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(ConstantStr "c" ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ())] [] () ()) (FunctionDef test_int ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i64 Load) () 1) (Assign [(Name a Store)] (Call (Name int Load) [] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(UnaryOp USub (ConstantFloat 5.000010 ()))] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .false. ())] []) ())] [] () ()) (FunctionDef test_float ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name f64 Load) () 1) (Assign [(Name a Store)] (Call (Name float Load) [] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .false. ())] []) ())] [] () ()) (FunctionDef test_divmod ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Subscript (Name tuple Load) (Tuple [(Name i32 Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (UnaryOp USub (ConstantInt 3 ()))] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 3 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 4 ()) (ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 0 ()) (ConstantInt 5 ())] []) ())] [] () ())] []) diff --git a/tests/tests.toml b/tests/tests.toml index 86fa88f248..b5820f84eb 100644 --- a/tests/tests.toml +++ b/tests/tests.toml @@ -198,7 +198,7 @@ asr = true [[test]] filename = "../integration_tests/test_builtin_len.py" -# asr = true +asr = true [[test]] filename = "../integration_tests/test_builtin_pow.py" @@ -332,4 +332,4 @@ filename = "errors/test_set2.py" [[test]] filename = "errors/test_pow.py" -asr = true \ No newline at end of file +asr = true From 8f44e76bc4d75da48908b7b6be69545e653465c7 Mon Sep 17 00:00:00 2001 From: Naman Gera Date: Wed, 27 Apr 2022 16:42:44 +0530 Subject: [PATCH 10/14] Add docstring --- src/runtime/lpython_builtin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index 7f18e792f5..f77bfab61d 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -7,8 +7,8 @@ def ord(s: str) -> i32: # currently supports characters with unicode value betwe Returns an integer representing the Unicode code point of a given unicode character. This is the inverse of `chr()`. """ - # if len(s) != 1: - # return -1 # not a character + if len(s) != 1: + return -1 # not a character i: i32 for i in range(32, 127): if chr(i) == s: @@ -179,6 +179,9 @@ def bool(s: str) -> bool: @interface def len(s: str) -> i32: + """ + Return the length of the string `s`. + """ pass #: pow() as a generic procedure. From b91b27be76c76859ab3d9748745f49781a3ea5b8 Mon Sep 17 00:00:00 2001 From: Naman Gera Date: Wed, 27 Apr 2022 21:59:50 +0530 Subject: [PATCH 11/14] Apply suggestions from review by @czgdp1807 --- src/lpython/semantics/python_ast_to_asr.cpp | 8 ++++---- src/runtime/lpython_builtin.py | 14 +++++++------- tests/constants1.py | 5 +++++ tests/reference/asr-constants1-5828e8a.json | 4 ++-- tests/reference/asr-constants1-5828e8a.stdout | 2 +- tests/reference/asr-test_builtin_bool-330223a.json | 2 +- .../reference/asr-test_builtin_bool-330223a.stdout | 2 +- tests/reference/ast-constants1-91cb6ff.json | 4 ++-- tests/reference/ast-constants1-91cb6ff.stdout | 2 +- 9 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 664383cb52..25c305f603 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -2683,6 +2683,10 @@ class BodyVisitor : public CommonVisitor { ASR::asr_t* handle_intrinsic_len(Allocator &al, Vec args, const Location &loc) { + if (args.size() != 1) { + throw SemanticError("len() takes exactly one argument (" + + std::to_string(args.size()) + " given)", loc); + } ASR::expr_t *arg = args[0].m_value; ASR::ttype_t *type = ASRUtils::expr_type(arg); ASR::ttype_t *to_type = ASRUtils::TYPE(ASR::make_Integer_t(al, loc, @@ -2866,10 +2870,6 @@ class BodyVisitor : public CommonVisitor { } return; } else if (call_name == "len") { - if (args.size() != 1) { - throw SemanticError("len() takes exactly one argument (" + - std::to_string(args.size()) + " given)", x.base.base.loc); - } tmp = handle_intrinsic_len(al, args, x.base.base.loc); return; } else { diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index f77bfab61d..3acba42c00 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -158,6 +158,13 @@ def bool(f: f64) -> bool: """ return f != 0.0 +@overload +def bool(s: str) -> bool: + """ + Return False when the argument `s` is an empty string, True otherwise. + """ + return len(s) > 0 + @overload def bool(b: bool) -> bool: return b @@ -170,13 +177,6 @@ def bool(c: c32) -> bool: def bool(c: c64) -> bool: return c.real != 0.0 or _lfortran_zaimag(c) != 0.0 -@overload -def bool(s: str) -> bool: - """ - Return False when the argument `s` is an empty string, True otherwise. - """ - return len(s) > 0 - @interface def len(s: str) -> i32: """ diff --git a/tests/constants1.py b/tests/constants1.py index a35d47a1c5..9e63160838 100644 --- a/tests/constants1.py +++ b/tests/constants1.py @@ -41,6 +41,11 @@ def test_len(): a = len([[-4, -5, -6], [-1, -2, -3]]) a = len({1, 2, 3}) a = len({1: "c", 2: "b", 3: "c"}) + l: list[i32] + l = [1, 2, 3, 4] + a = len(l) + l.append(5) + a = len(l) def test_bool(): diff --git a/tests/reference/asr-constants1-5828e8a.json b/tests/reference/asr-constants1-5828e8a.json index fd6f069dd2..1fd98ddb72 100644 --- a/tests/reference/asr-constants1-5828e8a.json +++ b/tests/reference/asr-constants1-5828e8a.json @@ -2,11 +2,11 @@ "basename": "asr-constants1-5828e8a", "cmd": "lpython --show-asr --no-color {infile} -o {outfile}", "infile": "tests/constants1.py", - "infile_hash": "0353168d7f204b8ce707571434961e310c14a7714ba7ba3e87d0fbd5", + "infile_hash": "680bb6f62b6e7d58fdddc891954816cea0c25b9201576498f149849e", "outfile": null, "outfile_hash": null, "stdout": "asr-constants1-5828e8a.stdout", - "stdout_hash": "6ecd2b0f820bc997766cdb6916778daf70e82e354161635294892256", + "stdout_hash": "5de2d22da16f558bea2c729081ed44549d6639d26c8d1f2aba59c18b", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-constants1-5828e8a.stdout b/tests/reference/asr-constants1-5828e8a.stdout index fad03cc1ed..034c63a7b6 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_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 13 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 13 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), abs@__lpython_overloaded_8__abs: (ExternalSymbol 1 abs@__lpython_overloaded_8__abs 13 __lpython_overloaded_8__abs lpython_builtin [] __lpython_overloaded_8__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_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 13 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 13 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), bool@__lpython_overloaded_9__bool: (ExternalSymbol 1 bool@__lpython_overloaded_9__bool 13 __lpython_overloaded_9__bool lpython_builtin [] __lpython_overloaded_9__bool Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 13 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 13 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 105 {}) 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) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((IntegerConstant 5 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 5 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 500 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .true. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((RealConstant 3.450000 (Real 8 [])))] (Real 8 []) (RealConstant 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((UnaryOp USub (RealConstant 5346.340000 (Real 8 [])) (Real 8 []) (RealConstant -5346.340000 (Real 8 []))))] (Real 8 []) (RealConstant 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_8__abs 4 abs [((FunctionCall 1 complex@__lpython_overloaded_5__complex 4 complex [((RealConstant 3.450000 (Real 8 []))) ((RealConstant 5.600000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.450000 5.600000 (Complex 8 [])) ()))] (Real 8 []) (RealConstant 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 [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_9__bool 6 bool [((StringConstant "" (Character 1 0 () [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_8__bool 6 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 6 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_9__bool 6 bool [((StringConstant "t" (Character 1 1 () [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_5__bool 6 bool [((RealConstant 2.300000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .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 () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 8 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 56 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 42 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 12648430 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-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) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 8 a) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .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 () [((IntegerConstant 9 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 9 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant -3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 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.)}) test_float [] [(= (Var 10 a) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 10 a) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToReal (Real 8 []) (RealConstant 5.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant -1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 0.000000 (Real 8 []))) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.)}) test_int [] [(= (Var 9 a) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (RealConstant 4.560000 (Real 8 [])) RealToInteger (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (UnaryOp USub (RealConstant 5.000010 (Real 8 [])) (Real 8 []) (RealConstant -5.000010 (Real 8 []))) RealToInteger (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (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.)}) test_len [] [(= (Var 5 a) (StringLen (StringConstant "" (Character 1 0 () [])) (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) ()) (= (Var 5 a) (StringLen (StringConstant "test" (Character 1 4 () [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) ()) (= (Var 5 a) (StringLen (StringConstant "this is a test" (Character 1 14 () [])) (Integer 4 []) (IntegerConstant 14 (Integer 4 []))) ()) (= (Var 5 a) (TupleLen (TupleConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 []) (Integer 4 [])])) (Integer 4 []) (IntegerConstant 3 (Integer 4 []))) ()) (= (Var 5 a) (TupleLen (TupleConstant [(TupleConstant [(StringConstant "c" (Character 1 1 () [])) (StringConstant "b" (Character 1 1 () [])) (RealConstant 3.400000 (Real 8 []))] (Tuple [(Character 1 1 () []) (Character 1 1 () []) (Real 8 [])])) (TupleConstant [(StringConstant "c" (Character 1 1 () [])) (IntegerConstant 3 (Integer 4 [])) (RealConstant 5.600000 (Real 8 []))] (Tuple [(Character 1 1 () []) (Integer 4 []) (Real 8 [])]))] (Tuple [(Tuple [(Character 1 1 () []) (Character 1 1 () []) (Real 8 [])]) (Tuple [(Character 1 1 () []) (Integer 4 []) (Real 8 [])])])) (Integer 4 []) (IntegerConstant 2 (Integer 4 []))) ()) (= (Var 5 a) (ListLen (ListConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] (List (Integer 4 []))) (Integer 4 []) (IntegerConstant 3 (Integer 4 []))) ()) (= (Var 5 a) (ListLen (ListConstant [(ListConstant [(UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) (UnaryOp USub (IntegerConstant 6 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 [])))] (List (Integer 4 []))) (ListConstant [(UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (UnaryOp USub (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 []))) (UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 [])))] (List (Integer 4 [])))] (List (List (Integer 4 [])))) (Integer 4 []) (IntegerConstant 2 (Integer 4 []))) ()) (= (Var 5 a) (SetLen (SetConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] (Set (Integer 4 []))) (Integer 4 []) (IntegerConstant 3 (Integer 4 []))) ()) (= (Var 5 a) (DictLen (DictConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] [(StringConstant "c" (Character 1 1 () [])) (StringConstant "b" (Character 1 1 () [])) (StringConstant "c" (Character 1 1 () []))] (Dict (Integer 4 []) (Character 1 1 () []))) (Integer 4 []) (IntegerConstant 3 (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 () [((StringConstant "5" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (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 () []) (StringConstant "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((RealConstant 5.600000 (Real 8 [])))] (Character 1 -2 () []) (StringConstant "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .true. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .false. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((StringConstant "5346" (Character 1 4 () [])))] (Character 1 -2 () []) (StringConstant "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_4__abs: (ExternalSymbol 1 abs@__lpython_overloaded_4__abs 13 __lpython_overloaded_4__abs lpython_builtin [] __lpython_overloaded_4__abs Public), abs@__lpython_overloaded_6__abs: (ExternalSymbol 1 abs@__lpython_overloaded_6__abs 13 __lpython_overloaded_6__abs lpython_builtin [] __lpython_overloaded_6__abs Public), abs@__lpython_overloaded_8__abs: (ExternalSymbol 1 abs@__lpython_overloaded_8__abs 13 __lpython_overloaded_8__abs lpython_builtin [] __lpython_overloaded_8__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_5__bool: (ExternalSymbol 1 bool@__lpython_overloaded_5__bool 13 __lpython_overloaded_5__bool lpython_builtin [] __lpython_overloaded_5__bool Public), bool@__lpython_overloaded_6__bool: (ExternalSymbol 1 bool@__lpython_overloaded_6__bool 13 __lpython_overloaded_6__bool lpython_builtin [] __lpython_overloaded_6__bool Public), bool@__lpython_overloaded_9__bool: (ExternalSymbol 1 bool@__lpython_overloaded_9__bool 13 __lpython_overloaded_9__bool lpython_builtin [] __lpython_overloaded_9__bool Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 13 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 13 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 105 {}) 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) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((IntegerConstant 5 (Integer 4 [])))] (Integer 4 []) (IntegerConstant 5 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_4__abs 4 abs [((UnaryOp USub (IntegerConstant 500 (Integer 4 [])) (Integer 4 []) (IntegerConstant -500 (Integer 4 []))))] (Integer 4 []) (IntegerConstant 500 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .false. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 0 (Integer 4 [])) ()) ()) (= (Var 4 a) (FunctionCall 1 abs@__lpython_overloaded_6__abs 4 abs [((LogicalConstant .true. (Logical 1 [])))] (Integer 4 []) (IntegerConstant 1 (Integer 4 [])) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((RealConstant 3.450000 (Real 8 [])))] (Real 8 []) (RealConstant 3.450000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_0__abs 4 abs [((UnaryOp USub (RealConstant 5346.340000 (Real 8 [])) (Real 8 []) (RealConstant -5346.340000 (Real 8 []))))] (Real 8 []) (RealConstant 5346.340000 (Real 8 [])) ()) RealToReal (Real 4 []) ()) ()) (= (Var 4 b) (Cast (FunctionCall 1 abs@__lpython_overloaded_8__abs 4 abs [((FunctionCall 1 complex@__lpython_overloaded_5__complex 4 complex [((RealConstant 3.450000 (Real 8 []))) ((RealConstant 5.600000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.450000 5.600000 (Complex 8 [])) ()))] (Real 8 []) (RealConstant 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 [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_0__bool 6 bool [((UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_6__bool 6 bool [((StringConstant "" (Character 1 0 () [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_9__bool 6 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 6 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_6__bool 6 bool [((StringConstant "t" (Character 1 1 () [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 6 a) (FunctionCall 1 bool@__lpython_overloaded_5__bool 6 bool [((RealConstant 2.300000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (Compare (Var 6 a) Eq (LogicalConstant .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 () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b101" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((IntegerConstant 64 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0b1000000" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 bin () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0b1000010110" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 8 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o10" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((IntegerConstant 56 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0o70" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 oct () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-0o1026" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 42 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0x2a" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((IntegerConstant 12648430 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "0xc0ffee" (Character 1 1 () [])) ()) ()) (= (Var 2 b) (FunctionCall 2 hex () [((UnaryOp USub (IntegerConstant 534 (Integer 4 [])) (Integer 4 []) (IntegerConstant -534 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-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) (IntegerConstant 2 (Integer 4 [])) ()) (= (Var 8 a) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .true. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .false. (Logical 1 [])) (Logical 4 []) () ()) ()) (= (Var 8 a) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (Compare (Var 8 a) Eq (LogicalConstant .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 () [((IntegerConstant 9 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 9 (Integer 4 []))) ((UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant -3 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 0 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 4 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) ()) (= (Var 11 a) (FunctionCall 11 divmod () [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Tuple [(Integer 4 []) (Integer 4 [])]) (TupleConstant [(IntegerConstant 0 (Integer 4 [])) (IntegerConstant 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.)}) test_float [] [(= (Var 10 a) (RealConstant 0.000000 (Real 8 [])) ()) (= (Var 10 a) (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToReal (Real 8 []) (RealConstant 5.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant -1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 1.000000 (Real 8 []))) ()) (= (Var 10 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) IntegerToReal (Real 8 []) (RealConstant 0.000000 (Real 8 []))) ())] Source Public Implementation () .false. .false.), test_int: (Subroutine (SymbolTable 9 {a: (Variable 9 a Local () () Default (Integer 8 []) Source Public Required .false.)}) test_int [] [(= (Var 9 a) (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (RealConstant 4.560000 (Real 8 [])) RealToInteger (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (UnaryOp USub (RealConstant 5.000010 (Real 8 [])) (Real 8 []) (RealConstant -5.000010 (Real 8 []))) RealToInteger (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .true. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 1 (Integer 4 []))) IntegerToInteger (Integer 8 []) ()) ()) (= (Var 9 a) (Cast (Cast (LogicalConstant .false. (Logical 1 [])) LogicalToInteger (Integer 4 []) (IntegerConstant 0 (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.), l: (Variable 5 l Local () () Default (List (Integer 4 [])) Source Public Required .false.)}) test_len [] [(= (Var 5 a) (StringLen (StringConstant "" (Character 1 0 () [])) (Integer 4 []) (IntegerConstant 0 (Integer 4 []))) ()) (= (Var 5 a) (StringLen (StringConstant "test" (Character 1 4 () [])) (Integer 4 []) (IntegerConstant 4 (Integer 4 []))) ()) (= (Var 5 a) (StringLen (StringConstant "this is a test" (Character 1 14 () [])) (Integer 4 []) (IntegerConstant 14 (Integer 4 []))) ()) (= (Var 5 a) (TupleLen (TupleConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 []) (Integer 4 [])])) (Integer 4 []) (IntegerConstant 3 (Integer 4 []))) ()) (= (Var 5 a) (TupleLen (TupleConstant [(TupleConstant [(StringConstant "c" (Character 1 1 () [])) (StringConstant "b" (Character 1 1 () [])) (RealConstant 3.400000 (Real 8 []))] (Tuple [(Character 1 1 () []) (Character 1 1 () []) (Real 8 [])])) (TupleConstant [(StringConstant "c" (Character 1 1 () [])) (IntegerConstant 3 (Integer 4 [])) (RealConstant 5.600000 (Real 8 []))] (Tuple [(Character 1 1 () []) (Integer 4 []) (Real 8 [])]))] (Tuple [(Tuple [(Character 1 1 () []) (Character 1 1 () []) (Real 8 [])]) (Tuple [(Character 1 1 () []) (Integer 4 []) (Real 8 [])])])) (Integer 4 []) (IntegerConstant 2 (Integer 4 []))) ()) (= (Var 5 a) (ListLen (ListConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] (List (Integer 4 []))) (Integer 4 []) (IntegerConstant 3 (Integer 4 []))) ()) (= (Var 5 a) (ListLen (ListConstant [(ListConstant [(UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))) (UnaryOp USub (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant -5 (Integer 4 []))) (UnaryOp USub (IntegerConstant 6 (Integer 4 [])) (Integer 4 []) (IntegerConstant -6 (Integer 4 [])))] (List (Integer 4 []))) (ListConstant [(UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (UnaryOp USub (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 []))) (UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 [])))] (List (Integer 4 [])))] (List (List (Integer 4 [])))) (Integer 4 []) (IntegerConstant 2 (Integer 4 []))) ()) (= (Var 5 a) (SetLen (SetConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] (Set (Integer 4 []))) (Integer 4 []) (IntegerConstant 3 (Integer 4 []))) ()) (= (Var 5 a) (DictLen (DictConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] [(StringConstant "c" (Character 1 1 () [])) (StringConstant "b" (Character 1 1 () [])) (StringConstant "c" (Character 1 1 () []))] (Dict (Integer 4 []) (Character 1 1 () []))) (Integer 4 []) (IntegerConstant 3 (Integer 4 []))) ()) (= (Var 5 l) (ListConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])) (IntegerConstant 3 (Integer 4 [])) (IntegerConstant 4 (Integer 4 []))] (List (Integer 4 []))) ()) (= (Var 5 a) (ListLen (Var 5 l) (Integer 4 []) ()) ()) (ListAppend 5 l (IntegerConstant 5 (Integer 4 []))) (= (Var 5 a) (ListLen (Var 5 l) (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 () [((StringConstant "5" (Character 1 1 () [])))] (Integer 4 []) (IntegerConstant 53 (Integer 4 [])) ()) ()) (= (Var 3 s) (FunctionCall 3 chr () [((IntegerConstant 43 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "+" (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 () []) (StringConstant "" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((IntegerConstant 5 (Integer 4 [])))] (Character 1 -2 () []) (StringConstant "5" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((UnaryOp USub (IntegerConstant 4 (Integer 4 [])) (Integer 4 []) (IntegerConstant -4 (Integer 4 []))))] (Character 1 -2 () []) (StringConstant "-4" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((RealConstant 5.600000 (Real 8 [])))] (Character 1 -2 () []) (StringConstant "5.600000" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .true. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "True" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((LogicalConstant .false. (Logical 1 [])))] (Character 1 -2 () []) (StringConstant "False" (Character 1 1 () [])) ()) ()) (= (Var 7 s) (FunctionCall 7 str () [((StringConstant "5346" (Character 1 4 () [])))] (Character 1 -2 () []) (StringConstant "5346" (Character 1 1 () [])) ()) ())] 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 1e4ade4c21..b618cd7b33 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": "e9947966454060f9db97a892542dd50c75b82b6ae74e2eb521310882", + "stdout_hash": "b83fe2967d8ee1b00d66fd6678b9a0ba8d56270796ee0fdd0a0ae93b", "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 45e23e811e..761b3e93c8 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 97 {}) _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), bool@__lpython_overloaded_6__bool: (ExternalSymbol 1 bool@__lpython_overloaded_6__bool 4 __lpython_overloaded_6__bool lpython_builtin [] __lpython_overloaded_6__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 4 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 4 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), bool@__lpython_overloaded_9__bool: (ExternalSymbol 1 bool@__lpython_overloaded_9__bool 4 __lpython_overloaded_9__bool lpython_builtin [] __lpython_overloaded_9__bool Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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.), a3: (Variable 2 a3 Local () () Default (Integer 1 []) Source Public Required .false.), a4: (Variable 2 a4 Local () () Default (Integer 2 []) 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), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) ()) (= (Var 2 a) (IntegerConstant 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 (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 a2) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [((Var 2 a2))] (Logical 1 []) () ()) ()) (= (Var 2 a3) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [((Var 2 a3))] (Logical 1 []) () ()) ()) (= (Var 2 a4) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 a4))] (Logical 1 []) () ()) ()) (= (Var 2 f) (RealConstant 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (RealConstant 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 56.786866 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 0.000000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f2) (Cast (UnaryOp USub (RealConstant 235.600000 (Real 8 [])) (Real 8 []) (RealConstant -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 f2))] (Logical 1 []) () ()) ()) (= (Var 2 s) (StringConstant "" (Character 1 0 () [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 s) (StringConstant "str" (Character 1 3 () [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((StringConstant "" (Character 1 0 () [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((StringConstant "str" (Character 1 3 () [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((LogicalConstant .true. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((LogicalConstant .false. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 2.000000 3.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((BinOp (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 0.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((RealConstant 0.100202 (Real 8 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.100202 (Complex 8 [])) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((Var 2 c1))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((BinOp (Cast (IntegerConstant 3 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Subroutine (SymbolTable 97 {}) _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), bool@__lpython_overloaded_6__bool: (ExternalSymbol 1 bool@__lpython_overloaded_6__bool 4 __lpython_overloaded_6__bool lpython_builtin [] __lpython_overloaded_6__bool Public), bool@__lpython_overloaded_7__bool: (ExternalSymbol 1 bool@__lpython_overloaded_7__bool 4 __lpython_overloaded_7__bool lpython_builtin [] __lpython_overloaded_7__bool Public), bool@__lpython_overloaded_8__bool: (ExternalSymbol 1 bool@__lpython_overloaded_8__bool 4 __lpython_overloaded_8__bool lpython_builtin [] __lpython_overloaded_8__bool Public), bool@__lpython_overloaded_9__bool: (ExternalSymbol 1 bool@__lpython_overloaded_9__bool 4 __lpython_overloaded_9__bool lpython_builtin [] __lpython_overloaded_9__bool Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 4 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 4 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 96 {}) 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.), a3: (Variable 2 a3 Local () () Default (Integer 1 []) Source Public Required .false.), a4: (Variable 2 a4 Local () () Default (Integer 2 []) 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), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 4 complex lpython_builtin [] complex 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) (IntegerConstant 34 (Integer 4 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((Var 2 a))] (Logical 1 []) () ()) ()) (= (Var 2 a) (IntegerConstant 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 (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_0__bool 2 bool [((IntegerConstant 0 (Integer 4 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 a2) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 8 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_1__bool 2 bool [((Var 2 a2))] (Logical 1 []) () ()) ()) (= (Var 2 a3) (Cast (IntegerConstant 34 (Integer 4 [])) IntegerToInteger (Integer 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_2__bool 2 bool [((Var 2 a3))] (Logical 1 []) () ()) ()) (= (Var 2 a4) (Cast (UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) IntegerToInteger (Integer 2 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_3__bool 2 bool [((Var 2 a4))] (Logical 1 []) () ()) ()) (= (Var 2 f) (RealConstant 0.000000 (Real 8 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 f) (RealConstant 1.000000 (Real 8 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((Var 2 f))] (Logical 1 []) () ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 56.786866 (Real 8 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_5__bool 2 bool [((RealConstant 0.000000 (Real 8 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 f2) (Cast (UnaryOp USub (RealConstant 235.600000 (Real 8 [])) (Real 8 []) (RealConstant -235.600000 (Real 8 []))) RealToReal (Real 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_4__bool 2 bool [((Var 2 f2))] (Logical 1 []) () ()) ()) (= (Var 2 s) (StringConstant "" (Character 1 0 () [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 s) (StringConstant "str" (Character 1 3 () [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((Var 2 s))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((StringConstant "" (Character 1 0 () [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_6__bool 2 bool [((StringConstant "str" (Character 1 3 () [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (= (Var 2 b) (LogicalConstant .true. (Logical 1 [])) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) ()) (= (Var 2 b) (LogicalConstant .false. (Logical 1 [])) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((Var 2 b))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((LogicalConstant .true. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .true. (Logical 1 [])) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_7__bool 2 bool [((LogicalConstant .false. (Logical 1 [])))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((IntegerConstant 3 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 2.000000 3.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_8__bool 2 bool [((Var 2 c))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((BinOp (Cast (IntegerConstant 0 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 0.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) (Logical 1 []) ()) ()) (= (Var 2 c1) (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((RealConstant 0.100202 (Real 8 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.100202 (Complex 8 [])) ()) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((Var 2 c1))] (Logical 1 []) () ()) ()) (Assert (UnaryOp Not (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 0 (Integer 4 []))) ((IntegerConstant 0 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()))] (Logical 1 []) (LogicalConstant .false. (Logical 1 [])) ()) (Logical 1 []) (LogicalConstant .true. (Logical 4 []))) ()) (Assert (FunctionCall 1 bool@__lpython_overloaded_9__bool 2 bool [((BinOp (Cast (IntegerConstant 3 (Integer 4 [])) IntegerToComplex (Complex 8 []) ()) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) () ()))] (Logical 1 []) () ()) ())] Source Public Implementation () .false. .false.)}) []) diff --git a/tests/reference/ast-constants1-91cb6ff.json b/tests/reference/ast-constants1-91cb6ff.json index 25d0db8ae3..6d97ffe334 100644 --- a/tests/reference/ast-constants1-91cb6ff.json +++ b/tests/reference/ast-constants1-91cb6ff.json @@ -2,11 +2,11 @@ "basename": "ast-constants1-91cb6ff", "cmd": "lpython --show-ast --no-color {infile} -o {outfile}", "infile": "tests/constants1.py", - "infile_hash": "0353168d7f204b8ce707571434961e310c14a7714ba7ba3e87d0fbd5", + "infile_hash": "680bb6f62b6e7d58fdddc891954816cea0c25b9201576498f149849e", "outfile": null, "outfile_hash": null, "stdout": "ast-constants1-91cb6ff.stdout", - "stdout_hash": "9605dbc993b2b6f9cddd10246cbd19d850674cca0352f5310c870ec3", + "stdout_hash": "c8ef65f421b3d2ccb98c59ea04610136894722d78da454865a0c1f6b", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-constants1-91cb6ff.stdout b/tests/reference/ast-constants1-91cb6ff.stdout index 9e625bb4ae..2538d728b7 100644 --- a/tests/reference/ast-constants1-91cb6ff.stdout +++ b/tests/reference/ast-constants1-91cb6ff.stdout @@ -1 +1 @@ -(Module [(FunctionDef test_boz ([] [] [] [] [] [] []) [(AnnAssign (Name b Store) (Name str Load) () 1) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 64 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 8 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 56 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 42 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 12648430 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ())] [] () ()) (FunctionDef test_ord_chr ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name ord Load) [(ConstantStr "5" ())] []) ()) (Assign [(Name s Store)] (Call (Name chr Load) [(ConstantInt 43 ())] []) ())] [] () ()) (FunctionDef test_abs ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantInt 500 ()))] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .true. ())] []) ()) (AnnAssign (Name b Store) (Name f32 Load) () 1) (Assign [(Name b Store)] (Call (Name abs Load) [(ConstantFloat 3.450000 ())] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantFloat 5346.340000 ()))] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(Call (Name complex Load) [(ConstantFloat 3.450000 ()) (ConstantFloat 5.600000 ())] [])] []) ())] [] () ()) (FunctionDef test_len ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "this is a test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(Tuple [(ConstantStr "c" ()) (ConstantStr "b" ()) (ConstantFloat 3.400000 ())] Load) (Tuple [(ConstantStr "c" ()) (ConstantInt 3 ()) (ConstantFloat 5.600000 ())] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(List [(UnaryOp USub (ConstantInt 4 ())) (UnaryOp USub (ConstantInt 5 ())) (UnaryOp USub (ConstantInt 6 ()))] Load) (List [(UnaryOp USub (ConstantInt 1 ())) (UnaryOp USub (ConstantInt 2 ())) (UnaryOp USub (ConstantInt 3 ()))] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Set [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())])] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Dict [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] [(ConstantStr "c" ()) (ConstantStr "b" ()) (ConstantStr "c" ())])] []) ())] [] () ()) (FunctionDef test_bool ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantInt 0 ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(Call (Name complex Load) [(ConstantInt 0 ()) (ConstantInt 0 ())] [])] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "t" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantFloat 2.300000 ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ())] [] () ()) (FunctionDef test_str ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (Assign [(Name s Store)] (Call (Name str Load) [] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(UnaryOp USub (ConstantInt 4 ()))] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantFloat 5.600000 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_callable ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (AnnAssign (Name b Store) (Name i32 Load) () 1) (Assign [(Name b Store)] (ConstantInt 2 ()) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name test_len Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name b Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(ConstantStr "c" ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ())] [] () ()) (FunctionDef test_int ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i64 Load) () 1) (Assign [(Name a Store)] (Call (Name int Load) [] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(UnaryOp USub (ConstantFloat 5.000010 ()))] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .false. ())] []) ())] [] () ()) (FunctionDef test_float ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name f64 Load) () 1) (Assign [(Name a Store)] (Call (Name float Load) [] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .false. ())] []) ())] [] () ()) (FunctionDef test_divmod ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Subscript (Name tuple Load) (Tuple [(Name i32 Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (UnaryOp USub (ConstantInt 3 ()))] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 3 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 4 ()) (ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 0 ()) (ConstantInt 5 ())] []) ())] [] () ())] []) +(Module [(FunctionDef test_boz ([] [] [] [] [] [] []) [(AnnAssign (Name b Store) (Name str Load) () 1) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(ConstantInt 64 ())] []) ()) (Assign [(Name b Store)] (Call (Name bin Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 8 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(ConstantInt 56 ())] []) ()) (Assign [(Name b Store)] (Call (Name oct Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 42 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(ConstantInt 12648430 ())] []) ()) (Assign [(Name b Store)] (Call (Name hex Load) [(UnaryOp USub (ConstantInt 534 ()))] []) ())] [] () ()) (FunctionDef test_ord_chr ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name ord Load) [(ConstantStr "5" ())] []) ()) (Assign [(Name s Store)] (Call (Name chr Load) [(ConstantInt 43 ())] []) ())] [] () ()) (FunctionDef test_abs ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantInt 500 ()))] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name a Store)] (Call (Name abs Load) [(ConstantBool .true. ())] []) ()) (AnnAssign (Name b Store) (Name f32 Load) () 1) (Assign [(Name b Store)] (Call (Name abs Load) [(ConstantFloat 3.450000 ())] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(UnaryOp USub (ConstantFloat 5346.340000 ()))] []) ()) (Assign [(Name b Store)] (Call (Name abs Load) [(Call (Name complex Load) [(ConstantFloat 3.450000 ()) (ConstantFloat 5.600000 ())] [])] []) ())] [] () ()) (FunctionDef test_len ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i32 Load) () 1) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(ConstantStr "this is a test" ())] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Tuple [(Tuple [(ConstantStr "c" ()) (ConstantStr "b" ()) (ConstantFloat 3.400000 ())] Load) (Tuple [(ConstantStr "c" ()) (ConstantInt 3 ()) (ConstantFloat 5.600000 ())] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(List [(List [(UnaryOp USub (ConstantInt 4 ())) (UnaryOp USub (ConstantInt 5 ())) (UnaryOp USub (ConstantInt 6 ()))] Load) (List [(UnaryOp USub (ConstantInt 1 ())) (UnaryOp USub (ConstantInt 2 ())) (UnaryOp USub (ConstantInt 3 ()))] Load)] Load)] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Set [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())])] []) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Dict [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ())] [(ConstantStr "c" ()) (ConstantStr "b" ()) (ConstantStr "c" ())])] []) ()) (AnnAssign (Name l Store) (Subscript (Name list Load) (Name i32 Load) Load) () 1) (Assign [(Name l Store)] (List [(ConstantInt 1 ()) (ConstantInt 2 ()) (ConstantInt 3 ()) (ConstantInt 4 ())] Load) ()) (Assign [(Name a Store)] (Call (Name len Load) [(Name l Load)] []) ()) (Expr (Call (Attribute (Name l Load) append Load) [(ConstantInt 5 ())] [])) (Assign [(Name a Store)] (Call (Name len Load) [(Name l Load)] []) ())] [] () ()) (FunctionDef test_bool ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantInt 0 ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(Call (Name complex Load) [(ConstantInt 0 ()) (ConstantInt 0 ())] [])] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantStr "t" ())] []) ()) (Assign [(Name a Store)] (Call (Name bool Load) [(ConstantFloat 2.300000 ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ())] [] () ()) (FunctionDef test_str ([] [] [] [] [] [] []) [(AnnAssign (Name s Store) (Name str Load) () 1) (Assign [(Name s Store)] (Call (Name str Load) [] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(UnaryOp USub (ConstantInt 4 ()))] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantFloat 5.600000 ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantBool .false. ())] []) ()) (Assign [(Name s Store)] (Call (Name str Load) [(ConstantStr "5346" ())] []) ())] [] () ()) (FunctionDef test_callable ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name bool Load) () 1) (AnnAssign (Name b Store) (Name i32 Load) () 1) (Assign [(Name b Store)] (ConstantInt 2 ()) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name test_len Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .true. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(Name b Load)] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ()) (Assign [(Name a Store)] (Call (Name callable Load) [(ConstantStr "c" ())] []) ()) (Assert (Compare (Name a Load) Eq [(ConstantBool .false. ())]) ())] [] () ()) (FunctionDef test_int ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name i64 Load) () 1) (Assign [(Name a Store)] (Call (Name int Load) [] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(UnaryOp USub (ConstantFloat 5.000010 ()))] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name int Load) [(ConstantBool .false. ())] []) ())] [] () ()) (FunctionDef test_float ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Name f64 Load) () 1) (Assign [(Name a Store)] (Call (Name float Load) [] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantFloat 4.560000 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(UnaryOp USub (ConstantInt 1 ()))] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .true. ())] []) ()) (Assign [(Name a Store)] (Call (Name float Load) [(ConstantBool .false. ())] []) ())] [] () ()) (FunctionDef test_divmod ([] [] [] [] [] [] []) [(AnnAssign (Name a Store) (Subscript (Name tuple Load) (Tuple [(Name i32 Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 9 ()) (UnaryOp USub (ConstantInt 3 ()))] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 3 ()) (ConstantInt 3 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 4 ()) (ConstantInt 5 ())] []) ()) (Assign [(Name a Store)] (Call (Name divmod Load) [(ConstantInt 0 ()) (ConstantInt 5 ())] []) ())] [] () ())] []) From b07a4b31e998ca4f8a6081c221cd985367df9e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Wed, 27 Apr 2022 11:09:09 -0600 Subject: [PATCH 12/14] LLVM: add visit_StringLen() implementation --- src/libasr/codegen/asr_to_llvm.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libasr/codegen/asr_to_llvm.cpp b/src/libasr/codegen/asr_to_llvm.cpp index e0c5bb829e..77cf43888c 100644 --- a/src/libasr/codegen/asr_to_llvm.cpp +++ b/src/libasr/codegen/asr_to_llvm.cpp @@ -2860,6 +2860,17 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } } + void visit_StringLen(const ASR::StringLen_t &x) { + if (x.m_value) { + this->visit_expr_wrapper(x.m_value, true); + return; + } + this->visit_expr_wrapper(x.m_arg, true); + llvm::AllocaInst *parg = builder->CreateAlloca(character_type, nullptr); + builder->CreateStore(tmp, parg); + tmp = lfortran_str_len(parg); + } + void visit_BinOp(const ASR::BinOp_t &x) { if( x.m_overloaded ) { this->visit_expr(*x.m_overloaded); From 764771d64f146a84d77df44c210a94a0a0039c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Wed, 27 Apr 2022 11:13:38 -0600 Subject: [PATCH 13/14] Re-enable tests again --- integration_tests/run_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration_tests/run_tests.py b/integration_tests/run_tests.py index b7ee1291cb..7a64f5686d 100755 --- a/integration_tests/run_tests.py +++ b/integration_tests/run_tests.py @@ -26,9 +26,9 @@ "test_builtin_bool.py", "test_builtin_pow.py", "test_builtin_int.py", - # "test_builtin_len.py", + "test_builtin_len.py", "test_builtin_float.py", - # "test_builtin_str_02.py", + "test_builtin_str_02.py", "test_builtin_round.py", # "test_builtin_hex.py", # "test_builtin_oct.py", From 593b8c448a62816d8ab323481a1918c18e70694f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Wed, 27 Apr 2022 11:18:25 -0600 Subject: [PATCH 14/14] Give an error message instead of returning nullptr --- src/lpython/semantics/python_ast_to_asr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index c0df8b85d1..966ac89d8a 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -2738,7 +2738,7 @@ class BodyVisitor : public CommonVisitor { return (ASR::asr_t *)ASR::down_cast( ASR::make_DictLen_t(al, loc, arg, to_type, value)); } - return nullptr; + throw SemanticError("len() is only supported for `str`, `set`, `dict`, `list` and `tuple`", loc); } void visit_Call(const AST::Call_t &x) {