diff --git a/src/libasr/ASR.asdl b/src/libasr/ASR.asdl index 2b2edb0e60..e405568af0 100644 --- a/src/libasr/ASR.asdl +++ b/src/libasr/ASR.asdl @@ -227,13 +227,22 @@ expr | LogicalConstant(bool value, ttype type) | ListConstant(expr* args, 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, expr? value) + | TupleConstant(expr* elements, ttype type) + | TupleLen(expr arg, ttype type, expr? value) + | StringConstant(string s, ttype type) + | StringLen(expr arg, ttype type, expr? value) + | DictConstant(expr* keys, expr* values, 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 55b9696b75..d29bbb1c82 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; } @@ -270,6 +275,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::ComplexRe: { return ASR::down_cast(f)->m_value; } case ASR::exprType::ComplexIm: { return ASR::down_cast(f)->m_value; } case ASR::exprType::ArrayConstant: // Drop through @@ -280,6 +290,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/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); diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index e49e8ee118..966ac89d8a 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -2680,6 +2680,67 @@ class BodyVisitor : public CommonVisitor { return nullptr; } + 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, + 4, nullptr, 0)); + ASR::expr_t *value = nullptr; + if (ASRUtils::is_character(*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)) { + 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)) { + 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)) { + 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)) { + 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)); + } + throw SemanticError("len() is only supported for `str`, `set`, `dict`, `list` and `tuple`", loc); + } + void visit_Call(const AST::Call_t &x) { std::string call_name; Vec args; @@ -2807,6 +2868,9 @@ class BodyVisitor : public CommonVisitor { tmp = handle_intrinsic_float(al, args, x.base.base.loc); } return; + } else if (call_name == "len") { + 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", 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..3acba42c00 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -177,7 +177,6 @@ def bool(c: c32) -> bool: def bool(c: c64) -> bool: return c.real != 0.0 or _lfortran_zaimag(c) != 0.0 - @interface def len(s: str) -> i32: """ diff --git a/tests/constants1.py b/tests/constants1.py index fa0a53f9d3..9e63160838 100644 --- a/tests/constants1.py +++ b/tests/constants1.py @@ -35,13 +35,17 @@ 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"}) + 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 ee2b00c8e0..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": "0410dc29468f90206a5c2aab56a9761c8d2ffcb239de210d3df2b14f", + "infile_hash": "680bb6f62b6e7d58fdddc891954816cea0c25b9201576498f149849e", "outfile": null, "outfile_hash": null, "stdout": "asr-constants1-5828e8a.stdout", - "stdout_hash": "1c0247f92f98131fbe521af9b0e3555ad3dd5adbe8a034617bd08d86", + "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 4e1f15e4af..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_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_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_len-55b0dec.json b/tests/reference/asr-test_builtin_len-55b0dec.json index 31fd13f217..f9ad257442 100644 --- a/tests/reference/asr-test_builtin_len-55b0dec.json +++ b/tests/reference/asr-test_builtin_len-55b0dec.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_len-55b0dec.stdout", - "stdout_hash": "3bb11c9908c48b2a469c36cac5cc7219163ac291a697bd1a0ad1bd30", + "stdout_hash": "5848f4307a138db4aeb3df85134c377170b7bbbffdb4be980853260d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_len-55b0dec.stdout b/tests/reference/asr-test_builtin_len-55b0dec.stdout index 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_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/ast-constants1-91cb6ff.json b/tests/reference/ast-constants1-91cb6ff.json index 174a6f18db..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": "0410dc29468f90206a5c2aab56a9761c8d2ffcb239de210d3df2b14f", + "infile_hash": "680bb6f62b6e7d58fdddc891954816cea0c25b9201576498f149849e", "outfile": null, "outfile_hash": null, "stdout": "ast-constants1-91cb6ff.stdout", - "stdout_hash": "8deb8a82c17881db182de12815703c8c157c6fb6bb9a219b3ed28a81", + "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 1683f367a5..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" ())] []) ())] [] () ()) (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 ())] []) ())] [] () ())] [])