From dad38f94fd9b525b03346b0961af7cdc5287eb2b Mon Sep 17 00:00:00 2001 From: Prince Roshan Date: Sun, 8 Oct 2023 12:55:12 +0530 Subject: [PATCH] Clean test references --- .../reference/asr-array_01_decl-39cf894.json | 10 +- .../asr-array_01_decl-39cf894.stdout | 1043 +++++ .../reference/asr-array_02_decl-e8f6874.json | 10 +- .../asr-array_02_decl-e8f6874.stdout | 833 ++++ tests/reference/asr-arrays_01-a617b64.json | 2 +- tests/reference/asr-arrays_01-a617b64.stderr | 25 +- tests/reference/asr-arrays_02-da94458.json | 2 +- tests/reference/asr-arrays_02-da94458.stderr | 22 +- tests/reference/asr-arrays_03-de2e952.json | 2 +- tests/reference/asr-arrays_03-de2e952.stderr | 20 +- tests/reference/asr-arrays_04-880407c.json | 2 +- tests/reference/asr-arrays_04-880407c.stderr | 20 +- tests/reference/asr-arrays_05-ec8fbd5.json | 2 +- tests/reference/asr-arrays_05-ec8fbd5.stderr | 20 +- tests/reference/asr-arrays_06-fbb09a3.json | 2 +- tests/reference/asr-arrays_06-fbb09a3.stderr | 20 +- tests/reference/asr-arrays_07-de430fd.json | 2 +- tests/reference/asr-arrays_07-de430fd.stderr | 20 +- tests/reference/asr-arrays_08-ba317a3.json | 2 +- tests/reference/asr-arrays_08-ba317a3.stderr | 20 +- tests/reference/asr-arrays_09-50ee586.json | 2 +- tests/reference/asr-arrays_09-50ee586.stderr | 20 +- tests/reference/asr-arrays_10-bc82d75.json | 2 +- tests/reference/asr-arrays_10-bc82d75.stderr | 20 +- tests/reference/asr-arrays_11-fc505b4.json | 2 +- tests/reference/asr-arrays_11-fc505b4.stderr | 20 +- tests/reference/asr-arrays_12-63d6f25.json | 2 +- tests/reference/asr-arrays_12-63d6f25.stderr | 20 +- tests/reference/asr-arrays_13-b5fcc7e.json | 2 +- tests/reference/asr-arrays_13-b5fcc7e.stderr | 20 +- tests/reference/asr-arrays_14-78be00e.json | 2 +- tests/reference/asr-arrays_14-78be00e.stderr | 20 +- tests/reference/asr-bindc_02-bc1a7ea.json | 10 +- tests/reference/asr-bindc_02-bc1a7ea.stdout | 437 ++ tests/reference/asr-bindc_03-95dbba7.json | 2 +- tests/reference/asr-bindc_03-95dbba7.stderr | 20 +- tests/reference/asr-bindc_04-06bd800.json | 2 +- tests/reference/asr-bindc_04-06bd800.stderr | 22 +- tests/reference/asr-cast-435c233.json | 10 +- tests/reference/asr-cast-435c233.stdout | 312 ++ tests/reference/asr-complex1-f26c460.json | 10 +- tests/reference/asr-complex1-f26c460.stdout | 794 ++++ tests/reference/asr-constants1-5828e8a.json | 10 +- tests/reference/asr-constants1-5828e8a.stdout | 1793 ++++++++ tests/reference/asr-elemental_01-b58df26.json | 10 +- .../reference/asr-elemental_01-b58df26.stdout | 3649 +++++++++++++++++ tests/reference/asr-expr10-efcbb1b.json | 10 +- tests/reference/asr-expr10-efcbb1b.stdout | 453 ++ tests/reference/asr-expr13-81bdb5a.json | 10 +- tests/reference/asr-expr13-81bdb5a.stdout | 473 +++ tests/reference/asr-expr7-480ba2f.json | 8 +- tests/reference/asr-expr7-480ba2f.stderr | 14 +- tests/reference/asr-expr7-480ba2f.stdout | 371 ++ tests/reference/asr-expr8-6beda60.json | 10 +- tests/reference/asr-expr8-6beda60.stdout | 430 ++ tests/reference/asr-expr_05-3a37324.json | 10 +- tests/reference/asr-expr_05-3a37324.stdout | 1642 ++++++++ .../asr-generics_array_01-682b1b2.json | 10 +- .../asr-generics_array_01-682b1b2.stdout | 459 +++ .../asr-generics_array_02-22c8dc1.json | 10 +- .../asr-generics_array_02-22c8dc1.stdout | 1391 +++++++ .../asr-generics_array_03-fb3706c.json | 10 +- .../asr-generics_array_03-fb3706c.stdout | 1880 +++++++++ .../asr-kwargs_02_error-7c91f8f.json | 2 +- .../asr-kwargs_02_error-7c91f8f.stderr | 16 +- tests/reference/asr-string_02-499c9ff.json | 2 +- tests/reference/asr-string_02-499c9ff.stderr | 10 +- tests/reference/asr-structs_05-fa98307.json | 10 +- tests/reference/asr-structs_05-fa98307.stdout | 1476 +++++++ tests/reference/asr-test_assign8-4b26e63.json | 2 +- .../reference/asr-test_assign8-4b26e63.stderr | 14 +- tests/reference/asr-test_binop3-a67201d.json | 2 +- .../reference/asr-test_binop3-a67201d.stderr | 10 +- .../asr-test_bool_binop-f856ef0.json | 10 +- .../asr-test_bool_binop-f856ef0.stdout | 442 ++ .../asr-test_builtin_bin-52ba9fa.json | 10 +- .../asr-test_builtin_bin-52ba9fa.stdout | 271 ++ .../asr-test_builtin_bool-330223a.json | 10 +- .../asr-test_builtin_bool-330223a.stdout | 896 ++++ .../asr-test_builtin_hex-64bd268.json | 10 +- .../asr-test_builtin_hex-64bd268.stdout | 246 ++ .../asr-test_builtin_oct-20b9066.json | 10 +- .../asr-test_builtin_oct-20b9066.stdout | 246 ++ .../asr-test_builtin_pow-f02fcda.json | 8 +- .../asr-test_builtin_pow-f02fcda.stderr | 10 +- .../asr-test_builtin_pow-f02fcda.stdout | 1919 +++++++++ .../asr-test_builtin_round-7417a21.json | 10 +- .../asr-test_builtin_round-7417a21.stdout | 919 +++++ .../asr-test_complex_01-a6def58.json | 10 +- .../asr-test_complex_01-a6def58.stdout | 2013 +++++++++ .../asr-test_complex_02-782ba2d.json | 10 +- .../asr-test_complex_02-782ba2d.stdout | 718 ++++ tests/reference/asr-test_dict13-683b290.json | 2 +- .../reference/asr-test_dict13-683b290.stderr | 12 +- tests/reference/asr-test_max_min-3c2fc51.json | 10 +- .../reference/asr-test_max_min-3c2fc51.stdout | 814 ++++ .../reference/asr-test_numpy_03-e600a49.json | 10 +- .../asr-test_numpy_03-e600a49.stdout | 1938 +++++++++ .../reference/asr-test_numpy_04-ecbb614.json | 10 +- .../asr-test_numpy_04-ecbb614.stdout | 519 +++ tests/reference/asr-test_pow-3f5d550.json | 8 +- tests/reference/asr-test_pow-3f5d550.stderr | 10 +- tests/reference/asr-test_pow-3f5d550.stdout | 159 + tests/reference/asr-test_pow1-581ef42.json | 2 +- tests/reference/asr-test_pow1-581ef42.stderr | 14 +- tests/reference/asr-test_pow2-0dcbd7d.json | 2 +- tests/reference/asr-test_pow2-0dcbd7d.stderr | 14 +- tests/reference/asr-test_pow3-79749ed.json | 2 +- tests/reference/asr-test_pow3-79749ed.stderr | 14 +- tests/reference/asr-test_pow4-ef60978.json | 2 +- tests/reference/asr-test_pow4-ef60978.stderr | 14 +- .../asr-test_zero_division-3dd84e8.json | 2 +- .../asr-test_zero_division-3dd84e8.stderr | 4 +- .../asr-test_zero_division2-d84989f.json | 2 +- .../asr-test_zero_division2-d84989f.stderr | 4 +- tests/reference/asr-vec_01-66ac423.json | 10 +- tests/reference/asr-vec_01-66ac423.stdout | 295 ++ tests/reference/c-expr7-bb2692a.json | 8 +- tests/reference/c-expr7-bb2692a.stderr | 14 +- tests/reference/c-expr7-bb2692a.stdout | 362 ++ tests/reference/cpp-expr15-1661c0d.json | 10 +- tests/reference/cpp-expr15-1661c0d.stdout | 92 + tests/reference/cpp-expr7-529bd53.json | 8 +- tests/reference/cpp-expr7-529bd53.stderr | 14 +- tests/reference/cpp-expr7-529bd53.stdout | 83 + tests/reference/cpp-expr8-704cece.json | 10 +- tests/reference/cpp-expr8-704cece.stdout | 37 + .../cpp-test_builtin_pow-56b3f92.json | 8 +- .../cpp-test_builtin_pow-56b3f92.stderr | 10 +- .../cpp-test_builtin_pow-56b3f92.stdout | 269 ++ .../pass_loop_vectorise-vec_01-be9985e.json | 10 +- .../pass_loop_vectorise-vec_01-be9985e.stdout | 527 +++ 132 files changed, 30547 insertions(+), 583 deletions(-) create mode 100644 tests/reference/asr-array_01_decl-39cf894.stdout create mode 100644 tests/reference/asr-array_02_decl-e8f6874.stdout create mode 100644 tests/reference/asr-bindc_02-bc1a7ea.stdout create mode 100644 tests/reference/asr-cast-435c233.stdout create mode 100644 tests/reference/asr-complex1-f26c460.stdout create mode 100644 tests/reference/asr-constants1-5828e8a.stdout create mode 100644 tests/reference/asr-elemental_01-b58df26.stdout create mode 100644 tests/reference/asr-expr10-efcbb1b.stdout create mode 100644 tests/reference/asr-expr13-81bdb5a.stdout create mode 100644 tests/reference/asr-expr7-480ba2f.stdout create mode 100644 tests/reference/asr-expr8-6beda60.stdout create mode 100644 tests/reference/asr-expr_05-3a37324.stdout create mode 100644 tests/reference/asr-generics_array_01-682b1b2.stdout create mode 100644 tests/reference/asr-generics_array_02-22c8dc1.stdout create mode 100644 tests/reference/asr-generics_array_03-fb3706c.stdout create mode 100644 tests/reference/asr-structs_05-fa98307.stdout create mode 100644 tests/reference/asr-test_bool_binop-f856ef0.stdout create mode 100644 tests/reference/asr-test_builtin_bin-52ba9fa.stdout create mode 100644 tests/reference/asr-test_builtin_bool-330223a.stdout create mode 100644 tests/reference/asr-test_builtin_hex-64bd268.stdout create mode 100644 tests/reference/asr-test_builtin_oct-20b9066.stdout create mode 100644 tests/reference/asr-test_builtin_pow-f02fcda.stdout create mode 100644 tests/reference/asr-test_builtin_round-7417a21.stdout create mode 100644 tests/reference/asr-test_complex_01-a6def58.stdout create mode 100644 tests/reference/asr-test_complex_02-782ba2d.stdout create mode 100644 tests/reference/asr-test_max_min-3c2fc51.stdout create mode 100644 tests/reference/asr-test_numpy_03-e600a49.stdout create mode 100644 tests/reference/asr-test_numpy_04-ecbb614.stdout create mode 100644 tests/reference/asr-test_pow-3f5d550.stdout create mode 100644 tests/reference/asr-vec_01-66ac423.stdout create mode 100644 tests/reference/c-expr7-bb2692a.stdout create mode 100644 tests/reference/cpp-expr15-1661c0d.stdout create mode 100644 tests/reference/cpp-expr7-529bd53.stdout create mode 100644 tests/reference/cpp-expr8-704cece.stdout create mode 100644 tests/reference/cpp-test_builtin_pow-56b3f92.stdout create mode 100644 tests/reference/pass_loop_vectorise-vec_01-be9985e.stdout diff --git a/tests/reference/asr-array_01_decl-39cf894.json b/tests/reference/asr-array_01_decl-39cf894.json index b23bdaa272..6ad942e950 100644 --- a/tests/reference/asr-array_01_decl-39cf894.json +++ b/tests/reference/asr-array_01_decl-39cf894.json @@ -5,9 +5,9 @@ "infile_hash": "3dff59bab7475d254ce0470065c11e797e52a5b2a3d7546acc0e6705", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-array_01_decl-39cf894.stderr", - "stderr_hash": "5155e10cd4958bdda66178e2ed1b6faed6f415ff1cf3ff78e45f9cbb", - "returncode": 2 + "stdout": "asr-array_01_decl-39cf894.stdout", + "stdout_hash": "337d67c221f17230293b36428d0f59e687b3a1d577e9b361298e1257", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-array_01_decl-39cf894.stdout b/tests/reference/asr-array_01_decl-39cf894.stdout new file mode 100644 index 0000000000..94b5539996 --- /dev/null +++ b/tests/reference/asr-array_01_decl-39cf894.stdout @@ -0,0 +1,1043 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + ArraySizes: + (EnumType + (SymbolTable + 203 + { + SIZE_10: + (Variable + 203 + SIZE_10 + [] + Local + (IntegerConstant 10 (Integer 4)) + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + SIZE_3: + (Variable + 203 + SIZE_3 + [] + Local + (IntegerConstant 3 (Integer 4)) + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + ArraySizes + [] + [SIZE_3 + SIZE_10] + Source + Public + IntegerUnique + (Integer 4) + () + ), + __main__global_stmts: + (Function + (SymbolTable + 210 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [declare_arrays] + [] + [(SubroutineCall + 2 declare_arrays + () + [] + () + )] + () + Public + .false. + .false. + () + ), + accept_f32_array: + (Function + (SymbolTable + 207 + { + _lpython_return_variable: + (Variable + 207 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + xf32: + (Variable + 207 + xf32 + [] + InOut + () + () + Default + (Array + (Real 4) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ) + }) + accept_f32_array + (FunctionType + [(Array + (Real 4) + [(() + ())] + DescriptorArray + )] + (Real 4) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 207 xf32)] + [(= + (ArrayItem + (Var 207 xf32) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Real 4) + RowMajor + () + ) + (Cast + (RealConstant + 32.000000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 32.000000 + (Real 4) + ) + ) + () + ) + (= + (Var 207 _lpython_return_variable) + (ArrayItem + (Var 207 xf32) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Real 4) + RowMajor + () + ) + () + ) + (Return)] + (Var 207 _lpython_return_variable) + Public + .false. + .false. + () + ), + accept_f64_array: + (Function + (SymbolTable + 208 + { + _lpython_return_variable: + (Variable + 208 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + xf64: + (Variable + 208 + xf64 + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ) + }) + accept_f64_array + (FunctionType + [(Array + (Real 8) + [(() + ())] + DescriptorArray + )] + (Real 8) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 208 xf64)] + [(= + (ArrayItem + (Var 208 xf64) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Real 8) + RowMajor + () + ) + (RealConstant + 64.000000 + (Real 8) + ) + () + ) + (= + (Var 208 _lpython_return_variable) + (ArrayItem + (Var 208 xf64) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Real 8) + RowMajor + () + ) + () + ) + (Return)] + (Var 208 _lpython_return_variable) + Public + .false. + .false. + () + ), + accept_i16_array: + (Function + (SymbolTable + 204 + { + _lpython_return_variable: + (Variable + 204 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Integer 2) + () + Source + Public + Required + .false. + ), + xi16: + (Variable + 204 + xi16 + [] + InOut + () + () + Default + (Array + (Integer 2) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ) + }) + accept_i16_array + (FunctionType + [(Array + (Integer 2) + [(() + ())] + DescriptorArray + )] + (Integer 2) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 204 xi16)] + [(= + (ArrayItem + (Var 204 xi16) + [(() + (IntegerConstant 2 (Integer 4)) + ())] + (Integer 2) + RowMajor + () + ) + (Cast + (IntegerConstant 32 (Integer 4)) + IntegerToInteger + (Integer 2) + (IntegerConstant 32 (Integer 2)) + ) + () + ) + (= + (Var 204 _lpython_return_variable) + (ArrayItem + (Var 204 xi16) + [(() + (IntegerConstant 2 (Integer 4)) + ())] + (Integer 2) + RowMajor + () + ) + () + ) + (Return)] + (Var 204 _lpython_return_variable) + Public + .false. + .false. + () + ), + accept_i32_array: + (Function + (SymbolTable + 205 + { + _lpython_return_variable: + (Variable + 205 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + xi32: + (Variable + 205 + xi32 + [] + InOut + () + () + Default + (Array + (Integer 4) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ) + }) + accept_i32_array + (FunctionType + [(Array + (Integer 4) + [(() + ())] + DescriptorArray + )] + (Integer 4) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 205 xi32)] + [(= + (ArrayItem + (Var 205 xi32) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 32 (Integer 4)) + () + ) + (= + (Var 205 _lpython_return_variable) + (ArrayItem + (Var 205 xi32) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + () + ) + (Return)] + (Var 205 _lpython_return_variable) + Public + .false. + .false. + () + ), + accept_i64_array: + (Function + (SymbolTable + 206 + { + _lpython_return_variable: + (Variable + 206 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ), + xi64: + (Variable + 206 + xi64 + [] + InOut + () + () + Default + (Array + (Integer 8) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ) + }) + accept_i64_array + (FunctionType + [(Array + (Integer 8) + [(() + ())] + DescriptorArray + )] + (Integer 8) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 206 xi64)] + [(= + (ArrayItem + (Var 206 xi64) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Integer 8) + RowMajor + () + ) + (Cast + (IntegerConstant 64 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 64 (Integer 8)) + ) + () + ) + (= + (Var 206 _lpython_return_variable) + (ArrayItem + (Var 206 xi64) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Integer 8) + RowMajor + () + ) + () + ) + (Return)] + (Var 206 _lpython_return_variable) + Public + .false. + .false. + () + ), + declare_arrays: + (Function + (SymbolTable + 209 + { + ac32: + (Variable + 209 + ac32 + [] + Local + () + () + Default + (Array + (Complex 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + ac64: + (Variable + 209 + ac64 + [] + Local + () + () + Default + (Array + (Complex 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + af32: + (Variable + 209 + af32 + [] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + af64: + (Variable + 209 + af64 + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + ai16: + (Variable + 209 + ai16 + [] + Local + () + () + Default + (Array + (Integer 2) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + ai32: + (Variable + 209 + ai32 + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + ai64: + (Variable + 209 + ai64 + [] + Local + () + () + Default + (Array + (Integer 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ) + }) + declare_arrays + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [accept_i16_array + accept_i32_array + accept_i64_array + accept_f32_array + accept_f64_array] + [] + [(= + (Var 209 ai16) + (ArrayConstant + [] + (Array + (Integer 2) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 209 ai32) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 209 ai64) + (ArrayConstant + [] + (Array + (Integer 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 209 af32) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 209 af64) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 209 ac32) + (ArrayConstant + [] + (Array + (Complex 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 209 ac64) + (ArrayConstant + [] + (Array + (Complex 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (Print + () + [(FunctionCall + 2 accept_i16_array + () + [((ArrayPhysicalCast + (Var 209 ai16) + FixedSizeArray + DescriptorArray + (Array + (Integer 2) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + DescriptorArray + ) + () + ))] + (Integer 2) + () + () + )] + () + () + ) + (Print + () + [(FunctionCall + 2 accept_i32_array + () + [((ArrayPhysicalCast + (Var 209 ai32) + FixedSizeArray + DescriptorArray + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + DescriptorArray + ) + () + ))] + (Integer 4) + () + () + )] + () + () + ) + (Print + () + [(FunctionCall + 2 accept_i64_array + () + [((ArrayPhysicalCast + (Var 209 ai64) + FixedSizeArray + DescriptorArray + (Array + (Integer 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4)))] + DescriptorArray + ) + () + ))] + (Integer 8) + () + () + )] + () + () + ) + (Print + () + [(FunctionCall + 2 accept_f32_array + () + [((ArrayPhysicalCast + (Var 209 af32) + FixedSizeArray + DescriptorArray + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + DescriptorArray + ) + () + ))] + (Real 4) + () + () + )] + () + () + ) + (Print + () + [(FunctionCall + 2 accept_f64_array + () + [((ArrayPhysicalCast + (Var 209 af64) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4)))] + DescriptorArray + ) + () + ))] + (Real 8) + () + () + )] + () + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [numpy] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 211 + { + __main__global_stmts: + (ExternalSymbol + 211 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 211 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ), + numpy: + (Module numpy) + }) + [] +) diff --git a/tests/reference/asr-array_02_decl-e8f6874.json b/tests/reference/asr-array_02_decl-e8f6874.json index f59af233fa..fc84f3cbee 100644 --- a/tests/reference/asr-array_02_decl-e8f6874.json +++ b/tests/reference/asr-array_02_decl-e8f6874.json @@ -5,9 +5,9 @@ "infile_hash": "9a398864499c7a3b4e2a480faf3a5dccaa65f9771a8de27f55f11ca4", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-array_02_decl-e8f6874.stderr", - "stderr_hash": "b9fd331511456947bef74d5df2f292244e7fa1861ab43918a6e02acd", - "returncode": 2 + "stdout": "asr-array_02_decl-e8f6874.stdout", + "stdout_hash": "dba6ce6693793b0b40b3c7d2687ab8fed7eeca07ef25c8d7698470b8", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-array_02_decl-e8f6874.stdout b/tests/reference/asr-array_02_decl-e8f6874.stdout new file mode 100644 index 0000000000..12139962ed --- /dev/null +++ b/tests/reference/asr-array_02_decl-e8f6874.stdout @@ -0,0 +1,833 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 208 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [declare_arrays] + [] + [(SubroutineCall + 2 declare_arrays + () + [] + () + )] + () + Public + .false. + .false. + () + ), + accept_multidim_f32_array: + (Function + (SymbolTable + 205 + { + _lpython_return_variable: + (Variable + 205 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + xf32: + (Variable + 205 + xf32 + [] + InOut + () + () + Default + (Array + (Real 4) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ) + }) + accept_multidim_f32_array + (FunctionType + [(Array + (Real 4) + [(() + ())] + DescriptorArray + )] + (Real 4) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 205 xf32)] + [(= + (Var 205 _lpython_return_variable) + (ArrayItem + (Var 205 xf32) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Real 4) + RowMajor + () + ) + () + ) + (Return)] + (Var 205 _lpython_return_variable) + Public + .false. + .false. + () + ), + accept_multidim_f64_array: + (Function + (SymbolTable + 206 + { + _lpython_return_variable: + (Variable + 206 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + xf64: + (Variable + 206 + xf64 + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ()) + (() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ) + }) + accept_multidim_f64_array + (FunctionType + [(Array + (Real 8) + [(() + ()) + (() + ())] + DescriptorArray + )] + (Real 8) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 206 xf64)] + [(= + (Var 206 _lpython_return_variable) + (ArrayItem + (Var 206 xf64) + [(() + (IntegerConstant 0 (Integer 4)) + ()) + (() + (IntegerConstant 1 (Integer 4)) + ())] + (Real 8) + RowMajor + () + ) + () + ) + (Return)] + (Var 206 _lpython_return_variable) + Public + .false. + .false. + () + ), + accept_multidim_i32_array: + (Function + (SymbolTable + 203 + { + _lpython_return_variable: + (Variable + 203 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + xi32: + (Variable + 203 + xi32 + [] + InOut + () + () + Default + (Array + (Integer 4) + [(() + ()) + (() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ) + }) + accept_multidim_i32_array + (FunctionType + [(Array + (Integer 4) + [(() + ()) + (() + ())] + DescriptorArray + )] + (Integer 4) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 203 xi32)] + [(= + (Var 203 _lpython_return_variable) + (ArrayItem + (Var 203 xi32) + [(() + (IntegerConstant 0 (Integer 4)) + ()) + (() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + () + ) + (Return)] + (Var 203 _lpython_return_variable) + Public + .false. + .false. + () + ), + accept_multidim_i64_array: + (Function + (SymbolTable + 204 + { + _lpython_return_variable: + (Variable + 204 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ), + xi64: + (Variable + 204 + xi64 + [] + InOut + () + () + Default + (Array + (Integer 8) + [(() + ()) + (() + ()) + (() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ) + }) + accept_multidim_i64_array + (FunctionType + [(Array + (Integer 8) + [(() + ()) + (() + ()) + (() + ())] + DescriptorArray + )] + (Integer 8) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 204 xi64)] + [(= + (Var 204 _lpython_return_variable) + (ArrayItem + (Var 204 xi64) + [(() + (IntegerConstant 9 (Integer 4)) + ()) + (() + (IntegerConstant 9 (Integer 4)) + ()) + (() + (IntegerConstant 9 (Integer 4)) + ())] + (Integer 8) + RowMajor + () + ) + () + ) + (Return)] + (Var 204 _lpython_return_variable) + Public + .false. + .false. + () + ), + declare_arrays: + (Function + (SymbolTable + 207 + { + ac32: + (Variable + 207 + ac32 + [] + Local + () + () + Default + (Array + (Complex 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 5 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 99 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + ac64: + (Variable + 207 + ac64 + [] + Local + () + () + Default + (Array + (Complex 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 13 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 11 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + af32: + (Variable + 207 + af32 + [] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + af64: + (Variable + 207 + af64 + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + ai32: + (Variable + 207 + ai32 + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + ai64: + (Variable + 207 + ai64 + [] + Local + () + () + Default + (Array + (Integer 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ) + }) + declare_arrays + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [accept_multidim_i32_array + accept_multidim_i64_array + accept_multidim_f32_array + accept_multidim_f64_array] + [] + [(= + (Var 207 ai32) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 207 ai64) + (ArrayConstant + [] + (Array + (Integer 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 207 af32) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 207 af64) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 207 ac32) + (ArrayConstant + [] + (Array + (Complex 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 5 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 99 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 207 ac64) + (ArrayConstant + [] + (Array + (Complex 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 13 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 11 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (Print + () + [(FunctionCall + 2 accept_multidim_i32_array + () + [((ArrayPhysicalCast + (Var 207 ai32) + FixedSizeArray + DescriptorArray + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + DescriptorArray + ) + () + ))] + (Integer 4) + () + () + )] + () + () + ) + (Print + () + [(FunctionCall + 2 accept_multidim_i64_array + () + [((ArrayPhysicalCast + (Var 207 ai64) + FixedSizeArray + DescriptorArray + (Array + (Integer 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4)))] + DescriptorArray + ) + () + ))] + (Integer 8) + () + () + )] + () + () + ) + (Print + () + [(FunctionCall + 2 accept_multidim_f32_array + () + [((ArrayPhysicalCast + (Var 207 af32) + FixedSizeArray + DescriptorArray + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + DescriptorArray + ) + () + ))] + (Real 4) + () + () + )] + () + () + ) + (Print + () + [(FunctionCall + 2 accept_multidim_f64_array + () + [((ArrayPhysicalCast + (Var 207 af64) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 10 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4 (Integer 4)))] + DescriptorArray + ) + () + ))] + (Real 8) + () + () + )] + () + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [numpy] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 209 + { + __main__global_stmts: + (ExternalSymbol + 209 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 209 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ), + numpy: + (Module numpy) + }) + [] +) diff --git a/tests/reference/asr-arrays_01-a617b64.json b/tests/reference/asr-arrays_01-a617b64.json index ca8f874250..45a1b7310d 100644 --- a/tests/reference/asr-arrays_01-a617b64.json +++ b/tests/reference/asr-arrays_01-a617b64.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_01-a617b64.stderr", - "stderr_hash": "ddb2640e06012a8ab9efe1bc1dbe130321fb96721ce3fd749813c988", + "stderr_hash": "b8317c7306f747ceefa8557c06f2a0b4a8a4bd7ae805bb494fca6ef2", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_01-a617b64.stderr b/tests/reference/asr-arrays_01-a617b64.stderr index e712ee9cf1..4fa39a8c3c 100644 --- a/tests/reference/asr-arrays_01-a617b64.stderr +++ b/tests/reference/asr-arrays_01-a617b64.stderr @@ -1,17 +1,8 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_01.py:2:1 - | -2 | from numpy import empty, int8 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: Type mismatch in procedure call; the types must be compatible + --> tests/errors/arrays_01.py:15:9 + | +15 | [i8(214), i8(157), i8(3), i8(146)]) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch (passed argument type is list[i8] but required type is i8[4]) + | + 9 | a : i8[4] = empty(4, dtype=int8) + | ^^^^^ type mismatch (passed argument type is list[i8] but required type is i8[4]) diff --git a/tests/reference/asr-arrays_02-da94458.json b/tests/reference/asr-arrays_02-da94458.json index 2dfc6c7f7c..37de52ba40 100644 --- a/tests/reference/asr-arrays_02-da94458.json +++ b/tests/reference/asr-arrays_02-da94458.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_02-da94458.stderr", - "stderr_hash": "b7b907310495016dfb487fccb13739865174dda44541ade08931bae9", + "stderr_hash": "dc0e5be7cd6de7395421aedf1ce11977206f3e35bb7cba271aed8992", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_02-da94458.stderr b/tests/reference/asr-arrays_02-da94458.stderr index 5229403208..295e0c9b28 100644 --- a/tests/reference/asr-arrays_02-da94458.stderr +++ b/tests/reference/asr-arrays_02-da94458.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_02.py:2:1 - | -2 | from numpy import (empty, int8) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() + --> tests/errors/arrays_02.py:28:8 + | +28 | assert r1.a == t1.a + | ^^^^^^^^^^^^ diff --git a/tests/reference/asr-arrays_03-de2e952.json b/tests/reference/asr-arrays_03-de2e952.json index 77b002c31e..1583b11b63 100644 --- a/tests/reference/asr-arrays_03-de2e952.json +++ b/tests/reference/asr-arrays_03-de2e952.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_03-de2e952.stderr", - "stderr_hash": "ddfa8ceea3cb39c9b59069d2a67d13c8752ec2511fc62c162e77b206", + "stderr_hash": "4c932f31bbb10c9ba8d8d75be226ba9c33553be3bcb367c8112e31af", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_03-de2e952.stderr b/tests/reference/asr-arrays_03-de2e952.stderr index 00df208054..1fb5635502 100644 --- a/tests/reference/asr-arrays_03-de2e952.stderr +++ b/tests/reference/asr-arrays_03-de2e952.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_03.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_03.py:6:5 | -2 | from numpy import empty, int16 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | x: i16[4] = empty([5], dtype=int16) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[4]' and 'i16[5]') diff --git a/tests/reference/asr-arrays_04-880407c.json b/tests/reference/asr-arrays_04-880407c.json index 69bda74cc5..1c5077a22c 100644 --- a/tests/reference/asr-arrays_04-880407c.json +++ b/tests/reference/asr-arrays_04-880407c.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_04-880407c.stderr", - "stderr_hash": "ee2a3d13e91567e2924e0154d6c09db79923debe4c2733b246964808", + "stderr_hash": "10ef155b0236096d5de8157e38b3989d99343b016a8153b68a36aa54", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_04-880407c.stderr b/tests/reference/asr-arrays_04-880407c.stderr index 692cb026bf..5cb27a1cb7 100644 --- a/tests/reference/asr-arrays_04-880407c.stderr +++ b/tests/reference/asr-arrays_04-880407c.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_04.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_04.py:6:5 | -2 | from numpy import empty, int32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | x: i16[5] = empty([5], dtype=int32) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5]' and 'i32[5]') diff --git a/tests/reference/asr-arrays_05-ec8fbd5.json b/tests/reference/asr-arrays_05-ec8fbd5.json index 8ff8c5a20d..a4302b38e0 100644 --- a/tests/reference/asr-arrays_05-ec8fbd5.json +++ b/tests/reference/asr-arrays_05-ec8fbd5.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_05-ec8fbd5.stderr", - "stderr_hash": "066b86f582348bb519b6a39a7e7421ac5a666b29d9ef96d753be0207", + "stderr_hash": "4e5d42a186b8d82b484ec66ccc5a3b90da7e4be8a32bac26ea906198", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_05-ec8fbd5.stderr b/tests/reference/asr-arrays_05-ec8fbd5.stderr index ee5cc62302..165aee29a8 100644 --- a/tests/reference/asr-arrays_05-ec8fbd5.stderr +++ b/tests/reference/asr-arrays_05-ec8fbd5.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_05.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_05.py:6:5 | -2 | from numpy import empty, int16 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | x: i16[5, 4] = empty([5, 3], dtype=int16) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5,4]' and 'i16[5,3]') diff --git a/tests/reference/asr-arrays_06-fbb09a3.json b/tests/reference/asr-arrays_06-fbb09a3.json index 8c473166fc..863eeebf1e 100644 --- a/tests/reference/asr-arrays_06-fbb09a3.json +++ b/tests/reference/asr-arrays_06-fbb09a3.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_06-fbb09a3.stderr", - "stderr_hash": "529c8dc2333a83b0b67feb5db104ea294258fdcac341dad9e314cfee", + "stderr_hash": "1fa3f5061a72f03c0678806c0460b9ec5caf01cbbd2f07a606f1057e", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_06-fbb09a3.stderr b/tests/reference/asr-arrays_06-fbb09a3.stderr index 8d8b27a690..9bbcde8ee8 100644 --- a/tests/reference/asr-arrays_06-fbb09a3.stderr +++ b/tests/reference/asr-arrays_06-fbb09a3.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_06.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_06.py:6:5 | -2 | from numpy import empty, int32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | x: i16[5, 4] = empty([5, 4], dtype=int32) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5,4]' and 'i32[5,4]') diff --git a/tests/reference/asr-arrays_07-de430fd.json b/tests/reference/asr-arrays_07-de430fd.json index a3c5bfc680..19a44750cc 100644 --- a/tests/reference/asr-arrays_07-de430fd.json +++ b/tests/reference/asr-arrays_07-de430fd.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_07-de430fd.stderr", - "stderr_hash": "78a96ca7fbcae19b8cdaa9f9a2d18de003d7569070edb855bd07bff6", + "stderr_hash": "7fadea44b4ad8f383e0cadbd27a53eb3ab75f0edef98d27639527723", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_07-de430fd.stderr b/tests/reference/asr-arrays_07-de430fd.stderr index f5f3ff9143..7624d1fe92 100644 --- a/tests/reference/asr-arrays_07-de430fd.stderr +++ b/tests/reference/asr-arrays_07-de430fd.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_07.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_07.py:6:5 | -2 | from numpy import empty, complex64 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | x: f32[5, 4] = empty([5, 4], dtype=complex64) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('f32[5,4]' and 'c32[5,4]') diff --git a/tests/reference/asr-arrays_08-ba317a3.json b/tests/reference/asr-arrays_08-ba317a3.json index 068d21e7d1..56982fe195 100644 --- a/tests/reference/asr-arrays_08-ba317a3.json +++ b/tests/reference/asr-arrays_08-ba317a3.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_08-ba317a3.stderr", - "stderr_hash": "2c0dffd29d0f996f1403e49241e6fe1cfbf7df0ce479e4434c3a7c6a", + "stderr_hash": "bedb87b219b7c49a18cced170e4ffcac780d242f70c3ae8bbfb27a26", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_08-ba317a3.stderr b/tests/reference/asr-arrays_08-ba317a3.stderr index d5aad26c5b..e8f8eb441e 100644 --- a/tests/reference/asr-arrays_08-ba317a3.stderr +++ b/tests/reference/asr-arrays_08-ba317a3.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_08.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_08.py:9:5 | -2 | from numpy import empty, int64 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +9 | x: i64[p, q, r] = empty([q, p, r], dtype=int64) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i64[100,120,200]' and 'i64[120,100,200]') diff --git a/tests/reference/asr-arrays_09-50ee586.json b/tests/reference/asr-arrays_09-50ee586.json index 1180b9b694..fa9b9de0df 100644 --- a/tests/reference/asr-arrays_09-50ee586.json +++ b/tests/reference/asr-arrays_09-50ee586.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_09-50ee586.stderr", - "stderr_hash": "31ae490ebcebebc570a4846a32f1723dd3e9861f47c6805e9cc5e9b4", + "stderr_hash": "30bfc87e70c4b4688cf7162eec34dce8e52c959539d20ad8b79cf845", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_09-50ee586.stderr b/tests/reference/asr-arrays_09-50ee586.stderr index efb877322b..58147a840d 100644 --- a/tests/reference/asr-arrays_09-50ee586.stderr +++ b/tests/reference/asr-arrays_09-50ee586.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_09.py:2:1 +semantic error: Only those local variables which can be reduced to compile time constant should be used in dimensions of an array. + --> tests/errors/arrays_09.py:9:12 | -2 | from numpy import empty, int64 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +9 | x: i64[p, q, r] = empty([q, p, r], dtype=int64) + | ^ diff --git a/tests/reference/asr-arrays_10-bc82d75.json b/tests/reference/asr-arrays_10-bc82d75.json index 8125d1c0f8..4599fd95cf 100644 --- a/tests/reference/asr-arrays_10-bc82d75.json +++ b/tests/reference/asr-arrays_10-bc82d75.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_10-bc82d75.stderr", - "stderr_hash": "12434839db5b4ef953cdf8002472348be5b31f95ed106f68c6646523", + "stderr_hash": "59e8cc91d7dae61bf60ec4d9cd23d62cdcb162e553bd64a3995fad19", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_10-bc82d75.stderr b/tests/reference/asr-arrays_10-bc82d75.stderr index af28c4fcb3..7935120aa7 100644 --- a/tests/reference/asr-arrays_10-bc82d75.stderr +++ b/tests/reference/asr-arrays_10-bc82d75.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_10.py:2:1 +semantic error: Only those local variables which can be reduced to compile time constant should be used in dimensions of an array. + --> tests/errors/arrays_10.py:9:36 | -2 | from numpy import empty, int64 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +9 | x: i64[100, 120, 200] = empty([q, p, r], dtype=int64) + | ^ diff --git a/tests/reference/asr-arrays_11-fc505b4.json b/tests/reference/asr-arrays_11-fc505b4.json index 31cf31d842..22700cace0 100644 --- a/tests/reference/asr-arrays_11-fc505b4.json +++ b/tests/reference/asr-arrays_11-fc505b4.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_11-fc505b4.stderr", - "stderr_hash": "f5a3fde8bbd2fd083b1f1d2148c92c3ae71ef4aaaed74e725061cb94", + "stderr_hash": "ef5e89392b20ad345ba9bcf862ab71b19e56c85d9838db742be117a1", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_11-fc505b4.stderr b/tests/reference/asr-arrays_11-fc505b4.stderr index 1fd700c7b4..09cb02b625 100644 --- a/tests/reference/asr-arrays_11-fc505b4.stderr +++ b/tests/reference/asr-arrays_11-fc505b4.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_11.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_11.py:5:1 | -2 | from numpy import empty, int16 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +5 | x: i16[4] = empty([5], dtype=int16) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[4]' and 'i16[5]') diff --git a/tests/reference/asr-arrays_12-63d6f25.json b/tests/reference/asr-arrays_12-63d6f25.json index 4f456715f5..a032a5fad1 100644 --- a/tests/reference/asr-arrays_12-63d6f25.json +++ b/tests/reference/asr-arrays_12-63d6f25.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_12-63d6f25.stderr", - "stderr_hash": "28d115256d1f8e36fdce5f2192e17e06c4b6daaa2166ece7bed3947c", + "stderr_hash": "b6fa626301868bd5cbbef6d914f5b4f38b1d896b951753122969e74a", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_12-63d6f25.stderr b/tests/reference/asr-arrays_12-63d6f25.stderr index 4dc8ec210c..8000ae521d 100644 --- a/tests/reference/asr-arrays_12-63d6f25.stderr +++ b/tests/reference/asr-arrays_12-63d6f25.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_12.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_12.py:5:1 | -2 | from numpy import empty, int32 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +5 | x: i16[5] = empty([5], dtype=int32) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[5]' and 'i32[5]') diff --git a/tests/reference/asr-arrays_13-b5fcc7e.json b/tests/reference/asr-arrays_13-b5fcc7e.json index d2c834ff6a..3a17697702 100644 --- a/tests/reference/asr-arrays_13-b5fcc7e.json +++ b/tests/reference/asr-arrays_13-b5fcc7e.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_13-b5fcc7e.stderr", - "stderr_hash": "684ced8828de6debbd6d46dd706f9bbb993e8c85b22b656583c3a077", + "stderr_hash": "6bde2f7fc14d5a461a58d694e44e19dd79ef5bee47c88b4022daf5d6", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_13-b5fcc7e.stderr b/tests/reference/asr-arrays_13-b5fcc7e.stderr index 1533a34f7a..14f0dbe414 100644 --- a/tests/reference/asr-arrays_13-b5fcc7e.stderr +++ b/tests/reference/asr-arrays_13-b5fcc7e.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_13.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_13.py:7:5 | -2 | from numpy import empty, int16 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +7 | x: i16[4] = empty(5, dtype=int16) + | ^ ^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[4]' and 'i16[5]') diff --git a/tests/reference/asr-arrays_14-78be00e.json b/tests/reference/asr-arrays_14-78be00e.json index 9a235f1984..b41704e4d0 100644 --- a/tests/reference/asr-arrays_14-78be00e.json +++ b/tests/reference/asr-arrays_14-78be00e.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-arrays_14-78be00e.stderr", - "stderr_hash": "3539282cce2d83675ca57e47d093800765d28c5b74a04eb46457f715", + "stderr_hash": "267aea8e48708230a9b2bc61c37c849a0b75cb45294ca25ee11fe632", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-arrays_14-78be00e.stderr b/tests/reference/asr-arrays_14-78be00e.stderr index 14bdfe6421..ed7f661811 100644 --- a/tests/reference/asr-arrays_14-78be00e.stderr +++ b/tests/reference/asr-arrays_14-78be00e.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/arrays_14.py:2:1 +semantic error: Type mismatch in annotation-assignment, the types must be compatible + --> tests/errors/arrays_14.py:7:5 | -2 | from numpy import empty, int16 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +7 | x: i16[4] = empty((5), dtype=int16) + | ^ ^^^^^^^^^^^^^^^^^^^^^^^ type mismatch ('i16[4]' and 'i16[5]') diff --git a/tests/reference/asr-bindc_02-bc1a7ea.json b/tests/reference/asr-bindc_02-bc1a7ea.json index b8abd26275..3dd0941a7d 100644 --- a/tests/reference/asr-bindc_02-bc1a7ea.json +++ b/tests/reference/asr-bindc_02-bc1a7ea.json @@ -5,9 +5,9 @@ "infile_hash": "a29f0f269c494419077ca8725e7c2d2dc7a5b4964d5c909347f1caa4", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-bindc_02-bc1a7ea.stderr", - "stderr_hash": "f35a1e2233396c7620436bb77c9e617e33e60fb9c92da2552280ed2c", - "returncode": 2 + "stdout": "asr-bindc_02-bc1a7ea.stdout", + "stdout_hash": "cbf9ef32b1f268bbf7b766822c2b8f7efe9053d8d72525035a5079d5", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-bindc_02-bc1a7ea.stdout b/tests/reference/asr-bindc_02-bc1a7ea.stdout new file mode 100644 index 0000000000..a3df6dd08a --- /dev/null +++ b/tests/reference/asr-bindc_02-bc1a7ea.stdout @@ -0,0 +1,437 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 204 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [f] + [] + [(CPtrToPointer + (Var 2 queries) + (Var 2 x) + (ArrayConstant + [(IntegerConstant 1 (Integer 4))] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + PointerToDataArray + ) + RowMajor + ) + (ArrayConstant + [(IntegerConstant 0 (Integer 4))] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + PointerToDataArray + ) + RowMajor + ) + ) + (Print + () + [(Var 2 queries) + (Var 2 x)] + () + () + ) + (SubroutineCall + 2 f + () + [] + () + )] + () + Public + .false. + .false. + () + ), + f: + (Function + (SymbolTable + 203 + { + y: + (Variable + 203 + y + [] + Local + () + () + Default + (Array + (Integer 2) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 2 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + yptr1: + (Variable + 203 + yptr1 + [] + Local + () + () + Default + (Pointer + (Array + (Integer 2) + [(() + ())] + DescriptorArray + ) + ) + () + Source + Public + Required + .false. + ), + yq: + (Variable + 203 + yq + [] + Local + () + () + Default + (CPtr) + () + Source + Public + Required + .false. + ) + }) + f + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 203 yq) + (PointerNullConstant + (CPtr) + ) + () + ) + (= + (Var 203 y) + (ArrayConstant + [] + (Array + (Integer 2) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 2 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 203 y) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 2) + RowMajor + () + ) + (Cast + (IntegerConstant 1 (Integer 4)) + IntegerToInteger + (Integer 2) + (IntegerConstant 1 (Integer 2)) + ) + () + ) + (= + (ArrayItem + (Var 203 y) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Integer 2) + RowMajor + () + ) + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToInteger + (Integer 2) + (IntegerConstant 2 (Integer 2)) + ) + () + ) + (= + (Var 203 yptr1) + (GetPointer + (Var 203 y) + (Pointer + (Array + (Integer 2) + [(() + ())] + DescriptorArray + ) + ) + () + ) + () + ) + (Print + () + [(GetPointer + (Var 203 y) + (Pointer + (Array + (Integer 2) + [(() + ())] + DescriptorArray + ) + ) + () + ) + (Var 203 yptr1)] + () + () + ) + (Print + () + [(ArrayItem + (Var 203 yptr1) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 2) + RowMajor + () + ) + (ArrayItem + (Var 203 yptr1) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Integer 2) + RowMajor + () + )] + () + () + ) + (Assert + (IntegerCompare + (ArrayItem + (Var 203 yptr1) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 2) + RowMajor + () + ) + Eq + (Cast + (IntegerConstant 1 (Integer 4)) + IntegerToInteger + (Integer 2) + (IntegerConstant 1 (Integer 2)) + ) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (ArrayItem + (Var 203 yptr1) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Integer 2) + RowMajor + () + ) + Eq + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToInteger + (Integer 2) + (IntegerConstant 2 (Integer 2)) + ) + (Logical 4) + () + ) + () + ) + (CPtrToPointer + (Var 203 yq) + (Var 203 yptr1) + (ArrayConstant + [(IntegerConstant 2 (Integer 4))] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + PointerToDataArray + ) + RowMajor + ) + (ArrayConstant + [(IntegerConstant 0 (Integer 4))] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + PointerToDataArray + ) + RowMajor + ) + ) + (Print + () + [(Var 203 yq) + (Var 203 yptr1)] + () + () + )] + () + Public + .false. + .false. + () + ), + queries: + (Variable + 2 + queries + [] + Local + (PointerNullConstant + (CPtr) + ) + (PointerNullConstant + (CPtr) + ) + Default + (CPtr) + () + Source + Public + Required + .false. + ), + x: + (Variable + 2 + x + [] + Local + () + () + Default + (Pointer + (Array + (Integer 2) + [(() + ())] + DescriptorArray + ) + ) + () + Source + Public + Required + .false. + ) + }) + __main__ + [numpy] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 205 + { + __main__global_stmts: + (ExternalSymbol + 205 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 205 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ), + numpy: + (Module numpy) + }) + [] +) diff --git a/tests/reference/asr-bindc_03-95dbba7.json b/tests/reference/asr-bindc_03-95dbba7.json index fa55114a3e..7ea004cc34 100644 --- a/tests/reference/asr-bindc_03-95dbba7.json +++ b/tests/reference/asr-bindc_03-95dbba7.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-bindc_03-95dbba7.stderr", - "stderr_hash": "9225af71c044978cc3832abb4a60a5d13f6d143a8c4dc219e930eab9", + "stderr_hash": "371c3fc384c0e72448648d5a3734a373fe96ba258b261f0695ccb518", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-bindc_03-95dbba7.stderr b/tests/reference/asr-bindc_03-95dbba7.stderr index 98e9a26f07..ae2b810b6c 100644 --- a/tests/reference/asr-bindc_03-95dbba7.stderr +++ b/tests/reference/asr-bindc_03-95dbba7.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/bindc_03.py:3:1 +semantic error: Target type specified in c_p_pointer must have deferred shape. + --> tests/errors/bindc_03.py:6:26 | -3 | from numpy import array - | ^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | A: Pointer[i16[:]] = c_p_pointer(b, i16[n * k], array([k * n])) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/reference/asr-bindc_04-06bd800.json b/tests/reference/asr-bindc_04-06bd800.json index a19d71962d..4772e98aa9 100644 --- a/tests/reference/asr-bindc_04-06bd800.json +++ b/tests/reference/asr-bindc_04-06bd800.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-bindc_04-06bd800.stderr", - "stderr_hash": "6aa8aa05ae2628d04b771044165e1c9078ba3c5ae211906def3ff0be", + "stderr_hash": "20c105d0189cd06a197a6b1dda073a58f5c8ee0104230cf187960c46", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-bindc_04-06bd800.stderr b/tests/reference/asr-bindc_04-06bd800.stderr index 704b35ab47..1a05ab5e55 100644 --- a/tests/reference/asr-bindc_04-06bd800.stderr +++ b/tests/reference/asr-bindc_04-06bd800.stderr @@ -1,17 +1,5 @@ -warning: The module 'numpy' located in $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py cannot be loaded - --> tests/errors/bindc_04.py:2:1 - | -2 | from numpy import empty, int16 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ imported here - -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> $DIR/src/bin/../runtime/lpython_intrinsic_numpy.py:364:12 - | -364 | return x1 % x2 - | ^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: Only those local variables which can be reduced to compile time constant should be used in dimensions of an array. + --> tests/errors/bindc_04.py:20:12 + | +20 | C: i16[nk] = empty(nk, dtype=int16) + | ^^ diff --git a/tests/reference/asr-cast-435c233.json b/tests/reference/asr-cast-435c233.json index 8614194075..60ceb3c6dd 100644 --- a/tests/reference/asr-cast-435c233.json +++ b/tests/reference/asr-cast-435c233.json @@ -5,9 +5,9 @@ "infile_hash": "6e4219b25f4aa2035b57c9658dbb133f2dff55db0d9c128b19214f62", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-cast-435c233.stderr", - "stderr_hash": "94b3ddb64aab37aa358cd260252df21698826606401d00e07c873603", - "returncode": 2 + "stdout": "asr-cast-435c233.stdout", + "stdout_hash": "58fc6550fcc3f8ac88859c3ad8f16640ddbd112d9a9b46a3faa379dd", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-cast-435c233.stdout b/tests/reference/asr-cast-435c233.stdout new file mode 100644 index 0000000000..9b07bd686a --- /dev/null +++ b/tests/reference/asr-cast-435c233.stdout @@ -0,0 +1,312 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 121 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [f] + [] + [(SubroutineCall + 2 f + () + [] + () + )] + () + Public + .false. + .false. + () + ), + f: + (Function + (SymbolTable + 3 + { + list: + (ExternalSymbol + 3 + list + 4 list + lpython_builtin + [] + list + Private + ), + s: + (Variable + 3 + s + [] + Local + () + () + Default + (Character 1 -2 ()) + () + Source + Public + Required + .false. + ), + x: + (Variable + 3 + x + [] + Local + () + () + Default + (List + (Character 1 -2 ()) + ) + () + Source + Public + Required + .false. + ), + y: + (Variable + 3 + y + [] + Local + () + () + Default + (List + (Character 1 -2 ()) + ) + () + Source + Public + Required + .false. + ) + }) + f + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [list] + [] + [(= + (Var 3 s) + (StringConstant + "lpython" + (Character 1 7 ()) + ) + () + ) + (= + (Var 3 x) + (FunctionCall + 3 list + () + [((Var 3 s))] + (List + (Character 1 -2 ()) + ) + () + () + ) + () + ) + (= + (Var 3 y) + (ListConstant + [(StringConstant + "a" + (Character 1 1 ()) + ) + (StringConstant + "b" + (Character 1 1 ()) + ) + (StringConstant + "c" + (Character 1 1 ()) + )] + (List + (Character 1 1 ()) + ) + ) + () + ) + (= + (Var 3 x) + (FunctionCall + 3 list + () + [((Var 3 y))] + (List + (Character 1 -2 ()) + ) + () + () + ) + () + ) + (= + (Var 3 x) + (ListConstant + [] + (List + (Character 1 -2 ()) + ) + ) + () + ) + (= + (Var 3 x) + (FunctionCall + 3 list + () + [((ListConstant + [] + (List + (Character 1 -2 ()) + ) + ))] + (List + (Character 1 -2 ()) + ) + (ListConstant + [] + (List + (Character 1 -2 ()) + ) + ) + () + ) + () + ) + (= + (Var 3 x) + (FunctionCall + 3 list + () + [((StringConstant + "lpython" + (Character 1 7 ()) + ))] + (List + (Character 1 -2 ()) + ) + (ListConstant + [(StringConstant + "l" + (Character 1 1 ()) + ) + (StringConstant + "p" + (Character 1 1 ()) + ) + (StringConstant + "y" + (Character 1 1 ()) + ) + (StringConstant + "t" + (Character 1 1 ()) + ) + (StringConstant + "h" + (Character 1 1 ()) + ) + (StringConstant + "o" + (Character 1 1 ()) + ) + (StringConstant + "n" + (Character 1 1 ()) + )] + (List + (Character 1 1 ()) + ) + ) + () + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 122 + { + __main__global_stmts: + (ExternalSymbol + 122 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 122 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-complex1-f26c460.json b/tests/reference/asr-complex1-f26c460.json index 2eb40d0cd8..dd3e51b43f 100644 --- a/tests/reference/asr-complex1-f26c460.json +++ b/tests/reference/asr-complex1-f26c460.json @@ -5,9 +5,9 @@ "infile_hash": "60b45de7b88ec768d70a3122b36545e9604a86504ed6e5d9d813c719", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-complex1-f26c460.stderr", - "stderr_hash": "850f4cbe87b0a7ae8138fbfb71f94b82843abf09e50752159f900292", - "returncode": 2 + "stdout": "asr-complex1-f26c460.stdout", + "stdout_hash": "d2492faf2c4817c79e63e63c41265783d5cc209b149ea27019480440", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-complex1-f26c460.stdout b/tests/reference/asr-complex1-f26c460.stdout new file mode 100644 index 0000000000..cd78fe3416 --- /dev/null +++ b/tests/reference/asr-complex1-f26c460.stdout @@ -0,0 +1,794 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + test: + (Function + (SymbolTable + 4 + { + x: + (Variable + 4 + x + [] + Local + () + () + Default + (Complex 8) + () + Source + Public + Required + .false. + ), + y: + (Variable + 4 + y + [] + Local + () + () + Default + (Complex 8) + () + Source + Public + Required + .false. + ), + z: + (Variable + 4 + z + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ) + }) + test + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 4 x) + (ComplexBinOp + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToComplex + (Complex 8) + (ComplexConstant + 2.000000 + 0.000000 + (Complex 8) + ) + ) + Add + (ComplexConstant + 0.000000 + 3.000000 + (Complex 8) + ) + (Complex 8) + (ComplexConstant + 2.000000 + 3.000000 + (Complex 8) + ) + ) + () + ) + (= + (Var 4 y) + (ComplexBinOp + (Cast + (IntegerConstant 5 (Integer 4)) + IntegerToComplex + (Complex 8) + (ComplexConstant + 5.000000 + 0.000000 + (Complex 8) + ) + ) + Add + (ComplexConstant + 0.000000 + 5.000000 + (Complex 8) + ) + (Complex 8) + (ComplexConstant + 5.000000 + 5.000000 + (Complex 8) + ) + ) + () + ) + (= + (Var 4 z) + (Cast + (ComplexBinOp + (Var 4 x) + Add + (Var 4 y) + (Complex 8) + () + ) + ComplexToComplex + (Complex 4) + () + ) + () + ) + (= + (Var 4 z) + (Cast + (ComplexBinOp + (Var 4 x) + Sub + (Var 4 y) + (Complex 8) + () + ) + ComplexToComplex + (Complex 4) + () + ) + () + ) + (= + (Var 4 z) + (Cast + (ComplexBinOp + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToComplex + (Complex 8) + (ComplexConstant + 2.000000 + 0.000000 + (Complex 8) + ) + ) + Mul + (Var 4 x) + (Complex 8) + () + ) + ComplexToComplex + (Complex 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_complex: + (Function + (SymbolTable + 3 + { + b: + (Variable + 3 + b + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + c: + (Variable + 3 + c + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ), + c1: + (Variable + 3 + c1 + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ), + c2: + (Variable + 3 + c2 + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ), + c3: + (Variable + 3 + c3 + [] + Local + () + () + Default + (Complex 8) + () + Source + Public + Required + .false. + ), + complex: + (ExternalSymbol + 3 + complex + 5 complex + lpython_builtin + [] + complex + Private + ), + complex@__lpython_overloaded_0__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_0__complex + 5 __lpython_overloaded_0__complex + lpython_builtin + [] + __lpython_overloaded_0__complex + Public + ), + complex@__lpython_overloaded_13__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_13__complex + 5 __lpython_overloaded_13__complex + lpython_builtin + [] + __lpython_overloaded_13__complex + Public + ), + complex@__lpython_overloaded_1__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_1__complex + 5 __lpython_overloaded_1__complex + lpython_builtin + [] + __lpython_overloaded_1__complex + Public + ), + complex@__lpython_overloaded_2__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_2__complex + 5 __lpython_overloaded_2__complex + lpython_builtin + [] + __lpython_overloaded_2__complex + Public + ), + complex@__lpython_overloaded_5__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_5__complex + 5 __lpython_overloaded_5__complex + lpython_builtin + [] + __lpython_overloaded_5__complex + Public + ), + complex@__lpython_overloaded_9__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_9__complex + 5 __lpython_overloaded_9__complex + lpython_builtin + [] + __lpython_overloaded_9__complex + Public + ) + }) + test_complex + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [complex@__lpython_overloaded_0__complex + complex@__lpython_overloaded_1__complex + complex@__lpython_overloaded_5__complex + complex@__lpython_overloaded_2__complex + complex@__lpython_overloaded_9__complex + complex@__lpython_overloaded_13__complex] + [] + [(= + (Var 3 c) + (Cast + (FunctionCall + 3 complex@__lpython_overloaded_0__complex + 3 complex + [] + (Complex 8) + (ComplexConstant + 0.000000 + 0.000000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 0.000000 + 0.000000 + (Complex 4) + ) + ) + () + ) + (= + (Var 3 c) + (Cast + (FunctionCall + 3 complex@__lpython_overloaded_1__complex + 3 complex + [((RealConstant + 3.400000 + (Real 8) + ))] + (Complex 8) + (ComplexConstant + 3.400000 + 0.000000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 3.400000 + 0.000000 + (Complex 4) + ) + ) + () + ) + (= + (Var 3 c) + (Cast + (FunctionCall + 3 complex@__lpython_overloaded_5__complex + 3 complex + [((RealConstant + 5.000000 + (Real 8) + )) + ((RealConstant + 4.300000 + (Real 8) + ))] + (Complex 8) + (ComplexConstant + 5.000000 + 4.300000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 5.000000 + 4.300000 + (Complex 4) + ) + ) + () + ) + (= + (Var 3 c) + (FunctionCall + 3 complex@__lpython_overloaded_2__complex + 3 complex + [((IntegerConstant 1 (Integer 4)))] + (Complex 4) + (ComplexConstant + 1.000000 + 0.000000 + (Complex 8) + ) + () + ) + () + ) + (= + (Var 3 c1) + (Cast + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 complex + [((IntegerConstant 3 (Integer 4))) + ((IntegerConstant 4 (Integer 4)))] + (Complex 8) + (ComplexConstant + 3.000000 + 4.000000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 3.000000 + 4.000000 + (Complex 4) + ) + ) + () + ) + (= + (Var 3 c2) + (Cast + (FunctionCall + 3 complex@__lpython_overloaded_13__complex + 3 complex + [((IntegerConstant 2 (Integer 4))) + ((RealConstant + 4.500000 + (Real 8) + ))] + (Complex 8) + (ComplexConstant + 2.000000 + 4.500000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 2.000000 + 4.500000 + (Complex 4) + ) + ) + () + ) + (= + (Var 3 c3) + (FunctionCall + 3 complex@__lpython_overloaded_5__complex + 3 complex + [((RealConstant + 3.000000 + (Real 8) + )) + ((RealConstant + 4.000000 + (Real 8) + ))] + (Complex 8) + (ComplexConstant + 3.000000 + 4.000000 + (Complex 8) + ) + () + ) + () + ) + (= + (Var 3 b) + (ComplexCompare + (Var 3 c1) + NotEq + (Var 3 c2) + (Logical 4) + () + ) + () + ) + (= + (Var 3 b) + (ComplexCompare + (Cast + (Var 3 c1) + ComplexToComplex + (Complex 8) + () + ) + Eq + (Var 3 c3) + (Logical 4) + () + ) + () + ) + (= + (Var 3 c) + (ComplexBinOp + (Var 3 c1) + Add + (Var 3 c2) + (Complex 4) + () + ) + () + ) + (= + (Var 3 c) + (ComplexBinOp + (Var 3 c2) + Sub + (Var 3 c1) + (Complex 4) + () + ) + () + ) + (= + (Var 3 c) + (ComplexBinOp + (Var 3 c1) + Mul + (Var 3 c2) + (Complex 4) + () + ) + () + ) + (= + (Var 3 c) + (Cast + (ComplexBinOp + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 complex + [((IntegerConstant 1 (Integer 4))) + ((IntegerConstant 2 (Integer 4)))] + (Complex 8) + (ComplexConstant + 1.000000 + 2.000000 + (Complex 8) + ) + () + ) + Pow + (FunctionCall + 3 complex@__lpython_overloaded_5__complex + 3 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) + (ComplexConstant + 0.015553 + 0.065561 + (Complex 4) + ) + ) + () + ) + (= + (Var 3 c) + (Cast + (ComplexBinOp + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 complex + [((IntegerConstant 1 (Integer 4))) + ((IntegerConstant 2 (Integer 4)))] + (Complex 8) + (ComplexConstant + 1.000000 + 2.000000 + (Complex 8) + ) + () + ) + Mul + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 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) + (ComplexConstant + -5.000000 + 10.000000 + (Complex 4) + ) + ) + () + ) + (= + (Var 3 c) + (Cast + (ComplexBinOp + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 complex + [((IntegerConstant 4 (Integer 4))) + ((IntegerConstant 5 (Integer 4)))] + (Complex 8) + (ComplexConstant + 4.000000 + 5.000000 + (Complex 8) + ) + () + ) + Sub + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 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) + (ComplexConstant + 1.000000 + 1.000000 + (Complex 4) + ) + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 122 + { + + }) + main_program + [] + [] + ) + }) + [] +) diff --git a/tests/reference/asr-constants1-5828e8a.json b/tests/reference/asr-constants1-5828e8a.json index 5abb75edfe..dfe88ebc86 100644 --- a/tests/reference/asr-constants1-5828e8a.json +++ b/tests/reference/asr-constants1-5828e8a.json @@ -5,9 +5,9 @@ "infile_hash": "5dca391c30a1477fb903e17c1d47dad3b9b816088384ba61ff372db1", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-constants1-5828e8a.stderr", - "stderr_hash": "ebf1574a4c5a5194ffa967d7e3a768aad6fe823a3eae7b48b0ea46f2", - "returncode": 2 + "stdout": "asr-constants1-5828e8a.stdout", + "stdout_hash": "427b04cc81be4dc077b8804718659bbe1c1d1fd74b493e5a2ae78c48", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-constants1-5828e8a.stdout b/tests/reference/asr-constants1-5828e8a.stdout new file mode 100644 index 0000000000..086a712f13 --- /dev/null +++ b/tests/reference/asr-constants1-5828e8a.stdout @@ -0,0 +1,1793 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + test_abs: + (Function + (SymbolTable + 5 + { + a: + (Variable + 5 + a + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + b: + (Variable + 5 + b + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + complex: + (ExternalSymbol + 5 + complex + 13 complex + lpython_builtin + [] + complex + Private + ), + complex@__lpython_overloaded_5__complex: + (ExternalSymbol + 5 + complex@__lpython_overloaded_5__complex + 13 __lpython_overloaded_5__complex + lpython_builtin + [] + __lpython_overloaded_5__complex + Public + ) + }) + test_abs + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [complex@__lpython_overloaded_5__complex] + [] + [(= + (Var 5 a) + (IntrinsicScalarFunction + Abs + [(IntegerConstant 5 (Integer 4))] + 0 + (Integer 4) + (IntegerConstant 5 (Integer 4)) + ) + () + ) + (= + (Var 5 a) + (IntrinsicScalarFunction + Abs + [(IntegerUnaryMinus + (IntegerConstant 500 (Integer 4)) + (Integer 4) + (IntegerConstant -500 (Integer 4)) + )] + 0 + (Integer 4) + (IntegerConstant 500 (Integer 4)) + ) + () + ) + (= + (Var 5 a) + (IntrinsicScalarFunction + Abs + [(Cast + (LogicalConstant + .false. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + )] + 0 + (Integer 4) + () + ) + () + ) + (= + (Var 5 a) + (IntrinsicScalarFunction + Abs + [(Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + )] + 0 + (Integer 4) + () + ) + () + ) + (= + (Var 5 b) + (Cast + (IntrinsicScalarFunction + Abs + [(RealConstant + 3.450000 + (Real 8) + )] + 0 + (Real 8) + (RealConstant + 3.450000 + (Real 8) + ) + ) + RealToReal + (Real 4) + (RealConstant + 3.450000 + (Real 4) + ) + ) + () + ) + (= + (Var 5 b) + (Cast + (IntrinsicScalarFunction + Abs + [(RealUnaryMinus + (RealConstant + 5346.340000 + (Real 8) + ) + (Real 8) + (RealConstant + -5346.340000 + (Real 8) + ) + )] + 0 + (Real 8) + (RealConstant + 5346.340000 + (Real 8) + ) + ) + RealToReal + (Real 4) + (RealConstant + 5346.340000 + (Real 4) + ) + ) + () + ) + (= + (Var 5 b) + (Cast + (IntrinsicScalarFunction + Abs + [(FunctionCall + 5 complex@__lpython_overloaded_5__complex + 5 complex + [((RealConstant + 3.450000 + (Real 8) + )) + ((RealConstant + 5.600000 + (Real 8) + ))] + (Complex 8) + (ComplexConstant + 3.450000 + 5.600000 + (Complex 8) + ) + () + )] + 0 + (Real 8) + (RealConstant + 6.577424 + (Real 8) + ) + ) + RealToReal + (Real 4) + (RealConstant + 6.577424 + (Real 4) + ) + ) + () + )] + () + Public + .false. + .false. + () + ), + test_bool: + (Function + (SymbolTable + 7 + { + a: + (Variable + 7 + a + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + complex: + (ExternalSymbol + 7 + complex + 13 complex + lpython_builtin + [] + complex + Private + ), + complex@__lpython_overloaded_9__complex: + (ExternalSymbol + 7 + complex@__lpython_overloaded_9__complex + 13 __lpython_overloaded_9__complex + lpython_builtin + [] + __lpython_overloaded_9__complex + Public + ) + }) + test_bool + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [complex@__lpython_overloaded_9__complex] + [] + [(= + (Var 7 a) + (Cast + (IntegerConstant 0 (Integer 4)) + IntegerToLogical + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + () + ) + (= + (Var 7 a) + (Cast + (IntegerUnaryMinus + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant -1 (Integer 4)) + ) + IntegerToLogical + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 7 a) + (Cast + (StringConstant + "" + (Character 1 0 ()) + ) + CharacterToLogical + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + () + ) + (= + (Var 7 a) + (Cast + (FunctionCall + 7 complex@__lpython_overloaded_9__complex + 7 complex + [((IntegerConstant 0 (Integer 4))) + ((IntegerConstant 0 (Integer 4)))] + (Complex 8) + (ComplexConstant + 0.000000 + 0.000000 + (Complex 8) + ) + () + ) + ComplexToLogical + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + () + ) + (Assert + (LogicalCompare + (Var 7 a) + Eq + (LogicalConstant + .false. + (Logical 4) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 7 a) + (Cast + (StringConstant + "t" + (Character 1 1 ()) + ) + CharacterToLogical + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 7 a) + (Cast + (RealConstant + 2.300000 + (Real 8) + ) + RealToLogical + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (LogicalCompare + (Var 7 a) + Eq + (LogicalConstant + .true. + (Logical 4) + ) + (Logical 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_boz: + (Function + (SymbolTable + 3 + { + b: + (Variable + 3 + b + [] + Local + () + () + Default + (Character 1 -2 ()) + () + Source + Public + Required + .false. + ), + bin: + (ExternalSymbol + 3 + bin + 13 bin + lpython_builtin + [] + bin + Private + ), + hex: + (ExternalSymbol + 3 + hex + 13 hex + lpython_builtin + [] + hex + Private + ), + oct: + (ExternalSymbol + 3 + oct + 13 oct + lpython_builtin + [] + oct + Private + ) + }) + test_boz + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [bin + oct + hex] + [] + [(= + (Var 3 b) + (FunctionCall + 3 bin + () + [((IntegerConstant 5 (Integer 4)))] + (Character 1 -2 ()) + (StringConstant + "0b101" + (Character 1 5 ()) + ) + () + ) + () + ) + (= + (Var 3 b) + (FunctionCall + 3 bin + () + [((IntegerConstant 64 (Integer 4)))] + (Character 1 -2 ()) + (StringConstant + "0b1000000" + (Character 1 9 ()) + ) + () + ) + () + ) + (= + (Var 3 b) + (FunctionCall + 3 bin + () + [((IntegerUnaryMinus + (IntegerConstant 534 (Integer 4)) + (Integer 4) + (IntegerConstant -534 (Integer 4)) + ))] + (Character 1 -2 ()) + (StringConstant + "-0b1000010110" + (Character 1 13 ()) + ) + () + ) + () + ) + (= + (Var 3 b) + (FunctionCall + 3 oct + () + [((IntegerConstant 8 (Integer 4)))] + (Character 1 -2 ()) + (StringConstant + "0o10" + (Character 1 4 ()) + ) + () + ) + () + ) + (= + (Var 3 b) + (FunctionCall + 3 oct + () + [((IntegerConstant 56 (Integer 4)))] + (Character 1 -2 ()) + (StringConstant + "0o70" + (Character 1 4 ()) + ) + () + ) + () + ) + (= + (Var 3 b) + (FunctionCall + 3 oct + () + [((IntegerUnaryMinus + (IntegerConstant 534 (Integer 4)) + (Integer 4) + (IntegerConstant -534 (Integer 4)) + ))] + (Character 1 -2 ()) + (StringConstant + "-0o1026" + (Character 1 7 ()) + ) + () + ) + () + ) + (= + (Var 3 b) + (FunctionCall + 3 hex + () + [((IntegerConstant 42 (Integer 4)))] + (Character 1 -2 ()) + (StringConstant + "0x2a" + (Character 1 4 ()) + ) + () + ) + () + ) + (= + (Var 3 b) + (FunctionCall + 3 hex + () + [((IntegerConstant 12648430 (Integer 4)))] + (Character 1 -2 ()) + (StringConstant + "0xc0ffee" + (Character 1 8 ()) + ) + () + ) + () + ) + (= + (Var 3 b) + (FunctionCall + 3 hex + () + [((IntegerUnaryMinus + (IntegerConstant 534 (Integer 4)) + (Integer 4) + (IntegerConstant -534 (Integer 4)) + ))] + (Character 1 -2 ()) + (StringConstant + "-0x216" + (Character 1 6 ()) + ) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_callable: + (Function + (SymbolTable + 9 + { + a: + (Variable + 9 + a + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + b: + (Variable + 9 + b + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + test_callable + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 9 b) + (IntegerConstant 2 (Integer 4)) + () + ) + (= + (Var 9 a) + (LogicalConstant + .true. + (Logical 4) + ) + () + ) + (Assert + (LogicalCompare + (Var 9 a) + Eq + (LogicalConstant + .true. + (Logical 4) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 9 a) + (LogicalConstant + .false. + (Logical 4) + ) + () + ) + (Assert + (LogicalCompare + (Var 9 a) + Eq + (LogicalConstant + .false. + (Logical 4) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 9 a) + (LogicalConstant + .false. + (Logical 4) + ) + () + ) + (Assert + (LogicalCompare + (Var 9 a) + Eq + (LogicalConstant + .false. + (Logical 4) + ) + (Logical 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_divmod: + (Function + (SymbolTable + 12 + { + a: + (Variable + 12 + a + [] + Local + () + () + Default + (Tuple + [(Integer 4) + (Integer 4)] + ) + () + Source + Public + Required + .false. + ), + divmod: + (ExternalSymbol + 12 + divmod + 13 divmod + lpython_builtin + [] + divmod + Private + ) + }) + test_divmod + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [divmod] + [] + [(= + (Var 12 a) + (FunctionCall + 12 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 12 a) + (FunctionCall + 12 divmod + () + [((IntegerConstant 9 (Integer 4))) + ((IntegerUnaryMinus + (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 12 a) + (FunctionCall + 12 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 12 a) + (FunctionCall + 12 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 12 a) + (FunctionCall + 12 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)] + ) + ) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_float: + (Function + (SymbolTable + 11 + { + a: + (Variable + 11 + a + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ) + }) + test_float + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 11 a) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (= + (Var 11 a) + (RealConstant + 4.560000 + (Real 8) + ) + () + ) + (= + (Var 11 a) + (Cast + (IntegerConstant 5 (Integer 4)) + IntegerToReal + (Real 8) + (RealConstant + 5.000000 + (Real 8) + ) + ) + () + ) + (= + (Var 11 a) + (Cast + (IntegerUnaryMinus + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant -1 (Integer 4)) + ) + IntegerToReal + (Real 8) + (RealConstant + -1.000000 + (Real 8) + ) + ) + () + ) + (= + (Var 11 a) + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToReal + (Real 8) + (RealConstant + 1.000000 + (Real 8) + ) + ) + () + ) + (= + (Var 11 a) + (Cast + (LogicalConstant + .false. + (Logical 4) + ) + LogicalToReal + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + () + )] + () + Public + .false. + .false. + () + ), + test_int: + (Function + (SymbolTable + 10 + { + a: + (Variable + 10 + a + [] + Local + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ) + }) + test_int + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 10 a) + (IntegerConstant 0 (Integer 8)) + () + ) + (= + (Var 10 a) + (Cast + (RealConstant + 4.560000 + (Real 8) + ) + RealToInteger + (Integer 8) + (IntegerConstant 4 (Integer 8)) + ) + () + ) + (= + (Var 10 a) + (Cast + (IntegerConstant 5 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 5 (Integer 8)) + ) + () + ) + (= + (Var 10 a) + (Cast + (RealUnaryMinus + (RealConstant + 5.000010 + (Real 8) + ) + (Real 8) + (RealConstant + -5.000010 + (Real 8) + ) + ) + RealToInteger + (Integer 8) + (IntegerConstant -5 (Integer 8)) + ) + () + ) + (= + (Var 10 a) + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 8) + (IntegerConstant 1 (Integer 8)) + ) + () + ) + (= + (Var 10 a) + (Cast + (LogicalConstant + .false. + (Logical 4) + ) + LogicalToInteger + (Integer 8) + (IntegerConstant 0 (Integer 8)) + ) + () + ) + (= + (Var 10 a) + (IntegerConstant 5346 (Integer 8)) + () + )] + () + Public + .false. + .false. + () + ), + test_len: + (Function + (SymbolTable + 6 + { + a: + (Variable + 6 + a + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + l: + (Variable + 6 + l + [] + Local + () + () + Default + (List + (Integer 4) + ) + () + Source + Public + Required + .false. + ) + }) + test_len + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 6 a) + (StringLen + (StringConstant + "" + (Character 1 0 ()) + ) + (Integer 4) + (IntegerConstant 0 (Integer 4)) + ) + () + ) + (= + (Var 6 a) + (StringLen + (StringConstant + "test" + (Character 1 4 ()) + ) + (Integer 4) + (IntegerConstant 4 (Integer 4)) + ) + () + ) + (= + (Var 6 a) + (StringLen + (StringConstant + "this is a test" + (Character 1 14 ()) + ) + (Integer 4) + (IntegerConstant 14 (Integer 4)) + ) + () + ) + (= + (Var 6 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 6 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 6 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 6 a) + (ListLen + (ListConstant + [(ListConstant + [(IntegerUnaryMinus + (IntegerConstant 4 (Integer 4)) + (Integer 4) + (IntegerConstant -4 (Integer 4)) + ) + (IntegerUnaryMinus + (IntegerConstant 5 (Integer 4)) + (Integer 4) + (IntegerConstant -5 (Integer 4)) + ) + (IntegerUnaryMinus + (IntegerConstant 6 (Integer 4)) + (Integer 4) + (IntegerConstant -6 (Integer 4)) + )] + (List + (Integer 4) + ) + ) + (ListConstant + [(IntegerUnaryMinus + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant -1 (Integer 4)) + ) + (IntegerUnaryMinus + (IntegerConstant 2 (Integer 4)) + (Integer 4) + (IntegerConstant -2 (Integer 4)) + ) + (IntegerUnaryMinus + (IntegerConstant 3 (Integer 4)) + (Integer 4) + (IntegerConstant -3 (Integer 4)) + )] + (List + (Integer 4) + ) + )] + (List + (List + (Integer 4) + ) + ) + ) + (Integer 4) + (IntegerConstant 2 (Integer 4)) + ) + () + ) + (= + (Var 6 a) + (SetLen + (SetConstant + [(IntegerConstant 1 (Integer 4)) + (IntegerConstant 2 (Integer 4)) + (IntegerConstant 3 (Integer 4))] + (Set + (Integer 4) + ) + ) + (Integer 4) + () + ) + () + ) + (= + (Var 6 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) + () + ) + () + ) + (= + (Var 6 l) + (ListConstant + [(IntegerConstant 1 (Integer 4)) + (IntegerConstant 2 (Integer 4)) + (IntegerConstant 3 (Integer 4)) + (IntegerConstant 4 (Integer 4))] + (List + (Integer 4) + ) + ) + () + ) + (= + (Var 6 a) + (ListLen + (Var 6 l) + (Integer 4) + () + ) + () + ) + (ListAppend + (Var 6 l) + (IntegerConstant 5 (Integer 4)) + ) + (= + (Var 6 a) + (ListLen + (Var 6 l) + (Integer 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_ord_chr: + (Function + (SymbolTable + 4 + { + a: + (Variable + 4 + a + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + s: + (Variable + 4 + s + [] + Local + () + () + Default + (Character 1 -2 ()) + () + Source + Public + Required + .false. + ) + }) + test_ord_chr + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 4 a) + (StringOrd + (StringConstant + "5" + (Character 1 1 ()) + ) + (Integer 4) + (IntegerConstant 53 (Integer 4)) + ) + () + ) + (= + (Var 4 s) + (StringChr + (IntegerConstant 43 (Integer 4)) + (Character 1 1 ()) + (StringConstant + "+" + (Character 1 1 ()) + ) + ) + () + )] + () + Public + .false. + .false. + () + ), + test_str: + (Function + (SymbolTable + 8 + { + s: + (Variable + 8 + s + [] + Local + () + () + Default + (Character 1 -2 ()) + () + Source + Public + Required + .false. + ) + }) + test_str + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 8 s) + (StringConstant + "" + (Character 1 0 ()) + ) + () + ) + (= + (Var 8 s) + (Cast + (IntegerConstant 5 (Integer 4)) + IntegerToCharacter + (Character 1 -2 ()) + (StringConstant + "5" + (Character 1 1 ()) + ) + ) + () + ) + (= + (Var 8 s) + (Cast + (IntegerUnaryMinus + (IntegerConstant 4 (Integer 4)) + (Integer 4) + (IntegerConstant -4 (Integer 4)) + ) + IntegerToCharacter + (Character 1 -2 ()) + (StringConstant + "-4" + (Character 1 2 ()) + ) + ) + () + ) + (= + (Var 8 s) + (Cast + (RealConstant + 5.600000 + (Real 8) + ) + RealToCharacter + (Character 1 -2 ()) + (StringConstant + "5.6" + (Character 1 3 ()) + ) + ) + () + ) + (= + (Var 8 s) + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToCharacter + (Character 1 -2 ()) + (StringConstant + "True" + (Character 1 4 ()) + ) + ) + () + ) + (= + (Var 8 s) + (Cast + (LogicalConstant + .false. + (Logical 4) + ) + LogicalToCharacter + (Character 1 -2 ()) + (StringConstant + "False" + (Character 1 5 ()) + ) + ) + () + ) + (= + (Var 8 s) + (StringConstant + "5346" + (Character 1 4 ()) + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 130 + { + + }) + main_program + [] + [] + ) + }) + [] +) diff --git a/tests/reference/asr-elemental_01-b58df26.json b/tests/reference/asr-elemental_01-b58df26.json index 91ad0f8c5d..d953b2745f 100644 --- a/tests/reference/asr-elemental_01-b58df26.json +++ b/tests/reference/asr-elemental_01-b58df26.json @@ -5,9 +5,9 @@ "infile_hash": "1d1eb8ce26df5817c1e474e4f69b0b96e53df362a31f1b722efaadf0", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-elemental_01-b58df26.stderr", - "stderr_hash": "cd10f41e485a55b944782ec55b168ba07907570bc9c92869d02f705e", - "returncode": 2 + "stdout": "asr-elemental_01-b58df26.stdout", + "stdout_hash": "28d02afc6512eee1834c7812fa9bf1674ea63364aba882cb533cf9da", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-elemental_01-b58df26.stdout b/tests/reference/asr-elemental_01-b58df26.stdout new file mode 100644 index 0000000000..92f7fa55b7 --- /dev/null +++ b/tests/reference/asr-elemental_01-b58df26.stdout @@ -0,0 +1,3649 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 236 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [elemental_sin + elemental_cos + elemental_trig_identity + elemental_sum + elemental_mul] + [] + [(SubroutineCall + 2 elemental_sin + () + [] + () + ) + (SubroutineCall + 2 elemental_cos + () + [] + () + ) + (SubroutineCall + 2 elemental_trig_identity + () + [] + () + ) + (SubroutineCall + 2 elemental_sum + () + [] + () + ) + (SubroutineCall + 2 elemental_mul + () + [] + () + )] + () + Public + .false. + .false. + () + ), + cos: + (ExternalSymbol + 2 + cos + 3 cos + numpy + [] + cos + Public + ), + elemental_cos: + (Function + (SymbolTable + 211 + { + array2d: + (Variable + 211 + array2d + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + cos2d: + (Variable + 211 + cos2d + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + cos@__lpython_overloaded_0__cos: + (ExternalSymbol + 211 + cos@__lpython_overloaded_0__cos + 3 __lpython_overloaded_0__cos + numpy + [] + __lpython_overloaded_0__cos + Public + ), + i: + (Variable + 211 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 211 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + elemental_cos + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [cos@__lpython_overloaded_0__cos + verify2d] + [] + [(= + (Var 211 array2d) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 211 cos2d) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 211 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 256 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 255 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 211 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 64 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 63 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 211 array2d) + [(() + (Var 211 i) + ()) + (() + (Var 211 j) + ())] + (Real 8) + RowMajor + () + ) + (Cast + (IntegerBinOp + (Var 211 i) + Add + (Var 211 j) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + () + )] + )] + ) + (= + (Var 211 cos2d) + (RealBinOp + (FunctionCall + 211 cos@__lpython_overloaded_0__cos + 2 cos + [((Var 211 array2d))] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4)))] + FixedSizeArray + ) + () + () + ) + Pow + (RealConstant + 2.000000 + (Real 8) + ) + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4)))] + FixedSizeArray + ) + () + ) + () + ) + (SubroutineCall + 2 verify2d + () + [((ArrayPhysicalCast + (Var 211 array2d) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4)))] + DescriptorArray + ) + () + )) + ((ArrayPhysicalCast + (Var 211 cos2d) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4)))] + DescriptorArray + ) + () + )) + ((IntegerConstant 256 (Integer 4))) + ((IntegerConstant 64 (Integer 4)))] + () + )] + () + Public + .false. + .false. + () + ), + elemental_mul: + (Function + (SymbolTable + 209 + { + array_a: + (Variable + 209 + array_a + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + array_b: + (Variable + 209 + array_b + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + array_c: + (Variable + 209 + array_c + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 209 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 209 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + k: + (Variable + 209 + k + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + elemental_mul + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [verify1d_mul] + [] + [(= + (Var 209 array_a) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 209 array_b) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 209 array_c) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 209 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 100 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 99 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 209 array_a) + [(() + (Var 209 i) + ())] + (Real 8) + RowMajor + () + ) + (Cast + (Var 209 i) + IntegerToReal + (Real 8) + () + ) + () + )] + ) + (DoLoop + () + ((Var 209 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 100 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 99 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 209 array_b) + [(() + (Var 209 j) + ())] + (Real 8) + RowMajor + () + ) + (Cast + (IntegerBinOp + (Var 209 j) + Add + (IntegerConstant 5 (Integer 4)) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + () + )] + ) + (= + (Var 209 array_c) + (RealBinOp + (RealBinOp + (RealBinOp + (Var 209 array_a) + Pow + (RealConstant + 2.000000 + (Real 8) + ) + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + ) + Mul + (RealConstant + 5.000000 + (Real 8) + ) + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + ) + Mul + (RealBinOp + (Var 209 array_b) + Pow + (RealConstant + 3.000000 + (Real 8) + ) + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + ) + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + ) + () + ) + (SubroutineCall + 2 verify1d_mul + () + [((ArrayPhysicalCast + (Var 209 array_a) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + DescriptorArray + ) + () + )) + ((ArrayPhysicalCast + (Var 209 array_b) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + DescriptorArray + ) + () + )) + ((ArrayPhysicalCast + (Var 209 array_c) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + DescriptorArray + ) + () + )) + ((IntegerConstant 100 (Integer 4)))] + () + )] + () + Public + .false. + .false. + () + ), + elemental_sin: + (Function + (SymbolTable + 210 + { + array1d: + (Variable + 210 + array1d + [] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + arraynd: + (Variable + 210 + arraynd + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 210 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 210 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + k: + (Variable + 210 + k + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + sin1d: + (Variable + 210 + sin1d + [] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + sin@__lpython_overloaded_0__sin: + (ExternalSymbol + 210 + sin@__lpython_overloaded_0__sin + 3 __lpython_overloaded_0__sin + numpy + [] + __lpython_overloaded_0__sin + Public + ), + sin@__lpython_overloaded_1__sin: + (ExternalSymbol + 210 + sin@__lpython_overloaded_1__sin + 3 __lpython_overloaded_1__sin + numpy + [] + __lpython_overloaded_1__sin + Public + ), + sinnd: + (Variable + 210 + sinnd + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ) + }) + elemental_sin + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [sin@__lpython_overloaded_1__sin + verify1d + sin@__lpython_overloaded_0__sin + verifynd] + [] + [(= + (Var 210 array1d) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 210 sin1d) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 210 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 256 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 255 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 210 array1d) + [(() + (Var 210 i) + ())] + (Real 4) + RowMajor + () + ) + (Cast + (Var 210 i) + IntegerToReal + (Real 4) + () + ) + () + )] + ) + (= + (Var 210 sin1d) + (FunctionCall + 210 sin@__lpython_overloaded_1__sin + 2 sin + [((FunctionCall + 210 sin@__lpython_overloaded_1__sin + 2 sin + [((Var 210 array1d))] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4)))] + FixedSizeArray + ) + () + () + ))] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4)))] + FixedSizeArray + ) + () + () + ) + () + ) + (SubroutineCall + 2 verify1d + () + [((ArrayPhysicalCast + (Var 210 array1d) + FixedSizeArray + DescriptorArray + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4)))] + DescriptorArray + ) + () + )) + ((ArrayPhysicalCast + (Var 210 sin1d) + FixedSizeArray + DescriptorArray + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4)))] + DescriptorArray + ) + () + )) + ((IntegerConstant 256 (Integer 4)))] + () + ) + (= + (Var 210 arraynd) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 210 sinnd) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 210 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 256 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 255 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 210 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 64 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 63 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 210 k) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 16 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 15 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 210 arraynd) + [(() + (Var 210 i) + ()) + (() + (Var 210 j) + ()) + (() + (Var 210 k) + ())] + (Real 8) + RowMajor + () + ) + (Cast + (IntegerBinOp + (IntegerBinOp + (Var 210 i) + Add + (Var 210 j) + (Integer 4) + () + ) + Add + (Var 210 k) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + () + )] + )] + )] + ) + (= + (Var 210 sinnd) + (RealBinOp + (FunctionCall + 210 sin@__lpython_overloaded_0__sin + 2 sin + [((Var 210 arraynd))] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + () + () + ) + Pow + (RealConstant + 2.000000 + (Real 8) + ) + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + () + ) + () + ) + (SubroutineCall + 2 verifynd + () + [((ArrayPhysicalCast + (Var 210 arraynd) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + DescriptorArray + ) + () + )) + ((ArrayPhysicalCast + (Var 210 sinnd) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + DescriptorArray + ) + () + )) + ((IntegerConstant 256 (Integer 4))) + ((IntegerConstant 64 (Integer 4))) + ((IntegerConstant 16 (Integer 4)))] + () + )] + () + Public + .false. + .false. + () + ), + elemental_sum: + (Function + (SymbolTable + 208 + { + array_a: + (Variable + 208 + array_a + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + array_b: + (Variable + 208 + array_b + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + array_c: + (Variable + 208 + array_c + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 208 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 208 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + k: + (Variable + 208 + k + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + elemental_sum + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [verify1d_sum] + [] + [(= + (Var 208 array_a) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 208 array_b) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 208 array_c) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 208 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 100 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 99 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 208 array_a) + [(() + (Var 208 i) + ())] + (Real 8) + RowMajor + () + ) + (Cast + (Var 208 i) + IntegerToReal + (Real 8) + () + ) + () + )] + ) + (DoLoop + () + ((Var 208 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 100 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 99 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 208 array_b) + [(() + (Var 208 j) + ())] + (Real 8) + RowMajor + () + ) + (Cast + (IntegerBinOp + (Var 208 j) + Add + (IntegerConstant 5 (Integer 4)) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + () + )] + ) + (= + (Var 208 array_c) + (RealBinOp + (RealBinOp + (Var 208 array_a) + Pow + (RealConstant + 2.000000 + (Real 8) + ) + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + ) + Add + (RealBinOp + (RealConstant + 5.000000 + (Real 8) + ) + Mul + (RealBinOp + (Var 208 array_b) + Pow + (RealConstant + 3.000000 + (Real 8) + ) + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + ) + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + ) + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + FixedSizeArray + ) + () + ) + () + ) + (SubroutineCall + 2 verify1d_sum + () + [((ArrayPhysicalCast + (Var 208 array_a) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + DescriptorArray + ) + () + )) + ((ArrayPhysicalCast + (Var 208 array_b) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + DescriptorArray + ) + () + )) + ((ArrayPhysicalCast + (Var 208 array_c) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 100 (Integer 4)))] + DescriptorArray + ) + () + )) + ((IntegerConstant 100 (Integer 4)))] + () + )] + () + Public + .false. + .false. + () + ), + elemental_trig_identity: + (Function + (SymbolTable + 212 + { + arraynd: + (Variable + 212 + arraynd + [] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 32 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 8 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + cos@__lpython_overloaded_1__cos: + (ExternalSymbol + 212 + cos@__lpython_overloaded_1__cos + 3 __lpython_overloaded_1__cos + numpy + [] + __lpython_overloaded_1__cos + Public + ), + eps: + (Variable + 212 + eps + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + i: + (Variable + 212 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 212 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + k: + (Variable + 212 + k + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + l: + (Variable + 212 + l + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + newshape: + (Variable + 212 + newshape + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + observed: + (Variable + 212 + observed + [] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 32 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 8 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + observed1d: + (Variable + 212 + observed1d + [] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 65536 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + sin@__lpython_overloaded_1__sin: + (ExternalSymbol + 212 + sin@__lpython_overloaded_1__sin + 3 __lpython_overloaded_1__sin + numpy + [] + __lpython_overloaded_1__sin + Public + ) + }) + elemental_trig_identity + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [sin@__lpython_overloaded_1__sin + cos@__lpython_overloaded_1__cos] + [] + [(= + (Var 212 eps) + (Cast + (RealConstant + 0.000001 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 0.000001 + (Real 4) + ) + ) + () + ) + (= + (Var 212 arraynd) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 32 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 8 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 212 observed) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 32 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 8 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 212 observed1d) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 65536 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 212 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 64 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 63 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 212 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 32 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 31 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 212 k) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 8 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 7 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 212 l) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 4 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 3 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 212 arraynd) + [(() + (Var 212 i) + ()) + (() + (Var 212 j) + ()) + (() + (Var 212 k) + ()) + (() + (Var 212 l) + ())] + (Real 4) + RowMajor + () + ) + (Cast + (IntegerBinOp + (IntegerBinOp + (IntegerBinOp + (Var 212 i) + Add + (Var 212 j) + (Integer 4) + () + ) + Add + (Var 212 k) + (Integer 4) + () + ) + Add + (Var 212 l) + (Integer 4) + () + ) + IntegerToReal + (Real 4) + () + ) + () + )] + )] + )] + )] + ) + (= + (Var 212 observed) + (RealBinOp + (RealBinOp + (FunctionCall + 212 sin@__lpython_overloaded_1__sin + 2 sin + [((Var 212 arraynd))] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 32 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 8 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4 (Integer 4)))] + FixedSizeArray + ) + () + () + ) + Pow + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToReal + (Real 4) + (RealConstant + 2.000000 + (Real 4) + ) + ) + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 32 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 8 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4 (Integer 4)))] + FixedSizeArray + ) + () + ) + Add + (RealBinOp + (FunctionCall + 212 cos@__lpython_overloaded_1__cos + 2 cos + [((Var 212 arraynd))] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 32 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 8 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4 (Integer 4)))] + FixedSizeArray + ) + () + () + ) + Pow + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToReal + (Real 4) + (RealConstant + 2.000000 + (Real 4) + ) + ) + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 32 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 8 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4 (Integer 4)))] + FixedSizeArray + ) + () + ) + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 64 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 32 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 8 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4 (Integer 4)))] + FixedSizeArray + ) + () + ) + () + ) + (= + (Var 212 newshape) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 212 newshape) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 65536 (Integer 4)) + () + ) + (= + (Var 212 observed1d) + (ArrayReshape + (Var 212 observed) + (ArrayPhysicalCast + (Var 212 newshape) + FixedSizeArray + DescriptorArray + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + DescriptorArray + ) + () + ) + (Array + (Real 4) + [(() + ())] + FixedSizeArray + ) + () + ) + () + ) + (DoLoop + () + ((Var 212 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 65536 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 65535 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ArrayItem + (Var 212 observed1d) + [(() + (Var 212 i) + ())] + (Real 4) + RowMajor + () + ) + Sub + (Cast + (RealConstant + 1.000000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 1.000000 + (Real 4) + ) + ) + (Real 4) + () + )] + 0 + (Real 4) + () + ) + LtE + (Var 212 eps) + (Logical 4) + () + ) + () + )] + )] + () + Public + .false. + .false. + () + ), + sin: + (ExternalSymbol + 2 + sin + 3 sin + numpy + [] + sin + Public + ), + verify1d: + (Function + (SymbolTable + 203 + { + array: + (Variable + 203 + array + [] + InOut + () + () + Default + (Array + (Real 4) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + block: + (Block + (SymbolTable + 213 + { + sin@__lpython_overloaded_1__sin: + (ExternalSymbol + 213 + sin@__lpython_overloaded_1__sin + 3 __lpython_overloaded_1__sin + numpy + [] + __lpython_overloaded_1__sin + Public + ) + }) + block + [(Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 213 sin@__lpython_overloaded_1__sin + 2 sin + [((FunctionCall + 213 sin@__lpython_overloaded_1__sin + 2 sin + [((ArrayItem + (Var 203 array) + [(() + (Var 203 i) + ())] + (Real 4) + RowMajor + () + ))] + (Real 4) + () + () + ))] + (Real 4) + () + () + ) + Sub + (ArrayItem + (Var 203 result) + [(() + (Var 203 i) + ())] + (Real 4) + RowMajor + () + ) + (Real 4) + () + )] + 0 + (Real 4) + () + ) + LtE + (Var 203 eps) + (Logical 4) + () + ) + () + )] + ), + eps: + (Variable + 203 + eps + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + i: + (Variable + 203 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + result: + (Variable + 203 + result + [] + InOut + () + () + Default + (Array + (Real 4) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + size: + (Variable + 203 + size + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + verify1d + (FunctionType + [(Array + (Real 4) + [(() + ())] + DescriptorArray + ) + (Array + (Real 4) + [(() + ())] + DescriptorArray + ) + (Integer 4)] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [sin@__lpython_overloaded_1__sin] + [(Var 203 array) + (Var 203 result) + (Var 203 size)] + [(= + (Var 203 eps) + (Cast + (RealConstant + 0.000001 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 0.000001 + (Real 4) + ) + ) + () + ) + (DoLoop + () + ((Var 203 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 203 size) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(BlockCall + -1 + 203 block + )] + )] + () + Public + .false. + .false. + () + ), + verify1d_mul: + (Function + (SymbolTable + 207 + { + array_a: + (Variable + 207 + array_a + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + array_b: + (Variable + 207 + array_b + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + eps: + (Variable + 207 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + i: + (Variable + 207 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + result: + (Variable + 207 + result + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + size: + (Variable + 207 + size + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + verify1d_mul + (FunctionType + [(Array + (Real 8) + [(() + ())] + DescriptorArray + ) + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + (Integer 4)] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 207 array_a) + (Var 207 array_b) + (Var 207 result) + (Var 207 size)] + [(= + (Var 207 eps) + (RealConstant + 0.000010 + (Real 8) + ) + () + ) + (DoLoop + () + ((Var 207 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 207 size) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (RealBinOp + (RealBinOp + (RealBinOp + (ArrayItem + (Var 207 array_a) + [(() + (Var 207 i) + ())] + (Real 8) + RowMajor + () + ) + Pow + (RealConstant + 2.000000 + (Real 8) + ) + (Real 8) + () + ) + Mul + (RealConstant + 5.000000 + (Real 8) + ) + (Real 8) + () + ) + Mul + (RealBinOp + (ArrayItem + (Var 207 array_b) + [(() + (Var 207 i) + ())] + (Real 8) + RowMajor + () + ) + Pow + (RealConstant + 3.000000 + (Real 8) + ) + (Real 8) + () + ) + (Real 8) + () + ) + Sub + (ArrayItem + (Var 207 result) + [(() + (Var 207 i) + ())] + (Real 8) + RowMajor + () + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 207 eps) + (Logical 4) + () + ) + () + )] + )] + () + Public + .false. + .false. + () + ), + verify1d_sum: + (Function + (SymbolTable + 206 + { + array_a: + (Variable + 206 + array_a + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + array_b: + (Variable + 206 + array_b + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + eps: + (Variable + 206 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + i: + (Variable + 206 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + result: + (Variable + 206 + result + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + size: + (Variable + 206 + size + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + verify1d_sum + (FunctionType + [(Array + (Real 8) + [(() + ())] + DescriptorArray + ) + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + (Integer 4)] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 206 array_a) + (Var 206 array_b) + (Var 206 result) + (Var 206 size)] + [(= + (Var 206 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (DoLoop + () + ((Var 206 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 206 size) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (RealBinOp + (RealBinOp + (ArrayItem + (Var 206 array_a) + [(() + (Var 206 i) + ())] + (Real 8) + RowMajor + () + ) + Pow + (RealConstant + 2.000000 + (Real 8) + ) + (Real 8) + () + ) + Add + (RealBinOp + (RealConstant + 5.000000 + (Real 8) + ) + Mul + (RealBinOp + (ArrayItem + (Var 206 array_b) + [(() + (Var 206 i) + ())] + (Real 8) + RowMajor + () + ) + Pow + (RealConstant + 3.000000 + (Real 8) + ) + (Real 8) + () + ) + (Real 8) + () + ) + (Real 8) + () + ) + Sub + (ArrayItem + (Var 206 result) + [(() + (Var 206 i) + ())] + (Real 8) + RowMajor + () + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 206 eps) + (Logical 4) + () + ) + () + )] + )] + () + Public + .false. + .false. + () + ), + verify2d: + (Function + (SymbolTable + 205 + { + array: + (Variable + 205 + array + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ()) + (() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + block: + (Block + (SymbolTable + 217 + { + block: + (Block + (SymbolTable + 218 + { + cos@__lpython_overloaded_0__cos: + (ExternalSymbol + 218 + cos@__lpython_overloaded_0__cos + 3 __lpython_overloaded_0__cos + numpy + [] + __lpython_overloaded_0__cos + Public + ) + }) + block + [(Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (RealBinOp + (FunctionCall + 218 cos@__lpython_overloaded_0__cos + 2 cos + [((ArrayItem + (Var 205 array) + [(() + (Var 205 i) + ()) + (() + (Var 205 j) + ())] + (Real 8) + RowMajor + () + ))] + (Real 8) + () + () + ) + Pow + (RealConstant + 2.000000 + (Real 8) + ) + (Real 8) + () + ) + Sub + (ArrayItem + (Var 205 result) + [(() + (Var 205 i) + ()) + (() + (Var 205 j) + ())] + (Real 8) + RowMajor + () + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 205 eps) + (Logical 4) + () + ) + () + )] + ) + }) + block + [(DoLoop + () + ((Var 205 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 205 size2) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(BlockCall + -1 + 217 block + )] + )] + ), + eps: + (Variable + 205 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + i: + (Variable + 205 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 205 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + result: + (Variable + 205 + result + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ()) + (() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + size1: + (Variable + 205 + size1 + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + size2: + (Variable + 205 + size2 + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + verify2d + (FunctionType + [(Array + (Real 8) + [(() + ()) + (() + ())] + DescriptorArray + ) + (Array + (Real 8) + [(() + ()) + (() + ())] + DescriptorArray + ) + (Integer 4) + (Integer 4)] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [cos@__lpython_overloaded_0__cos] + [(Var 205 array) + (Var 205 result) + (Var 205 size1) + (Var 205 size2)] + [(= + (Var 205 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (DoLoop + () + ((Var 205 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 205 size1) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(BlockCall + -1 + 205 block + )] + )] + () + Public + .false. + .false. + () + ), + verifynd: + (Function + (SymbolTable + 204 + { + array: + (Variable + 204 + array + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ()) + (() + ()) + (() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + block: + (Block + (SymbolTable + 214 + { + block: + (Block + (SymbolTable + 215 + { + block: + (Block + (SymbolTable + 216 + { + sin@__lpython_overloaded_0__sin: + (ExternalSymbol + 216 + sin@__lpython_overloaded_0__sin + 3 __lpython_overloaded_0__sin + numpy + [] + __lpython_overloaded_0__sin + Public + ) + }) + block + [(Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (RealBinOp + (FunctionCall + 216 sin@__lpython_overloaded_0__sin + 2 sin + [((ArrayItem + (Var 204 array) + [(() + (Var 204 i) + ()) + (() + (Var 204 j) + ()) + (() + (Var 204 k) + ())] + (Real 8) + RowMajor + () + ))] + (Real 8) + () + () + ) + Pow + (RealConstant + 2.000000 + (Real 8) + ) + (Real 8) + () + ) + Sub + (ArrayItem + (Var 204 result) + [(() + (Var 204 i) + ()) + (() + (Var 204 j) + ()) + (() + (Var 204 k) + ())] + (Real 8) + RowMajor + () + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 204 eps) + (Logical 4) + () + ) + () + )] + ) + }) + block + [(DoLoop + () + ((Var 204 k) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 204 size3) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(BlockCall + -1 + 215 block + )] + )] + ) + }) + block + [(DoLoop + () + ((Var 204 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 204 size2) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(BlockCall + -1 + 214 block + )] + )] + ), + eps: + (Variable + 204 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + i: + (Variable + 204 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 204 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + k: + (Variable + 204 + k + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + result: + (Variable + 204 + result + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ()) + (() + ()) + (() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + size1: + (Variable + 204 + size1 + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + size2: + (Variable + 204 + size2 + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + size3: + (Variable + 204 + size3 + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + verifynd + (FunctionType + [(Array + (Real 8) + [(() + ()) + (() + ()) + (() + ())] + DescriptorArray + ) + (Array + (Real 8) + [(() + ()) + (() + ()) + (() + ())] + DescriptorArray + ) + (Integer 4) + (Integer 4) + (Integer 4)] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [sin@__lpython_overloaded_0__sin] + [(Var 204 array) + (Var 204 result) + (Var 204 size1) + (Var 204 size2) + (Var 204 size3)] + [(= + (Var 204 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (DoLoop + () + ((Var 204 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 204 size1) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(BlockCall + -1 + 204 block + )] + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [numpy] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 237 + { + __main__global_stmts: + (ExternalSymbol + 237 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 237 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ), + numpy: + (Module numpy) + }) + [] +) diff --git a/tests/reference/asr-expr10-efcbb1b.json b/tests/reference/asr-expr10-efcbb1b.json index 62a4828972..b363b881c5 100644 --- a/tests/reference/asr-expr10-efcbb1b.json +++ b/tests/reference/asr-expr10-efcbb1b.json @@ -5,9 +5,9 @@ "infile_hash": "7eb1dd6ad27fcc091e18c4447fb7a56c659565bbdb57f567b68f4a58", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-expr10-efcbb1b.stderr", - "stderr_hash": "32b0a64a7d73278b8d793b2991e8550827128c4df7fd48bc82d20311", - "returncode": 2 + "stdout": "asr-expr10-efcbb1b.stdout", + "stdout_hash": "c907314770f92fd70fe89854dc8249f7650db8bc23725cffb6ca12e0", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-expr10-efcbb1b.stdout b/tests/reference/asr-expr10-efcbb1b.stdout new file mode 100644 index 0000000000..17a7ec647b --- /dev/null +++ b/tests/reference/asr-expr10-efcbb1b.stdout @@ -0,0 +1,453 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + test_UnaryOp: + (Function + (SymbolTable + 3 + { + a: + (Variable + 3 + a + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + b: + (Variable + 3 + b + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + b1: + (Variable + 3 + b1 + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + b2: + (Variable + 3 + b2 + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + b3: + (Variable + 3 + b3 + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + c: + (Variable + 3 + c + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ), + complex: + (ExternalSymbol + 3 + complex + 4 complex + lpython_builtin + [] + complex + Private + ), + complex@__lpython_overloaded_13__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_13__complex + 4 __lpython_overloaded_13__complex + lpython_builtin + [] + __lpython_overloaded_13__complex + Public + ), + complex@__lpython_overloaded_9__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_9__complex + 4 __lpython_overloaded_9__complex + lpython_builtin + [] + __lpython_overloaded_9__complex + Public + ), + f: + (Variable + 3 + f + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ) + }) + test_UnaryOp + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [complex@__lpython_overloaded_13__complex] + [] + [(= + (Var 3 a) + (IntegerConstant 4 (Integer 4)) + () + ) + (= + (Var 3 a) + (IntegerUnaryMinus + (IntegerConstant 500 (Integer 4)) + (Integer 4) + (IntegerConstant -500 (Integer 4)) + ) + () + ) + (= + (Var 3 a) + (IntegerBitNot + (IntegerConstant 5 (Integer 4)) + (Integer 4) + (IntegerConstant -6 (Integer 4)) + ) + () + ) + (= + (Var 3 b) + (LogicalNot + (Cast + (IntegerConstant 5 (Integer 4)) + IntegerToLogical + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 b) + (LogicalNot + (Cast + (IntegerUnaryMinus + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant -1 (Integer 4)) + ) + IntegerToLogical + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 b) + (LogicalNot + (Cast + (IntegerConstant 0 (Integer 4)) + IntegerToLogical + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 f) + (RealConstant + 1.000000 + (Real 4) + ) + () + ) + (= + (Var 3 f) + (RealUnaryMinus + (Cast + (RealConstant + 183745.534000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 183745.534000 + (Real 4) + ) + ) + (Real 4) + (RealConstant + -183745.534000 + (Real 4) + ) + ) + () + ) + (= + (Var 3 b1) + (LogicalConstant + .true. + (Logical 4) + ) + () + ) + (= + (Var 3 b2) + (LogicalNot + (LogicalConstant + .false. + (Logical 4) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 b3) + (LogicalNot + (Var 3 b2) + (Logical 4) + () + ) + () + ) + (= + (Var 3 a) + (IntegerConstant 1 (Integer 4)) + () + ) + (= + (Var 3 a) + (IntegerUnaryMinus + (Cast + (LogicalConstant + .false. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + (IntegerConstant 0 (Integer 4)) + ) + (Integer 4) + (IntegerConstant 0 (Integer 4)) + ) + () + ) + (= + (Var 3 a) + (IntegerBitNot + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + (IntegerConstant -2 (Integer 4)) + ) + (Integer 4) + (IntegerConstant -2 (Integer 4)) + ) + () + ) + (= + (Var 3 c) + (ComplexConstant + 1.000000 + 2.000000 + (Complex 4) + ) + () + ) + (= + (Var 3 c) + (ComplexUnaryMinus + (Cast + (FunctionCall + 3 complex@__lpython_overloaded_13__complex + 3 complex + [((IntegerConstant 3 (Integer 4))) + ((RealConstant + 65.000000 + (Real 8) + ))] + (Complex 8) + (ComplexConstant + 3.000000 + 65.000000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 3.000000 + 65.000000 + (Complex 4) + ) + ) + (Complex 4) + (ComplexConstant + -3.000000 + -65.000000 + (Complex 4) + ) + ) + () + ) + (= + (Var 3 b1) + (LogicalConstant + .false. + (Logical 4) + ) + () + ) + (= + (Var 3 b2) + (LogicalConstant + .true. + (Logical 4) + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 121 + { + + }) + main_program + [] + [] + ) + }) + [] +) diff --git a/tests/reference/asr-expr13-81bdb5a.json b/tests/reference/asr-expr13-81bdb5a.json index 739e799cd5..89ab7884d3 100644 --- a/tests/reference/asr-expr13-81bdb5a.json +++ b/tests/reference/asr-expr13-81bdb5a.json @@ -5,9 +5,9 @@ "infile_hash": "fae72924c71183c45d328b379dfa81aa4971b5e1a9ea668db546078f", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-expr13-81bdb5a.stderr", - "stderr_hash": "0699d234dbdd85c470cbdb001dd7447b9419e96ce3aafa7642a9edc3", - "returncode": 2 + "stdout": "asr-expr13-81bdb5a.stdout", + "stdout_hash": "a5b91838d5aa7df662a429cf27d1b582c411ed5ef7e88a31e78a78b2", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-expr13-81bdb5a.stdout b/tests/reference/asr-expr13-81bdb5a.stdout new file mode 100644 index 0000000000..933967121e --- /dev/null +++ b/tests/reference/asr-expr13-81bdb5a.stdout @@ -0,0 +1,473 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + test_Compare: + (Function + (SymbolTable + 3 + { + a: + (Variable + 3 + a + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + complex: + (ExternalSymbol + 3 + complex + 4 complex + lpython_builtin + [] + complex + Private + ), + complex@__lpython_overloaded_5__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_5__complex + 4 __lpython_overloaded_5__complex + lpython_builtin + [] + __lpython_overloaded_5__complex + Public + ), + complex@__lpython_overloaded_9__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_9__complex + 4 __lpython_overloaded_9__complex + lpython_builtin + [] + __lpython_overloaded_9__complex + Public + ) + }) + test_Compare + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [complex@__lpython_overloaded_9__complex + complex@__lpython_overloaded_5__complex] + [] + [(= + (Var 3 a) + (IntegerCompare + (IntegerConstant 5 (Integer 4)) + Gt + (IntegerConstant 4 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (IntegerCompare + (IntegerConstant 5 (Integer 4)) + LtE + (IntegerConstant 4 (Integer 4)) + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (IntegerCompare + (IntegerConstant 5 (Integer 4)) + Lt + (IntegerConstant 4 (Integer 4)) + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (RealCompare + (RealConstant + 5.600000 + (Real 8) + ) + GtE + (RealConstant + 5.599990 + (Real 8) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (RealCompare + (RealConstant + 3.300000 + (Real 8) + ) + Eq + (RealConstant + 3.300000 + (Real 8) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (RealCompare + (RealConstant + 3.300000 + (Real 8) + ) + NotEq + (RealConstant + 3.400000 + (Real 8) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (ComplexCompare + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 complex + [((IntegerConstant 3 (Integer 4))) + ((IntegerConstant 4 (Integer 4)))] + (Complex 8) + (ComplexConstant + 3.000000 + 4.000000 + (Complex 8) + ) + () + ) + Eq + (FunctionCall + 3 complex@__lpython_overloaded_5__complex + 3 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 3 a) + (StringCompare + (StringConstant + "abc" + (Character 1 3 ()) + ) + Gt + (StringConstant + "abd" + (Character 1 3 ()) + ) + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (StringCompare + (StringConstant + "" + (Character 1 0 ()) + ) + Lt + (StringConstant + "s" + (Character 1 1 ()) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (StringCompare + (StringConstant + "-abs" + (Character 1 4 ()) + ) + GtE + (StringConstant + "abs" + (Character 1 3 ()) + ) + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (StringCompare + (StringConstant + "abcd" + (Character 1 4 ()) + ) + LtE + (StringConstant + "abcde" + (Character 1 5 ()) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (StringCompare + (StringConstant + "abc" + (Character 1 3 ()) + ) + Eq + (StringConstant + "abc" + (Character 1 3 ()) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (StringCompare + (StringConstant + "abc" + (Character 1 3 ()) + ) + NotEq + (StringConstant + "abd" + (Character 1 3 ()) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (StringCompare + (StringConstant + "" + (Character 1 0 ()) + ) + Eq + (StringConstant + "+" + (Character 1 1 ()) + ) + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (LogicalCompare + (LogicalConstant + .true. + (Logical 4) + ) + Gt + (LogicalConstant + .false. + (Logical 4) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (LogicalCompare + (LogicalConstant + .true. + (Logical 4) + ) + Eq + (LogicalConstant + .true. + (Logical 4) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (LogicalCompare + (LogicalConstant + .false. + (Logical 4) + ) + NotEq + (LogicalConstant + .true. + (Logical 4) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a) + (LogicalCompare + (LogicalConstant + .false. + (Logical 4) + ) + GtE + (LogicalConstant + .true. + (Logical 4) + ) + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 121 + { + + }) + main_program + [] + [] + ) + }) + [] +) diff --git a/tests/reference/asr-expr7-480ba2f.json b/tests/reference/asr-expr7-480ba2f.json index 7d13377709..0e7077348d 100644 --- a/tests/reference/asr-expr7-480ba2f.json +++ b/tests/reference/asr-expr7-480ba2f.json @@ -5,9 +5,9 @@ "infile_hash": "7ef1383d1798621ee35adb7296bfe66dcdc08a21ac8dc86b9ce42878", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, + "stdout": "asr-expr7-480ba2f.stdout", + "stdout_hash": "02945c0fc319637bb38da3114e65beccc06c8779df275d49812cb423", "stderr": "asr-expr7-480ba2f.stderr", - "stderr_hash": "4d93a6488abad28138f2713c11c47b2f02e87e530f1bf6e2e38e88bf", - "returncode": 2 + "stderr_hash": "6e9790ac88db1a9ead8f64a91ba8a6605de67167037908a74b77be0c", + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-expr7-480ba2f.stderr b/tests/reference/asr-expr7-480ba2f.stderr index d1b84ec030..a4fad29beb 100644 --- a/tests/reference/asr-expr7-480ba2f.stderr +++ b/tests/reference/asr-expr7-480ba2f.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/expr7.py:4:13 | 4 | a = i32(pow(2, 2)) - | ^^^^^^^^^ imported here + | ^^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +style suggestion: Could have used '**' instead of 'pow' + --> tests/expr7.py:8:15 + | +8 | res = i32(pow(a, b)) + | ^^^^^^^^^ '**' could be used instead diff --git a/tests/reference/asr-expr7-480ba2f.stdout b/tests/reference/asr-expr7-480ba2f.stdout new file mode 100644 index 0000000000..cf5897cf91 --- /dev/null +++ b/tests/reference/asr-expr7-480ba2f.stdout @@ -0,0 +1,371 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 123 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [main0] + [] + [(SubroutineCall + 2 main0 + () + [] + () + )] + () + Public + .false. + .false. + () + ), + main0: + (Function + (SymbolTable + 5 + { + c: + (Variable + 5 + c + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + main0 + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_pow + test_pow_1] + [] + [(SubroutineCall + 2 test_pow + () + [] + () + ) + (= + (Var 5 c) + (FunctionCall + 2 test_pow_1 + () + [((IntegerConstant 1 (Integer 4))) + ((IntegerConstant 2 (Integer 4)))] + (Integer 4) + () + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_pow: + (Function + (SymbolTable + 3 + { + a: + (Variable + 3 + a + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + pow: + (ExternalSymbol + 3 + pow + 6 pow + lpython_builtin + [] + pow + Private + ), + pow@__lpython_overloaded_0__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_0__pow + 6 __lpython_overloaded_0__pow + lpython_builtin + [] + __lpython_overloaded_0__pow + Public + ) + }) + test_pow + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [pow@__lpython_overloaded_0__pow] + [] + [(= + (Var 3 a) + (Cast + (FunctionCall + 3 pow@__lpython_overloaded_0__pow + 3 pow + [((IntegerConstant 2 (Integer 4))) + ((IntegerConstant 2 (Integer 4)))] + (Real 8) + (RealConstant + 4.000000 + (Real 8) + ) + () + ) + RealToInteger + (Integer 4) + (IntegerConstant 4 (Integer 4)) + ) + () + )] + () + Public + .false. + .false. + () + ), + test_pow_1: + (Function + (SymbolTable + 4 + { + _lpython_return_variable: + (Variable + 4 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + a: + (Variable + 4 + a + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + b: + (Variable + 4 + b + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + pow: + (ExternalSymbol + 4 + pow + 6 pow + lpython_builtin + [] + pow + Private + ), + pow@__lpython_overloaded_0__pow: + (ExternalSymbol + 4 + pow@__lpython_overloaded_0__pow + 6 __lpython_overloaded_0__pow + lpython_builtin + [] + __lpython_overloaded_0__pow + Public + ), + res: + (Variable + 4 + res + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + test_pow_1 + (FunctionType + [(Integer 4) + (Integer 4)] + (Integer 4) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [pow@__lpython_overloaded_0__pow] + [(Var 4 a) + (Var 4 b)] + [(= + (Var 4 res) + (Cast + (FunctionCall + 4 pow@__lpython_overloaded_0__pow + 4 pow + [((Var 4 a)) + ((Var 4 b))] + (Real 8) + () + () + ) + RealToInteger + (Integer 4) + () + ) + () + ) + (= + (Var 4 _lpython_return_variable) + (Var 4 res) + () + ) + (Return)] + (Var 4 _lpython_return_variable) + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 124 + { + __main__global_stmts: + (ExternalSymbol + 124 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 124 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-expr8-6beda60.json b/tests/reference/asr-expr8-6beda60.json index 7801dbd06d..9fb8c510ab 100644 --- a/tests/reference/asr-expr8-6beda60.json +++ b/tests/reference/asr-expr8-6beda60.json @@ -5,9 +5,9 @@ "infile_hash": "6966e19cf343700cbc11ec1bf6a495e43c685c6fa065669875aa61ce", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-expr8-6beda60.stderr", - "stderr_hash": "94db9a9e4af4eda9b774a82fb4f55aa3413db82da5be0160bde72352", - "returncode": 2 + "stdout": "asr-expr8-6beda60.stdout", + "stdout_hash": "b79ac7dd790182c720f71316cdcedbd0a6b3b1bd56ef5cb800fab8dd", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-expr8-6beda60.stdout b/tests/reference/asr-expr8-6beda60.stdout new file mode 100644 index 0000000000..cda03a79a5 --- /dev/null +++ b/tests/reference/asr-expr8-6beda60.stdout @@ -0,0 +1,430 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + test_binop: + (Function + (SymbolTable + 3 + { + b1: + (Variable + 3 + b1 + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + b2: + (Variable + 3 + b2 + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + x: + (Variable + 3 + x + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + x2: + (Variable + 3 + x2 + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ) + }) + test_binop + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 3 x) + (IntegerBinOp + (IntegerConstant 2 (Integer 4)) + Pow + (IntegerConstant 3 (Integer 4)) + (Integer 4) + (IntegerConstant 8 (Integer 4)) + ) + () + ) + (= + (Var 3 x2) + (Cast + (RealBinOp + (RealConstant + 2.000000 + (Real 8) + ) + Pow + (RealConstant + 3.500000 + (Real 8) + ) + (Real 8) + (RealConstant + 11.313708 + (Real 8) + ) + ) + RealToReal + (Real 4) + (RealConstant + 11.313708 + (Real 4) + ) + ) + () + ) + (= + (Var 3 x) + (IntegerBinOp + (IntegerConstant 54 (Integer 4)) + Sub + (IntegerConstant 100 (Integer 4)) + (Integer 4) + (IntegerConstant -46 (Integer 4)) + ) + () + ) + (= + (Var 3 x2) + (Cast + (RealBinOp + (RealBinOp + (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) + (RealConstant + -227.376000 + (Real 4) + ) + ) + () + ) + (= + (Var 3 x2) + (Cast + (RealBinOp + (RealConstant + 5346.565000 + (Real 8) + ) + Mul + (RealConstant + 3.450000 + (Real 8) + ) + (Real 8) + (RealConstant + 18445.649250 + (Real 8) + ) + ) + RealToReal + (Real 4) + (RealConstant + 18445.649250 + (Real 4) + ) + ) + () + ) + (= + (Var 3 x2) + (Cast + (RealBinOp + (RealConstant + 5346.565000 + (Real 8) + ) + Pow + (RealConstant + 3.450000 + (Real 8) + ) + (Real 8) + (RealConstant + 7275422789925.217773 + (Real 8) + ) + ) + RealToReal + (Real 4) + (RealConstant + 7275422789925.217773 + (Real 4) + ) + ) + () + ) + (= + (Var 3 x) + (IntegerBinOp + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + Add + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (= + (Var 3 x) + (IntegerBinOp + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + Sub + (Cast + (LogicalConstant + .false. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (= + (Var 3 x) + (IntegerBinOp + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + Mul + (Cast + (LogicalConstant + .false. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (= + (Var 3 x) + (IntegerBinOp + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + Pow + (Cast + (LogicalConstant + .false. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (= + (Var 3 b1) + (LogicalConstant + .true. + (Logical 4) + ) + () + ) + (= + (Var 3 b2) + (LogicalConstant + .false. + (Logical 4) + ) + () + ) + (= + (Var 3 x) + (Cast + (IntrinsicScalarFunction + FloorDiv + [(Var 3 b1) + (Var 3 b1)] + 0 + (Logical 4) + () + ) + LogicalToInteger + (Integer 4) + () + ) + () + ) + (= + (Var 3 x) + (IntegerBinOp + (Cast + (Var 3 b1) + LogicalToInteger + (Integer 4) + () + ) + Pow + (Cast + (Var 3 b2) + LogicalToInteger + (Integer 4) + () + ) + (Integer 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [] + .false. + .false. + ), + main_program: + (Program + (SymbolTable + 4 + { + + }) + main_program + [] + [] + ) + }) + [] +) diff --git a/tests/reference/asr-expr_05-3a37324.json b/tests/reference/asr-expr_05-3a37324.json index e366badac0..8c90040f3a 100644 --- a/tests/reference/asr-expr_05-3a37324.json +++ b/tests/reference/asr-expr_05-3a37324.json @@ -5,9 +5,9 @@ "infile_hash": "cc922bec30fac0a8eb10efd99f72234aa5638b3c9cd92c68044c69ea", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-expr_05-3a37324.stderr", - "stderr_hash": "ec167ccde0bcc3539244c081abc86809b00655e649722a96f082d86b", - "returncode": 2 + "stdout": "asr-expr_05-3a37324.stdout", + "stdout_hash": "8daf39a772d99f4ae814c124aef4cd567c420d9ed98849fcaee10b87", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-expr_05-3a37324.stdout b/tests/reference/asr-expr_05-3a37324.stdout new file mode 100644 index 0000000000..c48787899e --- /dev/null +++ b/tests/reference/asr-expr_05-3a37324.stdout @@ -0,0 +1,1642 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 123 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [main0] + [] + [(SubroutineCall + 2 main0 + () + [] + () + )] + () + Public + .false. + .false. + () + ), + main0: + (Function + (SymbolTable + 5 + { + _mod: + (ExternalSymbol + 5 + _mod + 6 _mod + lpython_builtin + [] + _mod + Private + ), + _mod@__lpython_overloaded_2___mod: + (ExternalSymbol + 5 + _mod@__lpython_overloaded_2___mod + 6 __lpython_overloaded_2___mod + lpython_builtin + [] + __lpython_overloaded_2___mod + Public + ), + _mod@__lpython_overloaded_4___mod: + (ExternalSymbol + 5 + _mod@__lpython_overloaded_4___mod + 6 __lpython_overloaded_4___mod + lpython_builtin + [] + __lpython_overloaded_4___mod + Public + ), + _mod@__lpython_overloaded_9___mod: + (ExternalSymbol + 5 + _mod@__lpython_overloaded_9___mod + 6 __lpython_overloaded_9___mod + lpython_builtin + [] + __lpython_overloaded_9___mod + Public + ), + a: + (Variable + 5 + a + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + a1: + (Variable + 5 + a1 + [] + Local + () + () + Default + (UnsignedInteger + 2 + ) + () + Source + Public + Required + .false. + ), + b: + (Variable + 5 + b + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + b1: + (Variable + 5 + b1 + [] + Local + () + () + Default + (UnsignedInteger + 2 + ) + () + Source + Public + Required + .false. + ), + c1: + (Variable + 5 + c1 + [] + Local + () + () + Default + (UnsignedInteger + 2 + ) + () + Source + Public + Required + .false. + ), + eps: + (Variable + 5 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + i: + (Variable + 5 + i + [] + Local + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ), + i1: + (Variable + 5 + i1 + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + i2: + (Variable + 5 + i2 + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + i3: + (Variable + 5 + i3 + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + i4: + (Variable + 5 + i4 + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + main0 + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_multiply + test_mod + _mod@__lpython_overloaded_2___mod + _mod@__lpython_overloaded_9___mod + _mod@__lpython_overloaded_4___mod] + [] + [(= + (Var 5 a) + (IntegerConstant 10 (Integer 4)) + () + ) + (= + (Var 5 b) + (IntegerUnaryMinus + (IntegerConstant 5 (Integer 4)) + (Integer 4) + (IntegerConstant -5 (Integer 4)) + ) + () + ) + (= + (Var 5 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 2 test_multiply + () + [((Var 5 a)) + ((Var 5 b))] + (Integer 4) + () + () + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 50 (Integer 4)) + (Integer 4) + (IntegerConstant -50 (Integer 4)) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 5 i) + (Cast + (IntegerConstant 1 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 1 (Integer 8)) + ) + () + ) + (= + (Var 5 i) + (IntegerBinOp + (Var 5 i) + Add + (Cast + (IntegerConstant 1 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 1 (Integer 8)) + ) + (Integer 8) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 5 i) + Eq + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 2 (Integer 8)) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 5 a) + (IntegerConstant 2 (Integer 4)) + () + ) + (= + (Var 5 b) + (IntegerConstant 5 (Integer 4)) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 2 test_mod + () + [((Var 5 a)) + ((Var 5 b))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 2 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 2 test_mod + () + [((IntegerConstant 23 (Integer 4))) + ((IntegerConstant 3 (Integer 4)))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 2 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 5 a) + (IntegerConstant 123282374 (Integer 4)) + () + ) + (= + (Var 5 b) + (IntegerConstant 32771 (Integer 4)) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 2 test_mod + () + [((Var 5 a)) + ((Var 5 b))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 30643 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 5 a) + (IntegerUnaryMinus + (IntegerConstant 5345 (Integer 4)) + (Integer 4) + (IntegerConstant -5345 (Integer 4)) + ) + () + ) + (= + (Var 5 b) + (IntegerUnaryMinus + (IntegerConstant 534 (Integer 4)) + (Integer 4) + (IntegerConstant -534 (Integer 4)) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 5 _mod@__lpython_overloaded_2___mod + 5 _mod + [((Var 5 a)) + ((Var 5 b))] + (Integer 4) + () + () + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 5 (Integer 4)) + (Integer 4) + (IntegerConstant -5 (Integer 4)) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 5 a) + (IntegerUnaryMinus + (IntegerConstant 123282374 (Integer 4)) + (Integer 4) + (IntegerConstant -123282374 (Integer 4)) + ) + () + ) + (= + (Var 5 b) + (IntegerConstant 32771 (Integer 4)) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 2 test_mod + () + [((Var 5 a)) + ((Var 5 b))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 2128 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (IntegerConstant 10 (Integer 4)) + BitOr + (IntegerConstant 4 (Integer 4)) + (Integer 4) + (IntegerConstant 14 (Integer 4)) + ) + Eq + (IntegerConstant 14 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (IntegerUnaryMinus + (IntegerConstant 105346 (Integer 4)) + (Integer 4) + (IntegerConstant -105346 (Integer 4)) + ) + BitOr + (IntegerUnaryMinus + (IntegerConstant 32771 (Integer 4)) + (Integer 4) + (IntegerConstant -32771 (Integer 4)) + ) + (Integer 4) + (IntegerConstant -32769 (Integer 4)) + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 32769 (Integer 4)) + (Integer 4) + (IntegerConstant -32769 (Integer 4)) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (IntegerConstant 10 (Integer 4)) + BitAnd + (IntegerConstant 4 (Integer 4)) + (Integer 4) + (IntegerConstant 0 (Integer 4)) + ) + Eq + (IntegerConstant 0 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (IntegerUnaryMinus + (IntegerConstant 105346 (Integer 4)) + (Integer 4) + (IntegerConstant -105346 (Integer 4)) + ) + BitAnd + (IntegerUnaryMinus + (IntegerConstant 32771 (Integer 4)) + (Integer 4) + (IntegerConstant -32771 (Integer 4)) + ) + (Integer 4) + (IntegerConstant -105348 (Integer 4)) + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 105348 (Integer 4)) + (Integer 4) + (IntegerConstant -105348 (Integer 4)) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (IntegerConstant 10 (Integer 4)) + BitXor + (IntegerConstant 4 (Integer 4)) + (Integer 4) + (IntegerConstant 14 (Integer 4)) + ) + Eq + (IntegerConstant 14 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (IntegerUnaryMinus + (IntegerConstant 105346 (Integer 4)) + (Integer 4) + (IntegerConstant -105346 (Integer 4)) + ) + BitXor + (IntegerUnaryMinus + (IntegerConstant 32771 (Integer 4)) + (Integer 4) + (IntegerConstant -32771 (Integer 4)) + ) + (Integer 4) + (IntegerConstant 72579 (Integer 4)) + ) + Eq + (IntegerConstant 72579 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (IntegerConstant 10 (Integer 4)) + BitRShift + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 5 (Integer 4)) + ) + Eq + (IntegerConstant 5 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (IntegerConstant 5 (Integer 4)) + BitLShift + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 10 (Integer 4)) + ) + Eq + (IntegerConstant 10 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 5 i1) + (IntegerConstant 10 (Integer 4)) + () + ) + (= + (Var 5 i2) + (IntegerConstant 4 (Integer 4)) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (Var 5 i1) + BitLShift + (Var 5 i2) + (Integer 4) + () + ) + Eq + (IntegerConstant 160 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (Var 5 i1) + BitRShift + (Var 5 i2) + (Integer 4) + () + ) + Eq + (IntegerConstant 0 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (Var 5 i1) + BitAnd + (Var 5 i2) + (Integer 4) + () + ) + Eq + (IntegerConstant 0 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (Var 5 i1) + BitOr + (Var 5 i2) + (Integer 4) + () + ) + Eq + (IntegerConstant 14 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (Var 5 i1) + BitXor + (Var 5 i2) + (Integer 4) + () + ) + Eq + (IntegerConstant 14 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (IntegerUnaryMinus + (Var 5 i1) + (Integer 4) + () + ) + BitXor + (IntegerUnaryMinus + (Var 5 i2) + (Integer 4) + () + ) + (Integer 4) + () + ) + Eq + (IntegerConstant 10 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 5 i3) + (IntegerConstant 432534534 (Integer 4)) + () + ) + (= + (Var 5 i4) + (IntegerUnaryMinus + (IntegerConstant 4325 (Integer 4)) + (Integer 4) + (IntegerConstant -4325 (Integer 4)) + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (Var 5 i3) + BitOr + (Var 5 i4) + (Integer 4) + () + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 225 (Integer 4)) + (Integer 4) + (IntegerConstant -225 (Integer 4)) + ) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (Var 5 i4) + BitRShift + (IntegerConstant 3 (Integer 4)) + (Integer 4) + () + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 541 (Integer 4)) + (Integer 4) + (IntegerConstant -541 (Integer 4)) + ) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (IntegerUnaryMinus + (Var 5 i3) + (Integer 4) + () + ) + BitAnd + (Var 5 i4) + (Integer 4) + () + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 432534758 (Integer 4)) + (Integer 4) + (IntegerConstant -432534758 (Integer 4)) + ) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (IntegerBinOp + (IntegerUnaryMinus + (Var 5 i3) + (Integer 4) + () + ) + BitXor + (Var 5 i4) + (Integer 4) + () + ) + Eq + (IntegerConstant 432530657 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 5 a) + (IntegerConstant 10 (Integer 4)) + () + ) + (= + (Var 5 a) + (IntegerBinOp + (Var 5 a) + BitOr + (IntegerConstant 4 (Integer 4)) + (Integer 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 5 a) + Eq + (IntegerConstant 14 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 5 a) + (IntegerBinOp + (Var 5 a) + BitXor + (IntegerConstant 3 (Integer 4)) + (Integer 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 5 a) + Eq + (IntegerConstant 13 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 5 b) + (IntegerConstant 10 (Integer 4)) + () + ) + (= + (Var 5 a) + (FunctionCall + 5 _mod@__lpython_overloaded_2___mod + 5 _mod + [((Var 5 a)) + ((Var 5 b))] + (Integer 4) + () + () + ) + () + ) + (Assert + (IntegerCompare + (Var 5 a) + Eq + (IntegerConstant 3 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 5 b) + (IntegerConstant 4 (Integer 4)) + () + ) + (= + (Var 5 a) + (IntegerBinOp + (Var 5 a) + BitLShift + (Var 5 b) + (Integer 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 5 a) + Eq + (IntegerConstant 48 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 5 a) + (IntegerBinOp + (Var 5 a) + BitRShift + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 5 a) + Eq + (IntegerConstant 24 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 5 a) + (IntegerBinOp + (Var 5 a) + BitAnd + (Var 5 b) + (Integer 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 5 a) + Eq + (IntegerConstant 0 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 5 b) + (IntegerBinOp + (Var 5 b) + Pow + (IntegerConstant 4 (Integer 4)) + (Integer 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 5 b) + Eq + (IntegerConstant 256 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 5 _mod@__lpython_overloaded_2___mod + 5 _mod + [((IntegerUnaryMinus + (IntegerConstant 8 (Integer 4)) + (Integer 4) + (IntegerConstant -8 (Integer 4)) + )) + ((IntegerConstant 3 (Integer 4)))] + (Integer 4) + (IntegerConstant 1 (Integer 4)) + () + ) + Eq + (IntegerConstant 1 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 5 _mod@__lpython_overloaded_2___mod + 5 _mod + [((IntegerConstant 8 (Integer 4))) + ((IntegerUnaryMinus + (IntegerConstant 3 (Integer 4)) + (Integer 4) + (IntegerConstant -3 (Integer 4)) + ))] + (Integer 4) + (IntegerConstant -1 (Integer 4)) + () + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant -1 (Integer 4)) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 5 _mod@__lpython_overloaded_2___mod + 5 _mod + [((IntegerUnaryMinus + (IntegerConstant 8 (Integer 4)) + (Integer 4) + (IntegerConstant -8 (Integer 4)) + )) + ((IntegerUnaryMinus + (IntegerConstant 3 (Integer 4)) + (Integer 4) + (IntegerConstant -3 (Integer 4)) + ))] + (Integer 4) + (IntegerConstant -2 (Integer 4)) + () + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 2 (Integer 4)) + (Integer 4) + (IntegerConstant -2 (Integer 4)) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 5 _mod@__lpython_overloaded_9___mod + 5 _mod + [((RealConstant + 11.000000 + (Real 8) + )) + ((RealUnaryMinus + (RealConstant + 3.000000 + (Real 8) + ) + (Real 8) + (RealConstant + -3.000000 + (Real 8) + ) + ))] + (Real 8) + (RealConstant + -1.000000 + (Real 8) + ) + () + ) + Sub + (RealUnaryMinus + (RealConstant + 1.000000 + (Real 8) + ) + (Real 8) + (RealConstant + -1.000000 + (Real 8) + ) + ) + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 5 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 5 _mod@__lpython_overloaded_9___mod + 5 _mod + [((RealUnaryMinus + (RealConstant + 11.000000 + (Real 8) + ) + (Real 8) + (RealConstant + -11.000000 + (Real 8) + ) + )) + ((RealConstant + 3.000000 + (Real 8) + ))] + (Real 8) + (RealConstant + 1.000000 + (Real 8) + ) + () + ) + Sub + (RealConstant + 1.000000 + (Real 8) + ) + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 5 eps) + (Logical 4) + () + ) + () + ) + (= + (Var 5 a1) + (Cast + (IntegerConstant 10 (Integer 4)) + IntegerToUnsignedInteger + (UnsignedInteger + 2 + ) + (UnsignedIntegerConstant + 10 + (UnsignedInteger + 2 + ) + ) + ) + () + ) + (= + (Var 5 b1) + (Cast + (IntegerConstant 3 (Integer 4)) + IntegerToUnsignedInteger + (UnsignedInteger + 2 + ) + (UnsignedIntegerConstant + 3 + (UnsignedInteger + 2 + ) + ) + ) + () + ) + (= + (Var 5 c1) + (FunctionCall + 5 _mod@__lpython_overloaded_4___mod + 5 _mod + [((Var 5 a1)) + ((Var 5 b1))] + (UnsignedInteger + 2 + ) + () + () + ) + () + ) + (Assert + (UnsignedIntegerCompare + (Var 5 c1) + Eq + (Cast + (IntegerConstant 1 (Integer 4)) + IntegerToUnsignedInteger + (UnsignedInteger + 2 + ) + (UnsignedIntegerConstant + 1 + (UnsignedInteger + 2 + ) + ) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 5 c1) + (IntrinsicScalarFunction + FloorDiv + [(Var 5 a1) + (Var 5 b1)] + 0 + (UnsignedInteger + 2 + ) + () + ) + () + ) + (Assert + (UnsignedIntegerCompare + (Var 5 c1) + Eq + (Cast + (IntegerConstant 3 (Integer 4)) + IntegerToUnsignedInteger + (UnsignedInteger + 2 + ) + (UnsignedIntegerConstant + 3 + (UnsignedInteger + 2 + ) + ) + ) + (Logical 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_mod: + (Function + (SymbolTable + 4 + { + _lpython_return_variable: + (Variable + 4 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + _mod: + (ExternalSymbol + 4 + _mod + 6 _mod + lpython_builtin + [] + _mod + Private + ), + _mod@__lpython_overloaded_2___mod: + (ExternalSymbol + 4 + _mod@__lpython_overloaded_2___mod + 6 __lpython_overloaded_2___mod + lpython_builtin + [] + __lpython_overloaded_2___mod + Public + ), + a: + (Variable + 4 + a + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + b: + (Variable + 4 + b + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + test_mod + (FunctionType + [(Integer 4) + (Integer 4)] + (Integer 4) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [_mod@__lpython_overloaded_2___mod] + [(Var 4 a) + (Var 4 b)] + [(= + (Var 4 _lpython_return_variable) + (FunctionCall + 4 _mod@__lpython_overloaded_2___mod + 4 _mod + [((Var 4 a)) + ((Var 4 b))] + (Integer 4) + () + () + ) + () + ) + (Return)] + (Var 4 _lpython_return_variable) + Public + .false. + .false. + () + ), + test_multiply: + (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. + ) + }) + test_multiply + (FunctionType + [(Integer 4) + (Integer 4)] + (Integer 4) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 3 a) + (Var 3 b)] + [(= + (Var 3 _lpython_return_variable) + (IntegerBinOp + (Var 3 a) + Mul + (Var 3 b) + (Integer 4) + () + ) + () + ) + (Return)] + (Var 3 _lpython_return_variable) + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 124 + { + __main__global_stmts: + (ExternalSymbol + 124 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 124 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-generics_array_01-682b1b2.json b/tests/reference/asr-generics_array_01-682b1b2.json index 2da3a03bc0..fae1832ba1 100644 --- a/tests/reference/asr-generics_array_01-682b1b2.json +++ b/tests/reference/asr-generics_array_01-682b1b2.json @@ -5,9 +5,9 @@ "infile_hash": "6e943dd0e26ab4d1ffb6ed6909a365b4135b6f5295957b2478cfb479", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-generics_array_01-682b1b2.stderr", - "stderr_hash": "07809b586ef30105878e1532461ac0ad302722003d44d2ae71b4cb7a", - "returncode": 2 + "stdout": "asr-generics_array_01-682b1b2.stdout", + "stdout_hash": "af14475be21a8b255e3482c293596282a24e86e643a0502519879a08", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-generics_array_01-682b1b2.stdout b/tests/reference/asr-generics_array_01-682b1b2.stdout new file mode 100644 index 0000000000..8a408834a9 --- /dev/null +++ b/tests/reference/asr-generics_array_01-682b1b2.stdout @@ -0,0 +1,459 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + T: + (Variable + 2 + T + [] + Local + () + () + Default + (TypeParameter + T + ) + () + Source + Public + Required + .false. + ), + __asr_generic_f_0: + (Function + (SymbolTable + 205 + { + _lpython_return_variable: + (Variable + 205 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + i: + (Variable + 205 + i + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + lst: + (Variable + 205 + lst + [] + InOut + () + () + Default + (Array + (Integer 4) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ) + }) + __asr_generic_f_0 + (FunctionType + [(Array + (Integer 4) + [(() + ())] + DescriptorArray + ) + (Integer 4)] + (Integer 4) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 205 lst) + (Var 205 i)] + [(= + (ArrayItem + (Var 205 lst) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (Var 205 i) + () + ) + (= + (Var 205 _lpython_return_variable) + (ArrayItem + (Var 205 lst) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + () + ) + (Return)] + (Var 205 _lpython_return_variable) + Public + .false. + .false. + () + ), + __main__global_stmts: + (Function + (SymbolTable + 206 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [use_array] + [] + [(SubroutineCall + 2 use_array + () + [] + () + )] + () + Public + .false. + .false. + () + ), + f: + (Function + (SymbolTable + 203 + { + _lpython_return_variable: + (Variable + 203 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (TypeParameter + T + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 203 + i + [] + In + () + () + Default + (TypeParameter + T + ) + () + Source + Public + Required + .false. + ), + lst: + (Variable + 203 + lst + [] + InOut + () + () + Default + (Array + (TypeParameter + T + ) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ) + }) + f + (FunctionType + [(Array + (TypeParameter + T + ) + [(() + ())] + DescriptorArray + ) + (TypeParameter + T + )] + (TypeParameter + T + ) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 203 lst) + (Var 203 i)] + [(= + (ArrayItem + (Var 203 lst) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (TypeParameter + T + ) + RowMajor + () + ) + (Var 203 i) + () + ) + (= + (Var 203 _lpython_return_variable) + (ArrayItem + (Var 203 lst) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (TypeParameter + T + ) + RowMajor + () + ) + () + ) + (Return)] + (Var 203 _lpython_return_variable) + Public + .false. + .false. + () + ), + use_array: + (Function + (SymbolTable + 204 + { + array: + (Variable + 204 + array + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + x: + (Variable + 204 + x + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + use_array + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [__asr_generic_f_0] + [] + [(= + (Var 204 array) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 204 x) + (IntegerConstant 69 (Integer 4)) + () + ) + (Print + () + [(FunctionCall + 2 __asr_generic_f_0 + () + [((ArrayPhysicalCast + (Var 204 array) + FixedSizeArray + DescriptorArray + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + DescriptorArray + ) + () + )) + ((Var 204 x))] + (Integer 4) + () + () + )] + () + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [numpy] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 207 + { + __main__global_stmts: + (ExternalSymbol + 207 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 207 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ), + numpy: + (Module numpy) + }) + [] +) diff --git a/tests/reference/asr-generics_array_02-22c8dc1.json b/tests/reference/asr-generics_array_02-22c8dc1.json index b869c0013e..f4d661ba5e 100644 --- a/tests/reference/asr-generics_array_02-22c8dc1.json +++ b/tests/reference/asr-generics_array_02-22c8dc1.json @@ -5,9 +5,9 @@ "infile_hash": "54b5f1d4b8fc7543c292ac0d6f7a39939816a657173937fa7dc02f07", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-generics_array_02-22c8dc1.stderr", - "stderr_hash": "ab2cfe57f54581e673039761ff5a42919ddb665b1083a36342cbe7e1", - "returncode": 2 + "stdout": "asr-generics_array_02-22c8dc1.stdout", + "stdout_hash": "5e5091e93e3005801410e364adb3a1ad1a821e13d054ff7120661e34", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-generics_array_02-22c8dc1.stdout b/tests/reference/asr-generics_array_02-22c8dc1.stdout new file mode 100644 index 0000000000..1ed0cc609a --- /dev/null +++ b/tests/reference/asr-generics_array_02-22c8dc1.stdout @@ -0,0 +1,1391 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + T: + (Variable + 2 + T + [] + Local + () + () + Default + (TypeParameter + T + ) + () + Source + Public + Required + .false. + ), + __asr_generic_g_0: + (Function + (SymbolTable + 209 + { + a: + (Variable + 209 + a + [n] + InOut + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (Var 209 n))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + b: + (Variable + 209 + b + [n] + InOut + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (Var 209 n))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 209 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + n: + (Variable + 209 + n + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + r: + (Variable + 209 + r + [n] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (Var 209 n))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ) + }) + __asr_generic_g_0 + (FunctionType + [(Integer 4) + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + ))] + PointerToDataArray + ) + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + ))] + PointerToDataArray + )] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [2 add] + .false. + ) + [add_integer] + [(Var 209 n) + (Var 209 a) + (Var 209 b)] + [(= + (Var 209 r) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (Var 209 n))] + PointerToDataArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 209 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 209 n) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 209 r) + [(() + (Var 209 i) + ())] + (Integer 4) + RowMajor + () + ) + (FunctionCall + 2 add_integer + () + [((ArrayItem + (Var 209 a) + [(() + (Var 209 i) + ())] + (Integer 4) + RowMajor + () + )) + ((ArrayItem + (Var 209 b) + [(() + (Var 209 i) + ())] + (Integer 4) + RowMajor + () + ))] + (Integer 4) + () + () + ) + () + )] + ) + (Print + () + [(ArrayItem + (Var 209 r) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + )] + () + () + )] + () + Public + .false. + .false. + () + ), + __asr_generic_g_1: + (Function + (SymbolTable + 210 + { + a: + (Variable + 210 + a + [n] + InOut + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (Var 210 n))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + b: + (Variable + 210 + b + [n] + InOut + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (Var 210 n))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 210 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + n: + (Variable + 210 + n + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + r: + (Variable + 210 + r + [n] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (Var 210 n))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ) + }) + __asr_generic_g_1 + (FunctionType + [(Integer 4) + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + ))] + PointerToDataArray + ) + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + ))] + PointerToDataArray + )] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [2 add] + .false. + ) + [add_float] + [(Var 210 n) + (Var 210 a) + (Var 210 b)] + [(= + (Var 210 r) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (Var 210 n))] + PointerToDataArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 210 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 210 n) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 210 r) + [(() + (Var 210 i) + ())] + (Real 4) + RowMajor + () + ) + (FunctionCall + 2 add_float + () + [((ArrayItem + (Var 210 a) + [(() + (Var 210 i) + ())] + (Real 4) + RowMajor + () + )) + ((ArrayItem + (Var 210 b) + [(() + (Var 210 i) + ())] + (Real 4) + RowMajor + () + ))] + (Real 4) + () + () + ) + () + )] + ) + (Print + () + [(ArrayItem + (Var 210 r) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Real 4) + RowMajor + () + )] + () + () + )] + () + Public + .false. + .false. + () + ), + __main__global_stmts: + (Function + (SymbolTable + 211 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [main] + [] + [(SubroutineCall + 2 main + () + [] + () + )] + () + Public + .false. + .false. + () + ), + add: + (Function + (SymbolTable + 203 + { + _lpython_return_variable: + (Variable + 203 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (TypeParameter + T + ) + () + Source + Public + Required + .false. + ), + x: + (Variable + 203 + x + [] + In + () + () + Default + (TypeParameter + T + ) + () + Source + Public + Required + .false. + ), + y: + (Variable + 203 + y + [] + In + () + () + Default + (TypeParameter + T + ) + () + Source + Public + Required + .false. + ) + }) + add + (FunctionType + [(TypeParameter + T + ) + (TypeParameter + T + )] + (TypeParameter + T + ) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .true. + ) + [] + [(Var 203 x) + (Var 203 y)] + [] + (Var 203 _lpython_return_variable) + Public + .false. + .false. + () + ), + add_float: + (Function + (SymbolTable + 205 + { + _lpython_return_variable: + (Variable + 205 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + x: + (Variable + 205 + x + [] + In + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + y: + (Variable + 205 + y + [] + In + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ) + }) + add_float + (FunctionType + [(Real 4) + (Real 4)] + (Real 4) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 205 x) + (Var 205 y)] + [(= + (Var 205 _lpython_return_variable) + (RealBinOp + (Var 205 x) + Add + (Var 205 y) + (Real 4) + () + ) + () + ) + (Return)] + (Var 205 _lpython_return_variable) + Public + .false. + .false. + () + ), + add_integer: + (Function + (SymbolTable + 204 + { + _lpython_return_variable: + (Variable + 204 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + x: + (Variable + 204 + x + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + y: + (Variable + 204 + y + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + add_integer + (FunctionType + [(Integer 4) + (Integer 4)] + (Integer 4) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 204 x) + (Var 204 y)] + [(= + (Var 204 _lpython_return_variable) + (IntegerBinOp + (Var 204 x) + Add + (Var 204 y) + (Integer 4) + () + ) + () + ) + (Return)] + (Var 204 _lpython_return_variable) + Public + .false. + .false. + () + ), + g: + (Function + (SymbolTable + 206 + { + a: + (Variable + 206 + a + [n] + InOut + () + () + Default + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (Var 206 n))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + b: + (Variable + 206 + b + [n] + InOut + () + () + Default + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (Var 206 n))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 206 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + n: + (Variable + 206 + n + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + r: + (Variable + 206 + r + [n] + Local + () + () + Default + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (Var 206 n))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ) + }) + g + (FunctionType + [(Integer 4) + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + ))] + PointerToDataArray + ) + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + ))] + PointerToDataArray + )] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [2 add] + .false. + ) + [add] + [(Var 206 n) + (Var 206 a) + (Var 206 b)] + [(= + (Var 206 r) + (ArrayConstant + [] + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (Var 206 n))] + PointerToDataArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 206 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 206 n) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 206 r) + [(() + (Var 206 i) + ())] + (TypeParameter + T + ) + RowMajor + () + ) + (FunctionCall + 2 add + () + [((ArrayItem + (Var 206 a) + [(() + (Var 206 i) + ())] + (TypeParameter + T + ) + RowMajor + () + )) + ((ArrayItem + (Var 206 b) + [(() + (Var 206 i) + ())] + (TypeParameter + T + ) + RowMajor + () + ))] + (TypeParameter + T + ) + () + () + ) + () + )] + ) + (Print + () + [(ArrayItem + (Var 206 r) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (TypeParameter + T + ) + RowMajor + () + )] + () + () + )] + () + Public + .false. + .false. + () + ), + main: + (Function + (SymbolTable + 207 + { + a_float: + (Variable + 207 + a_float + [] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + a_int: + (Variable + 207 + a_int + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + b_float: + (Variable + 207 + b_float + [] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + b_int: + (Variable + 207 + b_int + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ) + }) + main + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [__asr_generic_g_0 + __asr_generic_g_1] + [] + [(= + (Var 207 a_int) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 207 a_int) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 400 (Integer 4)) + () + ) + (= + (Var 207 b_int) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 207 b_int) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 20 (Integer 4)) + () + ) + (SubroutineCall + 2 __asr_generic_g_0 + () + [((IntegerConstant 1 (Integer 4))) + ((ArrayPhysicalCast + (Var 207 a_int) + FixedSizeArray + PointerToDataArray + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + PointerToDataArray + ) + () + )) + ((ArrayPhysicalCast + (Var 207 b_int) + FixedSizeArray + PointerToDataArray + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + PointerToDataArray + ) + () + ))] + () + ) + (= + (Var 207 a_float) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 207 a_float) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Real 4) + RowMajor + () + ) + (Cast + (RealConstant + 400.000000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 400.000000 + (Real 4) + ) + ) + () + ) + (= + (Var 207 b_float) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 207 b_float) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Real 4) + RowMajor + () + ) + (Cast + (RealConstant + 20.000000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 20.000000 + (Real 4) + ) + ) + () + ) + (SubroutineCall + 2 __asr_generic_g_1 + () + [((IntegerConstant 1 (Integer 4))) + ((ArrayPhysicalCast + (Var 207 a_float) + FixedSizeArray + PointerToDataArray + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + PointerToDataArray + ) + () + )) + ((ArrayPhysicalCast + (Var 207 b_float) + FixedSizeArray + PointerToDataArray + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + PointerToDataArray + ) + () + ))] + () + )] + () + Public + .false. + .false. + () + ), + n: + (Variable + 2 + n + [] + Local + () + () + Default + (TypeParameter + n + ) + () + Source + Public + Required + .false. + ) + }) + __main__ + [numpy] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 212 + { + __main__global_stmts: + (ExternalSymbol + 212 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 212 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ), + numpy: + (Module numpy) + }) + [] +) diff --git a/tests/reference/asr-generics_array_03-fb3706c.json b/tests/reference/asr-generics_array_03-fb3706c.json index 128484c0ae..5eba5d5b5d 100644 --- a/tests/reference/asr-generics_array_03-fb3706c.json +++ b/tests/reference/asr-generics_array_03-fb3706c.json @@ -5,9 +5,9 @@ "infile_hash": "5b415ae64a527ce3ab3b6878141238e227258bc2b2b8c37af6d23ff5", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-generics_array_03-fb3706c.stderr", - "stderr_hash": "7d636bddcd76853697423eb36c823f5898b8274b21a62a55f764b63b", - "returncode": 2 + "stdout": "asr-generics_array_03-fb3706c.stdout", + "stdout_hash": "b815e4c783072735466386b0bc1f9d272cff4116cca14f109085c299", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-generics_array_03-fb3706c.stdout b/tests/reference/asr-generics_array_03-fb3706c.stdout new file mode 100644 index 0000000000..3048a239ed --- /dev/null +++ b/tests/reference/asr-generics_array_03-fb3706c.stdout @@ -0,0 +1,1880 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + T: + (Variable + 2 + T + [] + Local + () + () + Default + (TypeParameter + T + ) + () + Source + Public + Required + .false. + ), + __asr_generic_g_0: + (Function + (SymbolTable + 210 + { + _lpython_return_variable: + (Variable + 210 + _lpython_return_variable + [n + m] + ReturnVar + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (Var 210 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 210 m))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + a: + (Variable + 210 + a + [n + m] + InOut + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (Var 210 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 210 m))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + b: + (Variable + 210 + b + [n + m] + InOut + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (Var 210 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 210 m))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 210 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 210 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + m: + (Variable + 210 + m + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + n: + (Variable + 210 + n + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + r: + (Variable + 210 + r + [n + m] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (Var 210 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 210 m))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ) + }) + __asr_generic_g_0 + (FunctionType + [(Integer 4) + (Integer 4) + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + )) + ((IntegerConstant 0 (Integer 4)) + (FunctionParam + 1 + (Integer 4) + () + ))] + PointerToDataArray + ) + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + )) + ((IntegerConstant 0 (Integer 4)) + (FunctionParam + 1 + (Integer 4) + () + ))] + PointerToDataArray + )] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + )) + ((IntegerConstant 0 (Integer 4)) + (FunctionParam + 1 + (Integer 4) + () + ))] + PointerToDataArray + ) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [2 add] + .false. + ) + [add_integer] + [(Var 210 n) + (Var 210 m) + (Var 210 a) + (Var 210 b)] + [(= + (Var 210 r) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (Var 210 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 210 m))] + PointerToDataArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 210 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 210 n) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 210 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 210 m) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 210 r) + [(() + (Var 210 i) + ()) + (() + (Var 210 j) + ())] + (Integer 4) + RowMajor + () + ) + (FunctionCall + 2 add_integer + () + [((ArrayItem + (Var 210 a) + [(() + (Var 210 i) + ()) + (() + (Var 210 j) + ())] + (Integer 4) + RowMajor + () + )) + ((ArrayItem + (Var 210 b) + [(() + (Var 210 i) + ()) + (() + (Var 210 j) + ())] + (Integer 4) + RowMajor + () + ))] + (Integer 4) + () + () + ) + () + )] + )] + ) + (Print + () + [(ArrayItem + (Var 210 r) + [(() + (IntegerConstant 0 (Integer 4)) + ()) + (() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + )] + () + () + )] + (Var 210 _lpython_return_variable) + Public + .false. + .false. + () + ), + __asr_generic_g_1: + (Function + (SymbolTable + 211 + { + _lpython_return_variable: + (Variable + 211 + _lpython_return_variable + [n + m] + ReturnVar + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (Var 211 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 211 m))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + a: + (Variable + 211 + a + [n + m] + InOut + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (Var 211 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 211 m))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + b: + (Variable + 211 + b + [n + m] + InOut + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (Var 211 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 211 m))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 211 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 211 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + m: + (Variable + 211 + m + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + n: + (Variable + 211 + n + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + r: + (Variable + 211 + r + [n + m] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (Var 211 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 211 m))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ) + }) + __asr_generic_g_1 + (FunctionType + [(Integer 4) + (Integer 4) + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + )) + ((IntegerConstant 0 (Integer 4)) + (FunctionParam + 1 + (Integer 4) + () + ))] + PointerToDataArray + ) + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + )) + ((IntegerConstant 0 (Integer 4)) + (FunctionParam + 1 + (Integer 4) + () + ))] + PointerToDataArray + )] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + )) + ((IntegerConstant 0 (Integer 4)) + (FunctionParam + 1 + (Integer 4) + () + ))] + PointerToDataArray + ) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [2 add] + .false. + ) + [add_float] + [(Var 211 n) + (Var 211 m) + (Var 211 a) + (Var 211 b)] + [(= + (Var 211 r) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (Var 211 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 211 m))] + PointerToDataArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 211 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 211 n) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 211 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 211 m) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 211 r) + [(() + (Var 211 i) + ()) + (() + (Var 211 j) + ())] + (Real 4) + RowMajor + () + ) + (FunctionCall + 2 add_float + () + [((ArrayItem + (Var 211 a) + [(() + (Var 211 i) + ()) + (() + (Var 211 j) + ())] + (Real 4) + RowMajor + () + )) + ((ArrayItem + (Var 211 b) + [(() + (Var 211 i) + ()) + (() + (Var 211 j) + ())] + (Real 4) + RowMajor + () + ))] + (Real 4) + () + () + ) + () + )] + )] + ) + (Print + () + [(ArrayItem + (Var 211 r) + [(() + (IntegerConstant 0 (Integer 4)) + ()) + (() + (IntegerConstant 0 (Integer 4)) + ())] + (Real 4) + RowMajor + () + )] + () + () + )] + (Var 211 _lpython_return_variable) + Public + .false. + .false. + () + ), + __main__global_stmts: + (Function + (SymbolTable + 212 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [main] + [] + [(SubroutineCall + 2 main + () + [] + () + )] + () + Public + .false. + .false. + () + ), + add: + (Function + (SymbolTable + 203 + { + _lpython_return_variable: + (Variable + 203 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (TypeParameter + T + ) + () + Source + Public + Required + .false. + ), + x: + (Variable + 203 + x + [] + In + () + () + Default + (TypeParameter + T + ) + () + Source + Public + Required + .false. + ), + y: + (Variable + 203 + y + [] + In + () + () + Default + (TypeParameter + T + ) + () + Source + Public + Required + .false. + ) + }) + add + (FunctionType + [(TypeParameter + T + ) + (TypeParameter + T + )] + (TypeParameter + T + ) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .true. + ) + [] + [(Var 203 x) + (Var 203 y)] + [] + (Var 203 _lpython_return_variable) + Public + .false. + .false. + () + ), + add_float: + (Function + (SymbolTable + 205 + { + _lpython_return_variable: + (Variable + 205 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + x: + (Variable + 205 + x + [] + In + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + y: + (Variable + 205 + y + [] + In + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ) + }) + add_float + (FunctionType + [(Real 4) + (Real 4)] + (Real 4) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 205 x) + (Var 205 y)] + [(= + (Var 205 _lpython_return_variable) + (RealBinOp + (Var 205 x) + Add + (Var 205 y) + (Real 4) + () + ) + () + ) + (Return)] + (Var 205 _lpython_return_variable) + Public + .false. + .false. + () + ), + add_integer: + (Function + (SymbolTable + 204 + { + _lpython_return_variable: + (Variable + 204 + _lpython_return_variable + [] + ReturnVar + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + x: + (Variable + 204 + x + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + y: + (Variable + 204 + y + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + add_integer + (FunctionType + [(Integer 4) + (Integer 4)] + (Integer 4) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 204 x) + (Var 204 y)] + [(= + (Var 204 _lpython_return_variable) + (IntegerBinOp + (Var 204 x) + Add + (Var 204 y) + (Integer 4) + () + ) + () + ) + (Return)] + (Var 204 _lpython_return_variable) + Public + .false. + .false. + () + ), + g: + (Function + (SymbolTable + 206 + { + _lpython_return_variable: + (Variable + 206 + _lpython_return_variable + [n + m] + ReturnVar + () + () + Default + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (Var 206 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 206 m))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + a: + (Variable + 206 + a + [n + m] + InOut + () + () + Default + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (Var 206 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 206 m))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + b: + (Variable + 206 + b + [n + m] + InOut + () + () + Default + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (Var 206 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 206 m))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 206 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 206 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + m: + (Variable + 206 + m + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + n: + (Variable + 206 + n + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + r: + (Variable + 206 + r + [n + m] + Local + () + () + Default + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (Var 206 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 206 m))] + PointerToDataArray + ) + () + Source + Public + Required + .false. + ) + }) + g + (FunctionType + [(Integer 4) + (Integer 4) + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + )) + ((IntegerConstant 0 (Integer 4)) + (FunctionParam + 1 + (Integer 4) + () + ))] + PointerToDataArray + ) + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + )) + ((IntegerConstant 0 (Integer 4)) + (FunctionParam + 1 + (Integer 4) + () + ))] + PointerToDataArray + )] + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (FunctionParam + 0 + (Integer 4) + () + )) + ((IntegerConstant 0 (Integer 4)) + (FunctionParam + 1 + (Integer 4) + () + ))] + PointerToDataArray + ) + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [2 add] + .false. + ) + [add] + [(Var 206 n) + (Var 206 m) + (Var 206 a) + (Var 206 b)] + [(= + (Var 206 r) + (ArrayConstant + [] + (Array + (TypeParameter + T + ) + [((IntegerConstant 0 (Integer 4)) + (Var 206 n)) + ((IntegerConstant 0 (Integer 4)) + (Var 206 m))] + PointerToDataArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 206 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 206 n) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 206 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (Var 206 m) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 206 r) + [(() + (Var 206 i) + ()) + (() + (Var 206 j) + ())] + (TypeParameter + T + ) + RowMajor + () + ) + (FunctionCall + 2 add + () + [((ArrayItem + (Var 206 a) + [(() + (Var 206 i) + ()) + (() + (Var 206 j) + ())] + (TypeParameter + T + ) + RowMajor + () + )) + ((ArrayItem + (Var 206 b) + [(() + (Var 206 i) + ()) + (() + (Var 206 j) + ())] + (TypeParameter + T + ) + RowMajor + () + ))] + (TypeParameter + T + ) + () + () + ) + () + )] + )] + ) + (Print + () + [(ArrayItem + (Var 206 r) + [(() + (IntegerConstant 0 (Integer 4)) + ()) + (() + (IntegerConstant 0 (Integer 4)) + ())] + (TypeParameter + T + ) + RowMajor + () + )] + () + () + )] + (Var 206 _lpython_return_variable) + Public + .false. + .false. + () + ), + m: + (Variable + 2 + m + [] + Local + () + () + Default + (TypeParameter + m + ) + () + Source + Public + Required + .false. + ), + main: + (Function + (SymbolTable + 207 + { + __lcompilers_dummy: + (Variable + 207 + __lcompilers_dummy + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + __lcompilers_dummy1: + (Variable + 207 + __lcompilers_dummy1 + [] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + a_float: + (Variable + 207 + a_float + [] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + a_int: + (Variable + 207 + a_int + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + b_float: + (Variable + 207 + b_float + [] + Local + () + () + Default + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + b_int: + (Variable + 207 + b_int + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ) + }) + main + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [__asr_generic_g_0 + __asr_generic_g_1] + [] + [(= + (Var 207 a_int) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 207 a_int) + [(() + (IntegerConstant 0 (Integer 4)) + ()) + (() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 400 (Integer 4)) + () + ) + (= + (Var 207 b_int) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 207 b_int) + [(() + (IntegerConstant 0 (Integer 4)) + ()) + (() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 20 (Integer 4)) + () + ) + (= + (Var 207 __lcompilers_dummy) + (FunctionCall + 2 __asr_generic_g_0 + () + [((IntegerConstant 1 (Integer 4))) + ((IntegerConstant 1 (Integer 4))) + ((ArrayPhysicalCast + (Var 207 a_int) + FixedSizeArray + PointerToDataArray + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + PointerToDataArray + ) + () + )) + ((ArrayPhysicalCast + (Var 207 b_int) + FixedSizeArray + PointerToDataArray + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + PointerToDataArray + ) + () + ))] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + () + ) + () + ) + (= + (Var 207 a_float) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 207 a_float) + [(() + (IntegerConstant 0 (Integer 4)) + ()) + (() + (IntegerConstant 0 (Integer 4)) + ())] + (Real 4) + RowMajor + () + ) + (Cast + (IntegerConstant 400 (Integer 4)) + IntegerToReal + (Real 4) + (RealConstant + 400.000000 + (Real 4) + ) + ) + () + ) + (= + (Var 207 b_float) + (ArrayConstant + [] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 207 b_float) + [(() + (IntegerConstant 0 (Integer 4)) + ()) + (() + (IntegerConstant 0 (Integer 4)) + ())] + (Real 4) + RowMajor + () + ) + (Cast + (IntegerConstant 20 (Integer 4)) + IntegerToReal + (Real 4) + (RealConstant + 20.000000 + (Real 4) + ) + ) + () + ) + (= + (Var 207 __lcompilers_dummy1) + (FunctionCall + 2 __asr_generic_g_1 + () + [((IntegerConstant 1 (Integer 4))) + ((IntegerConstant 1 (Integer 4))) + ((ArrayPhysicalCast + (Var 207 a_float) + FixedSizeArray + PointerToDataArray + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + PointerToDataArray + ) + () + )) + ((ArrayPhysicalCast + (Var 207 b_float) + FixedSizeArray + PointerToDataArray + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + PointerToDataArray + ) + () + ))] + (Array + (Real 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + () + ) + () + )] + () + Public + .false. + .false. + () + ), + n: + (Variable + 2 + n + [] + Local + () + () + Default + (TypeParameter + n + ) + () + Source + Public + Required + .false. + ) + }) + __main__ + [numpy] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 213 + { + __main__global_stmts: + (ExternalSymbol + 213 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 213 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ), + numpy: + (Module numpy) + }) + [] +) diff --git a/tests/reference/asr-kwargs_02_error-7c91f8f.json b/tests/reference/asr-kwargs_02_error-7c91f8f.json index bac9cf8743..228d941171 100644 --- a/tests/reference/asr-kwargs_02_error-7c91f8f.json +++ b/tests/reference/asr-kwargs_02_error-7c91f8f.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-kwargs_02_error-7c91f8f.stderr", - "stderr_hash": "d7988f2217bab99a6e782c6cb63f3d2f505b5d59c8976e4e4fab5042", + "stderr_hash": "120e6e6838e464af15ff96aa99dcdda21923a3bb5f0c3d6d7cc8348b", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-kwargs_02_error-7c91f8f.stderr b/tests/reference/asr-kwargs_02_error-7c91f8f.stderr index 738691275d..9e13b4f43d 100644 --- a/tests/reference/asr-kwargs_02_error-7c91f8f.stderr +++ b/tests/reference/asr-kwargs_02_error-7c91f8f.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> tests/errors/kwargs_02_error.py:4:12 - | -4 | return complex(float(a), b) + c - | ^^^^^^^^^^^^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: func02() got multiple values for argument 'b' + --> tests/errors/kwargs_02_error.py:13:5 + | +13 | func02(arg3, arg4, c=arg5, b=arg4) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/reference/asr-string_02-499c9ff.json b/tests/reference/asr-string_02-499c9ff.json index 4eaad46910..ac33dbbf21 100644 --- a/tests/reference/asr-string_02-499c9ff.json +++ b/tests/reference/asr-string_02-499c9ff.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-string_02-499c9ff.stderr", - "stderr_hash": "85593e60baa6c6f930b7486a92e41fac9943108966abdacb7acb39ef", + "stderr_hash": "368ba74a1e0d6609f71e6f87f95bd0b6151420c81336e48a172cb613", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-string_02-499c9ff.stderr b/tests/reference/asr-string_02-499c9ff.stderr index 7ca613cb8c..196515476b 100644 --- a/tests/reference/asr-string_02-499c9ff.stderr +++ b/tests/reference/asr-string_02-499c9ff.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +semantic error: str.join() takes type list only --> tests/errors/string_02.py:6:15 | 6 | res:str = x.join(p) - | ^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ + | ^^^^^^^^^ diff --git a/tests/reference/asr-structs_05-fa98307.json b/tests/reference/asr-structs_05-fa98307.json index e493825921..7826e07c2a 100644 --- a/tests/reference/asr-structs_05-fa98307.json +++ b/tests/reference/asr-structs_05-fa98307.json @@ -5,9 +5,9 @@ "infile_hash": "ef1037b0936a63be679efd366920a94463900e80630a070ba440aa78", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-structs_05-fa98307.stderr", - "stderr_hash": "9425960bac284eae21adb4274aa833960c505abd6bd546f896da0216", - "returncode": 2 + "stdout": "asr-structs_05-fa98307.stdout", + "stdout_hash": "64fd4586d72ce05affe152ae66a0b6ea6a9f9804d1b489381c46bcb7", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-structs_05-fa98307.stdout b/tests/reference/asr-structs_05-fa98307.stdout new file mode 100644 index 0000000000..a0960fd88a --- /dev/null +++ b/tests/reference/asr-structs_05-fa98307.stdout @@ -0,0 +1,1476 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + A: + (StructType + (SymbolTable + 203 + { + a: + (Variable + 203 + a + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + b: + (Variable + 203 + b + [] + Local + () + () + Default + (Integer 2) + () + Source + Public + Required + .false. + ), + c: + (Variable + 203 + c + [] + Local + () + () + Default + (Integer 1) + () + Source + Public + Required + .false. + ), + d: + (Variable + 203 + d + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + x: + (Variable + 203 + x + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + y: + (Variable + 203 + y + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + z: + (Variable + 203 + z + [] + Local + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ) + }) + A + [] + [y + x + z + a + b + c + d] + Source + Public + .false. + .false. + [(()) + (()) + (()) + (()) + (()) + (()) + (())] + () + () + ), + __main__global_stmts: + (Function + (SymbolTable + 209 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [g] + [] + [(SubroutineCall + 2 g + () + [] + () + )] + () + Public + .false. + .false. + () + ), + g: + (Function + (SymbolTable + 207 + { + y: + (Variable + 207 + y + [] + Local + () + () + Default + (Array + (Struct + 2 A + ) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 2 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ) + }) + g + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [verify + update_1 + update_2] + [] + [(= + (Var 207 y) + (ArrayConstant + [] + (Array + (Struct + 2 A + ) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 2 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 207 y) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Struct + 2 A + ) + RowMajor + () + ) + (StructTypeConstructor + 2 A + [((RealConstant + 1.100000 + (Real 8) + )) + ((IntegerConstant 1 (Integer 4))) + ((Cast + (IntegerConstant 1 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 1 (Integer 8)) + )) + ((Cast + (RealConstant + 1.100000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 1.100000 + (Real 4) + ) + )) + ((Cast + (IntegerConstant 1 (Integer 4)) + IntegerToInteger + (Integer 2) + (IntegerConstant 1 (Integer 2)) + )) + ((Cast + (IntegerConstant 1 (Integer 4)) + IntegerToInteger + (Integer 1) + (IntegerConstant 1 (Integer 1)) + )) + ((LogicalConstant + .true. + (Logical 4) + ))] + (Struct + 2 A + ) + () + ) + () + ) + (= + (ArrayItem + (Var 207 y) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Struct + 2 A + ) + RowMajor + () + ) + (StructTypeConstructor + 2 A + [((RealConstant + 2.200000 + (Real 8) + )) + ((IntegerConstant 2 (Integer 4))) + ((Cast + (IntegerConstant 2 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 2 (Integer 8)) + )) + ((Cast + (RealConstant + 2.200000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 2.200000 + (Real 4) + ) + )) + ((Cast + (IntegerConstant 2 (Integer 4)) + IntegerToInteger + (Integer 2) + (IntegerConstant 2 (Integer 2)) + )) + ((Cast + (IntegerConstant 2 (Integer 4)) + IntegerToInteger + (Integer 1) + (IntegerConstant 2 (Integer 1)) + )) + ((LogicalConstant + .true. + (Logical 4) + ))] + (Struct + 2 A + ) + () + ) + () + ) + (SubroutineCall + 2 verify + () + [((ArrayPhysicalCast + (Var 207 y) + FixedSizeArray + DescriptorArray + (Array + (Struct + 2 A + ) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 2 (Integer 4)))] + DescriptorArray + ) + () + )) + ((IntegerConstant 1 (Integer 4))) + ((RealConstant + 1.100000 + (Real 8) + )) + ((IntegerConstant 2 (Integer 4))) + ((RealConstant + 2.200000 + (Real 8) + ))] + () + ) + (SubroutineCall + 2 update_1 + () + [((ArrayItem + (Var 207 y) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Struct + 2 A + ) + RowMajor + () + ))] + () + ) + (SubroutineCall + 2 update_2 + () + [((ArrayPhysicalCast + (Var 207 y) + FixedSizeArray + DescriptorArray + (Array + (Struct + 2 A + ) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 2 (Integer 4)))] + DescriptorArray + ) + () + ))] + () + ) + (SubroutineCall + 2 verify + () + [((ArrayPhysicalCast + (Var 207 y) + FixedSizeArray + DescriptorArray + (Array + (Struct + 2 A + ) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 2 (Integer 4)))] + DescriptorArray + ) + () + )) + ((IntegerConstant 2 (Integer 4))) + ((RealConstant + 1.200000 + (Real 8) + )) + ((IntegerConstant 3 (Integer 4))) + ((RealConstant + 2.300000 + (Real 8) + ))] + () + )] + () + Public + .false. + .false. + () + ), + update_1: + (Function + (SymbolTable + 205 + { + s: + (Variable + 205 + s + [] + InOut + () + () + Default + (Struct + 2 A + ) + () + Source + Public + Required + .false. + ) + }) + update_1 + (FunctionType + [(Struct + 2 A + )] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 205 s)] + [(= + (StructInstanceMember + (Var 205 s) + 203 x + (Integer 4) + () + ) + (IntegerConstant 2 (Integer 4)) + () + ) + (= + (StructInstanceMember + (Var 205 s) + 203 y + (Real 8) + () + ) + (RealConstant + 1.200000 + (Real 8) + ) + () + ) + (= + (StructInstanceMember + (Var 205 s) + 203 z + (Integer 8) + () + ) + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 2 (Integer 8)) + ) + () + ) + (= + (StructInstanceMember + (Var 205 s) + 203 a + (Real 4) + () + ) + (Cast + (RealConstant + 1.200000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 1.200000 + (Real 4) + ) + ) + () + ) + (= + (StructInstanceMember + (Var 205 s) + 203 b + (Integer 2) + () + ) + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToInteger + (Integer 2) + (IntegerConstant 2 (Integer 2)) + ) + () + ) + (= + (StructInstanceMember + (Var 205 s) + 203 c + (Integer 1) + () + ) + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToInteger + (Integer 1) + (IntegerConstant 2 (Integer 1)) + ) + () + )] + () + Public + .false. + .false. + () + ), + update_2: + (Function + (SymbolTable + 206 + { + s: + (Variable + 206 + s + [] + InOut + () + () + Default + (Array + (Struct + 2 A + ) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ) + }) + update_2 + (FunctionType + [(Array + (Struct + 2 A + ) + [(() + ())] + DescriptorArray + )] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 206 s)] + [(= + (StructInstanceMember + (ArrayItem + (Var 206 s) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Struct + 2 A + ) + RowMajor + () + ) + 203 x + (Integer 4) + () + ) + (IntegerConstant 3 (Integer 4)) + () + ) + (= + (StructInstanceMember + (ArrayItem + (Var 206 s) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Struct + 2 A + ) + RowMajor + () + ) + 203 y + (Real 8) + () + ) + (RealConstant + 2.300000 + (Real 8) + ) + () + ) + (= + (StructInstanceMember + (ArrayItem + (Var 206 s) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Struct + 2 A + ) + RowMajor + () + ) + 203 z + (Integer 8) + () + ) + (Cast + (IntegerConstant 3 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 3 (Integer 8)) + ) + () + ) + (= + (StructInstanceMember + (ArrayItem + (Var 206 s) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Struct + 2 A + ) + RowMajor + () + ) + 203 a + (Real 4) + () + ) + (Cast + (RealConstant + 2.300000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 2.300000 + (Real 4) + ) + ) + () + ) + (= + (StructInstanceMember + (ArrayItem + (Var 206 s) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Struct + 2 A + ) + RowMajor + () + ) + 203 b + (Integer 2) + () + ) + (Cast + (IntegerConstant 3 (Integer 4)) + IntegerToInteger + (Integer 2) + (IntegerConstant 3 (Integer 2)) + ) + () + ) + (= + (StructInstanceMember + (ArrayItem + (Var 206 s) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Struct + 2 A + ) + RowMajor + () + ) + 203 c + (Integer 1) + () + ) + (Cast + (IntegerConstant 3 (Integer 4)) + IntegerToInteger + (Integer 1) + (IntegerConstant 3 (Integer 1)) + ) + () + )] + () + Public + .false. + .false. + () + ), + verify: + (Function + (SymbolTable + 204 + { + eps: + (Variable + 204 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + s: + (Variable + 204 + s + [] + InOut + () + () + Default + (Array + (Struct + 2 A + ) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + s0: + (Variable + 204 + s0 + [] + Local + () + () + Default + (Struct + 2 A + ) + () + Source + Public + Required + .false. + ), + s1: + (Variable + 204 + s1 + [] + Local + () + () + Default + (Struct + 2 A + ) + () + Source + Public + Required + .false. + ), + x1: + (Variable + 204 + x1 + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + x2: + (Variable + 204 + x2 + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + y1: + (Variable + 204 + y1 + [] + In + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + y2: + (Variable + 204 + y2 + [] + In + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ) + }) + verify + (FunctionType + [(Array + (Struct + 2 A + ) + [(() + ())] + DescriptorArray + ) + (Integer 4) + (Real 8) + (Integer 4) + (Real 8)] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 204 s) + (Var 204 x1) + (Var 204 y1) + (Var 204 x2) + (Var 204 y2)] + [(= + (Var 204 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (= + (Var 204 s0) + (ArrayItem + (Var 204 s) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Struct + 2 A + ) + RowMajor + () + ) + () + ) + (Print + () + [(StructInstanceMember + (Var 204 s0) + 203 x + (Integer 4) + () + ) + (StructInstanceMember + (Var 204 s0) + 203 y + (Real 8) + () + ) + (StructInstanceMember + (Var 204 s0) + 203 z + (Integer 8) + () + ) + (StructInstanceMember + (Var 204 s0) + 203 a + (Real 4) + () + ) + (StructInstanceMember + (Var 204 s0) + 203 b + (Integer 2) + () + ) + (StructInstanceMember + (Var 204 s0) + 203 c + (Integer 1) + () + ) + (StructInstanceMember + (Var 204 s0) + 203 d + (Logical 4) + () + )] + () + () + ) + (Assert + (IntegerCompare + (StructInstanceMember + (Var 204 s0) + 203 x + (Integer 4) + () + ) + Eq + (Var 204 x1) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (StructInstanceMember + (Var 204 s0) + 203 y + (Real 8) + () + ) + Sub + (Var 204 y1) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + Lt + (Var 204 eps) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (StructInstanceMember + (Var 204 s0) + 203 z + (Integer 8) + () + ) + Eq + (Cast + (Var 204 x1) + IntegerToInteger + (Integer 8) + () + ) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (StructInstanceMember + (Var 204 s0) + 203 a + (Real 4) + () + ) + Sub + (Cast + (Var 204 y1) + RealToReal + (Real 4) + () + ) + (Real 4) + () + )] + 0 + (Real 4) + () + ) + Lt + (Cast + (RealConstant + 0.000001 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 0.000001 + (Real 4) + ) + ) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (StructInstanceMember + (Var 204 s0) + 203 b + (Integer 2) + () + ) + Eq + (Cast + (Var 204 x1) + IntegerToInteger + (Integer 2) + () + ) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (StructInstanceMember + (Var 204 s0) + 203 c + (Integer 1) + () + ) + Eq + (Cast + (Var 204 x1) + IntegerToInteger + (Integer 1) + () + ) + (Logical 4) + () + ) + () + ) + (Assert + (StructInstanceMember + (Var 204 s0) + 203 d + (Logical 4) + () + ) + () + ) + (= + (Var 204 s1) + (ArrayItem + (Var 204 s) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Struct + 2 A + ) + RowMajor + () + ) + () + ) + (Print + () + [(StructInstanceMember + (Var 204 s1) + 203 x + (Integer 4) + () + ) + (StructInstanceMember + (Var 204 s1) + 203 y + (Real 8) + () + ) + (StructInstanceMember + (Var 204 s1) + 203 z + (Integer 8) + () + ) + (StructInstanceMember + (Var 204 s1) + 203 a + (Real 4) + () + ) + (StructInstanceMember + (Var 204 s1) + 203 b + (Integer 2) + () + ) + (StructInstanceMember + (Var 204 s1) + 203 c + (Integer 1) + () + ) + (StructInstanceMember + (Var 204 s1) + 203 d + (Logical 4) + () + )] + () + () + ) + (Assert + (IntegerCompare + (StructInstanceMember + (Var 204 s1) + 203 x + (Integer 4) + () + ) + Eq + (Var 204 x2) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (StructInstanceMember + (Var 204 s1) + 203 y + (Real 8) + () + ) + Sub + (Var 204 y2) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + Lt + (Var 204 eps) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (StructInstanceMember + (Var 204 s1) + 203 z + (Integer 8) + () + ) + Eq + (Cast + (Var 204 x2) + IntegerToInteger + (Integer 8) + () + ) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (StructInstanceMember + (Var 204 s1) + 203 a + (Real 4) + () + ) + Sub + (Cast + (Var 204 y2) + RealToReal + (Real 4) + () + ) + (Real 4) + () + )] + 0 + (Real 4) + () + ) + Lt + (Cast + (RealConstant + 0.000001 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 0.000001 + (Real 4) + ) + ) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (StructInstanceMember + (Var 204 s1) + 203 b + (Integer 2) + () + ) + Eq + (Cast + (Var 204 x2) + IntegerToInteger + (Integer 2) + () + ) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (StructInstanceMember + (Var 204 s1) + 203 c + (Integer 1) + () + ) + Eq + (Cast + (Var 204 x2) + IntegerToInteger + (Integer 1) + () + ) + (Logical 4) + () + ) + () + ) + (Assert + (StructInstanceMember + (Var 204 s1) + 203 d + (Logical 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [numpy] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 210 + { + __main__global_stmts: + (ExternalSymbol + 210 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 210 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ), + numpy: + (Module numpy) + }) + [] +) diff --git a/tests/reference/asr-test_assign8-4b26e63.json b/tests/reference/asr-test_assign8-4b26e63.json index 3b0ecbbcd1..fb449632d9 100644 --- a/tests/reference/asr-test_assign8-4b26e63.json +++ b/tests/reference/asr-test_assign8-4b26e63.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_assign8-4b26e63.stderr", - "stderr_hash": "900fcd6359806b1e7ab41b6c5c4eb252bdbab6e96404912b710a8682", + "stderr_hash": "c8ad8a6c89a23c0e2bd0cbaf7c9568625f093e526ff8ff26ae300e07", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_assign8-4b26e63.stderr b/tests/reference/asr-test_assign8-4b26e63.stderr index e320bd3600..dcb47d9356 100644 --- a/tests/reference/asr-test_assign8-4b26e63.stderr +++ b/tests/reference/asr-test_assign8-4b26e63.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> tests/errors/test_assign8.py:5:13 +semantic error: readonly attribute + --> tests/errors/test_assign8.py:6:5 | -5 | c = c32(complex(3, 4)) - | ^^^^^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +6 | c.real = 5.0 + | ^^^^^^^^^^^^ diff --git a/tests/reference/asr-test_binop3-a67201d.json b/tests/reference/asr-test_binop3-a67201d.json index b93163a529..dc238a62cb 100644 --- a/tests/reference/asr-test_binop3-a67201d.json +++ b/tests/reference/asr-test_binop3-a67201d.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_binop3-a67201d.stderr", - "stderr_hash": "00ec81e32ad3b0d4145714c7224146e9af7fd913aa87aa633667f4f2", + "stderr_hash": "ff683b1bc0695903f2d2ea7bbd1963346fcb5f84bbfd10a4da0e27d7", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_binop3-a67201d.stderr b/tests/reference/asr-test_binop3-a67201d.stderr index ea6ee12b1c..84e374e2f5 100644 --- a/tests/reference/asr-test_binop3-a67201d.stderr +++ b/tests/reference/asr-test_binop3-a67201d.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +semantic error: Type mismatch in binary operator; the types must be compatible --> tests/errors/test_binop3.py:5:9 | 5 | y = complex(5)+100 - | ^^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ + | ^^^^^^^^^^ ^^^ type mismatch (c32 and i32) diff --git a/tests/reference/asr-test_bool_binop-f856ef0.json b/tests/reference/asr-test_bool_binop-f856ef0.json index 358216f8de..b74825e8d7 100644 --- a/tests/reference/asr-test_bool_binop-f856ef0.json +++ b/tests/reference/asr-test_bool_binop-f856ef0.json @@ -5,9 +5,9 @@ "infile_hash": "7c44fe2915b3871b3b85edf3ab129d87a75fa4b9acbb597ae801daf9", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_bool_binop-f856ef0.stderr", - "stderr_hash": "7e1f44ed79212fae132aca28b495a511f27ee327b9bf88b797502eff", - "returncode": 2 + "stdout": "asr-test_bool_binop-f856ef0.stdout", + "stdout_hash": "b2d6b1205576cabc7c44ae611eec55ba5af026dbd918972e05e8f7da", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_bool_binop-f856ef0.stdout b/tests/reference/asr-test_bool_binop-f856ef0.stdout new file mode 100644 index 0000000000..f93267c185 --- /dev/null +++ b/tests/reference/asr-test_bool_binop-f856ef0.stdout @@ -0,0 +1,442 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 4 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [f] + [] + [(SubroutineCall + 2 f + () + [] + () + )] + () + Public + .false. + .false. + () + ), + f: + (Function + (SymbolTable + 3 + { + b1: + (Variable + 3 + b1 + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + b2: + (Variable + 3 + b2 + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + f: + (Variable + 3 + f + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + i: + (Variable + 3 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + f + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 3 i) + (IntegerBinOp + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + Add + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 3 i) + Eq + (IntegerConstant 2 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i) + (IntegerBinOp + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + Sub + (Cast + (LogicalConstant + .false. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 3 i) + Eq + (IntegerConstant 1 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i) + (IntegerBinOp + (Cast + (LogicalConstant + .false. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + Mul + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 3 i) + Eq + (IntegerConstant 0 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i) + (Cast + (IntrinsicScalarFunction + FloorDiv + [(LogicalConstant + .true. + (Logical 4) + ) + (LogicalConstant + .true. + (Logical 4) + )] + 0 + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + LogicalToInteger + (Integer 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 3 i) + Eq + (IntegerConstant 1 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i) + (Cast + (IntrinsicScalarFunction + FloorDiv + [(LogicalConstant + .false. + (Logical 4) + ) + (LogicalConstant + .true. + (Logical 4) + )] + 0 + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + LogicalToInteger + (Integer 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 3 i) + Eq + (IntegerConstant 0 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i) + (IntegerBinOp + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + Pow + (Cast + (LogicalConstant + .true. + (Logical 4) + ) + LogicalToInteger + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Var 3 i) + Eq + (IntegerConstant 1 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 b1) + (LogicalConstant + .false. + (Logical 4) + ) + () + ) + (= + (Var 3 b2) + (LogicalConstant + .true. + (Logical 4) + ) + () + ) + (= + (Var 3 f) + (RealBinOp + (Cast + (Var 3 b1) + LogicalToReal + (Real 8) + () + ) + Div + (Cast + (Var 3 b2) + LogicalToReal + (Real 8) + () + ) + (Real 8) + () + ) + () + ) + (Assert + (RealCompare + (Var 3 f) + Eq + (RealConstant + 0.000000 + (Real 8) + ) + (Logical 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [] + .false. + .false. + ), + main_program: + (Program + (SymbolTable + 5 + { + __main__global_stmts: + (ExternalSymbol + 5 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 5 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-test_builtin_bin-52ba9fa.json b/tests/reference/asr-test_builtin_bin-52ba9fa.json index f617a29848..8df970ff34 100644 --- a/tests/reference/asr-test_builtin_bin-52ba9fa.json +++ b/tests/reference/asr-test_builtin_bin-52ba9fa.json @@ -5,9 +5,9 @@ "infile_hash": "09e09eacf697c95f358b75f6491b766781bae9a5f856c2ad5848e824", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_builtin_bin-52ba9fa.stderr", - "stderr_hash": "f96ee9f35d47046bca3a9f0e40b965bf1b0e6654a0a4da0eb7a85e30", - "returncode": 2 + "stdout": "asr-test_builtin_bin-52ba9fa.stdout", + "stdout_hash": "b24a5d440f16330d7a86bade0cac3c8ffc51adb5e0946a1b318a9b4b", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_bin-52ba9fa.stdout b/tests/reference/asr-test_builtin_bin-52ba9fa.stdout new file mode 100644 index 0000000000..fd4442df87 --- /dev/null +++ b/tests/reference/asr-test_builtin_bin-52ba9fa.stdout @@ -0,0 +1,271 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 121 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_bin] + [] + [(SubroutineCall + 2 test_bin + () + [] + () + )] + () + Public + .false. + .false. + () + ), + test_bin: + (Function + (SymbolTable + 3 + { + bin: + (ExternalSymbol + 3 + bin + 4 bin + lpython_builtin + [] + bin + Private + ), + i: + (Variable + 3 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + test_bin + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [bin] + [] + [(= + (Var 3 i) + (IntegerConstant 5 (Integer 4)) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 bin + () + [((Var 3 i))] + (Character 1 -2 ()) + () + () + ) + Eq + (StringConstant + "0b101" + (Character 1 5 ()) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i) + (IntegerConstant 64 (Integer 4)) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 bin + () + [((Var 3 i))] + (Character 1 -2 ()) + () + () + ) + Eq + (StringConstant + "0b1000000" + (Character 1 9 ()) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i) + (IntegerUnaryMinus + (IntegerConstant 534 (Integer 4)) + (Integer 4) + (IntegerConstant -534 (Integer 4)) + ) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 bin + () + [((Var 3 i))] + (Character 1 -2 ()) + () + () + ) + Eq + (StringConstant + "-0b1000010110" + (Character 1 13 ()) + ) + (Logical 4) + () + ) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 bin + () + [((IntegerConstant 64 (Integer 4)))] + (Character 1 -2 ()) + (StringConstant + "0b1000000" + (Character 1 9 ()) + ) + () + ) + Eq + (StringConstant + "0b1000000" + (Character 1 9 ()) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 bin + () + [((IntegerUnaryMinus + (IntegerConstant 534 (Integer 4)) + (Integer 4) + (IntegerConstant -534 (Integer 4)) + ))] + (Character 1 -2 ()) + (StringConstant + "-0b1000010110" + (Character 1 13 ()) + ) + () + ) + Eq + (StringConstant + "-0b1000010110" + (Character 1 13 ()) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 122 + { + __main__global_stmts: + (ExternalSymbol + 122 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 122 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-test_builtin_bool-330223a.json b/tests/reference/asr-test_builtin_bool-330223a.json index 91858355b1..87e15e8d5d 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.json +++ b/tests/reference/asr-test_builtin_bool-330223a.json @@ -5,9 +5,9 @@ "infile_hash": "3a740faba0e36b55c179ab0fa08486dc3080332e79c8e38b8f25b4a4", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_builtin_bool-330223a.stderr", - "stderr_hash": "5cf42029c7abd7dc2dedc535fff29c622c3871ec342b595c426b27f3", - "returncode": 2 + "stdout": "asr-test_builtin_bool-330223a.stdout", + "stdout_hash": "b560f8abd927c203883fd0bb66594c4847447dd235e26527b17afe44", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_bool-330223a.stdout b/tests/reference/asr-test_builtin_bool-330223a.stdout new file mode 100644 index 0000000000..9af36dd1ef --- /dev/null +++ b/tests/reference/asr-test_builtin_bool-330223a.stdout @@ -0,0 +1,896 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 121 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_bool] + [] + [(SubroutineCall + 2 test_bool + () + [] + () + )] + () + Public + .false. + .false. + () + ), + test_bool: + (Function + (SymbolTable + 3 + { + a: + (Variable + 3 + a + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + a2: + (Variable + 3 + a2 + [] + Local + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ), + a3: + (Variable + 3 + a3 + [] + Local + () + () + Default + (Integer 1) + () + Source + Public + Required + .false. + ), + a4: + (Variable + 3 + a4 + [] + Local + () + () + Default + (Integer 2) + () + Source + Public + Required + .false. + ), + b: + (Variable + 3 + b + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + c: + (Variable + 3 + c + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ), + c1: + (Variable + 3 + c1 + [] + Local + () + () + Default + (Complex 8) + () + Source + Public + Required + .false. + ), + complex: + (ExternalSymbol + 3 + complex + 4 complex + lpython_builtin + [] + complex + Private + ), + complex@__lpython_overloaded_13__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_13__complex + 4 __lpython_overloaded_13__complex + lpython_builtin + [] + __lpython_overloaded_13__complex + Public + ), + complex@__lpython_overloaded_9__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_9__complex + 4 __lpython_overloaded_9__complex + lpython_builtin + [] + __lpython_overloaded_9__complex + Public + ), + f: + (Variable + 3 + f + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + f2: + (Variable + 3 + f2 + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + s: + (Variable + 3 + s + [] + Local + () + () + Default + (Character 1 -2 ()) + () + Source + Public + Required + .false. + ) + }) + test_bool + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [complex@__lpython_overloaded_9__complex + complex@__lpython_overloaded_13__complex] + [] + [(= + (Var 3 a) + (IntegerConstant 34 (Integer 4)) + () + ) + (Assert + (Cast + (Var 3 a) + IntegerToLogical + (Logical 4) + () + ) + () + ) + (= + (Var 3 a) + (IntegerConstant 0 (Integer 4)) + () + ) + (Assert + (LogicalNot + (Cast + (Var 3 a) + IntegerToLogical + (Logical 4) + () + ) + (Logical 4) + () + ) + () + ) + (Assert + (Cast + (IntegerUnaryMinus + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant -1 (Integer 4)) + ) + IntegerToLogical + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (LogicalNot + (Cast + (IntegerConstant 0 (Integer 4)) + IntegerToLogical + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a2) + (Cast + (IntegerConstant 34 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 34 (Integer 8)) + ) + () + ) + (Assert + (Cast + (Var 3 a2) + IntegerToLogical + (Logical 4) + () + ) + () + ) + (= + (Var 3 a3) + (Cast + (IntegerConstant 34 (Integer 4)) + IntegerToInteger + (Integer 1) + (IntegerConstant 34 (Integer 1)) + ) + () + ) + (Assert + (Cast + (Var 3 a3) + IntegerToLogical + (Logical 4) + () + ) + () + ) + (= + (Var 3 a4) + (IntegerUnaryMinus + (Cast + (IntegerConstant 1 (Integer 4)) + IntegerToInteger + (Integer 2) + (IntegerConstant 1 (Integer 2)) + ) + (Integer 2) + (IntegerConstant -1 (Integer 2)) + ) + () + ) + (Assert + (Cast + (Var 3 a4) + IntegerToLogical + (Logical 4) + () + ) + () + ) + (= + (Var 3 f) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (Assert + (LogicalNot + (Cast + (Var 3 f) + RealToLogical + (Logical 4) + () + ) + (Logical 4) + () + ) + () + ) + (= + (Var 3 f) + (RealConstant + 1.000000 + (Real 8) + ) + () + ) + (Assert + (Cast + (Var 3 f) + RealToLogical + (Logical 4) + () + ) + () + ) + (Assert + (Cast + (RealConstant + 56.786866 + (Real 8) + ) + RealToLogical + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (LogicalNot + (Cast + (RealConstant + 0.000000 + (Real 8) + ) + RealToLogical + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 f2) + (RealUnaryMinus + (Cast + (RealConstant + 235.600000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 235.600000 + (Real 4) + ) + ) + (Real 4) + (RealConstant + -235.600000 + (Real 4) + ) + ) + () + ) + (Assert + (Cast + (Var 3 f2) + RealToLogical + (Logical 4) + () + ) + () + ) + (= + (Var 3 f2) + (Cast + (RealConstant + 0.000053 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 0.000053 + (Real 4) + ) + ) + () + ) + (Assert + (Cast + (Var 3 f2) + RealToLogical + (Logical 4) + () + ) + () + ) + (= + (Var 3 s) + (StringConstant + "" + (Character 1 0 ()) + ) + () + ) + (Assert + (LogicalNot + (Cast + (Var 3 s) + CharacterToLogical + (Logical 4) + () + ) + (Logical 4) + () + ) + () + ) + (= + (Var 3 s) + (StringConstant + "str" + (Character 1 3 ()) + ) + () + ) + (Assert + (Cast + (Var 3 s) + CharacterToLogical + (Logical 4) + () + ) + () + ) + (Assert + (LogicalNot + (Cast + (StringConstant + "" + (Character 1 0 ()) + ) + CharacterToLogical + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (Cast + (StringConstant + "str" + (Character 1 3 ()) + ) + CharacterToLogical + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 b) + (LogicalConstant + .true. + (Logical 4) + ) + () + ) + (Assert + (Var 3 b) + () + ) + (= + (Var 3 b) + (LogicalConstant + .false. + (Logical 4) + ) + () + ) + (Assert + (LogicalNot + (Var 3 b) + (Logical 4) + () + ) + () + ) + (Assert + (LogicalConstant + .true. + (Logical 4) + ) + () + ) + (Assert + (LogicalNot + (LogicalConstant + .false. + (Logical 4) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 c) + (Cast + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 complex + [((IntegerConstant 2 (Integer 4))) + ((IntegerConstant 3 (Integer 4)))] + (Complex 8) + (ComplexConstant + 2.000000 + 3.000000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 2.000000 + 3.000000 + (Complex 4) + ) + ) + () + ) + (Assert + (Cast + (Var 3 c) + ComplexToLogical + (Logical 4) + () + ) + () + ) + (= + (Var 3 c) + (Cast + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 complex + [((IntegerConstant 0 (Integer 4))) + ((IntegerConstant 0 (Integer 4)))] + (Complex 8) + (ComplexConstant + 0.000000 + 0.000000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 0.000000 + 0.000000 + (Complex 4) + ) + ) + () + ) + (Assert + (LogicalNot + (Cast + (Var 3 c) + ComplexToLogical + (Logical 4) + () + ) + (Logical 4) + () + ) + () + ) + (Assert + (LogicalNot + (Cast + (ComplexBinOp + (Cast + (IntegerConstant 0 (Integer 4)) + IntegerToComplex + (Complex 8) + (ComplexConstant + 0.000000 + 0.000000 + (Complex 8) + ) + ) + Add + (ComplexConstant + 0.000000 + 0.000000 + (Complex 8) + ) + (Complex 8) + (ComplexConstant + 0.000000 + 0.000000 + (Complex 8) + ) + ) + ComplexToLogical + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 c1) + (FunctionCall + 3 complex@__lpython_overloaded_13__complex + 3 complex + [((IntegerConstant 0 (Integer 4))) + ((RealConstant + 0.100202 + (Real 8) + ))] + (Complex 8) + (ComplexConstant + 0.000000 + 0.100202 + (Complex 8) + ) + () + ) + () + ) + (Assert + (Cast + (Var 3 c1) + ComplexToLogical + (Logical 4) + () + ) + () + ) + (Assert + (LogicalNot + (Cast + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 complex + [((IntegerConstant 0 (Integer 4))) + ((IntegerConstant 0 (Integer 4)))] + (Complex 8) + (ComplexConstant + 0.000000 + 0.000000 + (Complex 8) + ) + () + ) + ComplexToLogical + (Logical 4) + (LogicalConstant + .false. + (Logical 4) + ) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (Cast + (ComplexBinOp + (Cast + (IntegerConstant 3 (Integer 4)) + IntegerToComplex + (Complex 8) + (ComplexConstant + 3.000000 + 0.000000 + (Complex 8) + ) + ) + Add + (ComplexConstant + 0.000000 + 5.000000 + (Complex 8) + ) + (Complex 8) + (ComplexConstant + 3.000000 + 5.000000 + (Complex 8) + ) + ) + ComplexToLogical + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 122 + { + __main__global_stmts: + (ExternalSymbol + 122 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 122 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-test_builtin_hex-64bd268.json b/tests/reference/asr-test_builtin_hex-64bd268.json index 2779c11099..15fc72c3c7 100644 --- a/tests/reference/asr-test_builtin_hex-64bd268.json +++ b/tests/reference/asr-test_builtin_hex-64bd268.json @@ -5,9 +5,9 @@ "infile_hash": "e639f0251477f50376536d317630e3c026354859576a5f1b7b10bd7d", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_builtin_hex-64bd268.stderr", - "stderr_hash": "22b2ae7d0d34d2406125547149511ab5990a5f2163c186c48c5c4f05", - "returncode": 2 + "stdout": "asr-test_builtin_hex-64bd268.stdout", + "stdout_hash": "8551293f8c6b8fef1b16f1f47520b59f3c7cc3bec46cdfb0170deaab", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_hex-64bd268.stdout b/tests/reference/asr-test_builtin_hex-64bd268.stdout new file mode 100644 index 0000000000..f9baf4f8cd --- /dev/null +++ b/tests/reference/asr-test_builtin_hex-64bd268.stdout @@ -0,0 +1,246 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 121 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_hex] + [] + [(SubroutineCall + 2 test_hex + () + [] + () + )] + () + Public + .false. + .false. + () + ), + test_hex: + (Function + (SymbolTable + 3 + { + hex: + (ExternalSymbol + 3 + hex + 4 hex + lpython_builtin + [] + hex + Private + ), + i: + (Variable + 3 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + test_hex + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [hex] + [] + [(= + (Var 3 i) + (IntegerConstant 34 (Integer 4)) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 hex + () + [((Var 3 i))] + (Character 1 -2 ()) + () + () + ) + Eq + (StringConstant + "0x22" + (Character 1 4 ()) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i) + (IntegerUnaryMinus + (IntegerConstant 4235 (Integer 4)) + (Integer 4) + (IntegerConstant -4235 (Integer 4)) + ) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 hex + () + [((Var 3 i))] + (Character 1 -2 ()) + () + () + ) + Eq + (StringConstant + "-0x108b" + (Character 1 7 ()) + ) + (Logical 4) + () + ) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 hex + () + [((IntegerConstant 34 (Integer 4)))] + (Character 1 -2 ()) + (StringConstant + "0x22" + (Character 1 4 ()) + ) + () + ) + Eq + (StringConstant + "0x22" + (Character 1 4 ()) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 hex + () + [((IntegerUnaryMinus + (IntegerConstant 4235 (Integer 4)) + (Integer 4) + (IntegerConstant -4235 (Integer 4)) + ))] + (Character 1 -2 ()) + (StringConstant + "-0x108b" + (Character 1 7 ()) + ) + () + ) + Eq + (StringConstant + "-0x108b" + (Character 1 7 ()) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 122 + { + __main__global_stmts: + (ExternalSymbol + 122 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 122 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-test_builtin_oct-20b9066.json b/tests/reference/asr-test_builtin_oct-20b9066.json index bb705fd111..cc40417da8 100644 --- a/tests/reference/asr-test_builtin_oct-20b9066.json +++ b/tests/reference/asr-test_builtin_oct-20b9066.json @@ -5,9 +5,9 @@ "infile_hash": "c20249affa4787edf4ef56c881ebbcabdced311b5b908d9da6aceaeb", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_builtin_oct-20b9066.stderr", - "stderr_hash": "986b90db11399243e0e1a9788da3876cbd8d7eecd273e46bc9437243", - "returncode": 2 + "stdout": "asr-test_builtin_oct-20b9066.stdout", + "stdout_hash": "06bfb11b70b05ca96b4c53dc59a1f55b20c6065b885706668e68c828", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_oct-20b9066.stdout b/tests/reference/asr-test_builtin_oct-20b9066.stdout new file mode 100644 index 0000000000..ee0c1d8cb2 --- /dev/null +++ b/tests/reference/asr-test_builtin_oct-20b9066.stdout @@ -0,0 +1,246 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 121 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_oct] + [] + [(SubroutineCall + 2 test_oct + () + [] + () + )] + () + Public + .false. + .false. + () + ), + test_oct: + (Function + (SymbolTable + 3 + { + i: + (Variable + 3 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + oct: + (ExternalSymbol + 3 + oct + 4 oct + lpython_builtin + [] + oct + Private + ) + }) + test_oct + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [oct] + [] + [(= + (Var 3 i) + (IntegerConstant 34 (Integer 4)) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 oct + () + [((Var 3 i))] + (Character 1 -2 ()) + () + () + ) + Eq + (StringConstant + "0o42" + (Character 1 4 ()) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i) + (IntegerUnaryMinus + (IntegerConstant 4235 (Integer 4)) + (Integer 4) + (IntegerConstant -4235 (Integer 4)) + ) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 oct + () + [((Var 3 i))] + (Character 1 -2 ()) + () + () + ) + Eq + (StringConstant + "-0o10213" + (Character 1 8 ()) + ) + (Logical 4) + () + ) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 oct + () + [((IntegerConstant 34 (Integer 4)))] + (Character 1 -2 ()) + (StringConstant + "0o42" + (Character 1 4 ()) + ) + () + ) + Eq + (StringConstant + "0o42" + (Character 1 4 ()) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (StringCompare + (FunctionCall + 3 oct + () + [((IntegerUnaryMinus + (IntegerConstant 4235 (Integer 4)) + (Integer 4) + (IntegerConstant -4235 (Integer 4)) + ))] + (Character 1 -2 ()) + (StringConstant + "-0o10213" + (Character 1 8 ()) + ) + () + ) + Eq + (StringConstant + "-0o10213" + (Character 1 8 ()) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 122 + { + __main__global_stmts: + (ExternalSymbol + 122 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 122 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.json b/tests/reference/asr-test_builtin_pow-f02fcda.json index 5bb87ef22b..558e906c74 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.json +++ b/tests/reference/asr-test_builtin_pow-f02fcda.json @@ -5,9 +5,9 @@ "infile_hash": "b7d1d5e1592f5078961eb228c756e424d394f5f0383a1577f1cced1b", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, + "stdout": "asr-test_builtin_pow-f02fcda.stdout", + "stdout_hash": "07bfe877de2079b68a743854a66f138c21da29943575c0d18c220255", "stderr": "asr-test_builtin_pow-f02fcda.stderr", - "stderr_hash": "6935bb3dd01caf67154e6dee0bb6480b2d3ecb270bc5038444391acc", - "returncode": 2 + "stderr_hash": "859ce76c74748f2d32c7eab92cfbba789a78d4cbf5818646b99806ea", + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.stderr b/tests/reference/asr-test_builtin_pow-f02fcda.stderr index e2d434b6f1..5dbb75ad24 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.stderr +++ b/tests/reference/asr-test_builtin_pow-f02fcda.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/../integration_tests/test_builtin_pow.py:11:16 | 11 | assert i32(pow(a, b)) == 32 - | ^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ + | ^^^^^^^^^ '**' could be used instead diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.stdout b/tests/reference/asr-test_builtin_pow-f02fcda.stdout new file mode 100644 index 0000000000..aabef8b6f5 --- /dev/null +++ b/tests/reference/asr-test_builtin_pow-f02fcda.stdout @@ -0,0 +1,1919 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 121 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_pow] + [] + [(SubroutineCall + 2 test_pow + () + [] + () + )] + () + Public + .false. + .false. + () + ), + test_pow: + (Function + (SymbolTable + 3 + { + a: + (Variable + 3 + a + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + a1: + (Variable + 3 + a1 + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + a2: + (Variable + 3 + a2 + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + b: + (Variable + 3 + b + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + b1: + (Variable + 3 + b1 + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + b2: + (Variable + 3 + b2 + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + c1: + (Variable + 3 + c1 + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ), + complex: + (ExternalSymbol + 3 + complex + 4 complex + lpython_builtin + [] + complex + Private + ), + complex@__lpython_overloaded_9__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_9__complex + 4 __lpython_overloaded_9__complex + lpython_builtin + [] + __lpython_overloaded_9__complex + Public + ), + eps: + (Variable + 3 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + f1: + (Variable + 3 + f1 + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + f2: + (Variable + 3 + f2 + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + i: + (Variable + 3 + i + [] + Local + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ), + i1: + (Variable + 3 + i1 + [] + Local + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ), + i2: + (Variable + 3 + i2 + [] + Local + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ), + j: + (Variable + 3 + j + [] + Local + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ), + k: + (Variable + 3 + k + [] + Local + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ), + p: + (Variable + 3 + p + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + pow: + (ExternalSymbol + 3 + pow + 4 pow + lpython_builtin + [] + pow + Private + ), + pow@__lpython_overloaded_0__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_0__pow + 4 __lpython_overloaded_0__pow + lpython_builtin + [] + __lpython_overloaded_0__pow + Public + ), + pow@__lpython_overloaded_10__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_10__pow + 4 __lpython_overloaded_10__pow + lpython_builtin + [] + __lpython_overloaded_10__pow + Public + ), + pow@__lpython_overloaded_11__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_11__pow + 4 __lpython_overloaded_11__pow + lpython_builtin + [] + __lpython_overloaded_11__pow + Public + ), + pow@__lpython_overloaded_1__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_1__pow + 4 __lpython_overloaded_1__pow + lpython_builtin + [] + __lpython_overloaded_1__pow + Public + ), + pow@__lpython_overloaded_2__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_2__pow + 4 __lpython_overloaded_2__pow + lpython_builtin + [] + __lpython_overloaded_2__pow + Public + ), + pow@__lpython_overloaded_3__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_3__pow + 4 __lpython_overloaded_3__pow + lpython_builtin + [] + __lpython_overloaded_3__pow + Public + ), + pow@__lpython_overloaded_4__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_4__pow + 4 __lpython_overloaded_4__pow + lpython_builtin + [] + __lpython_overloaded_4__pow + Public + ), + pow@__lpython_overloaded_5__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_5__pow + 4 __lpython_overloaded_5__pow + lpython_builtin + [] + __lpython_overloaded_5__pow + Public + ), + pow@__lpython_overloaded_6__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_6__pow + 4 __lpython_overloaded_6__pow + lpython_builtin + [] + __lpython_overloaded_6__pow + Public + ), + pow@__lpython_overloaded_7__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_7__pow + 4 __lpython_overloaded_7__pow + lpython_builtin + [] + __lpython_overloaded_7__pow + Public + ), + pow@__lpython_overloaded_8__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_8__pow + 4 __lpython_overloaded_8__pow + lpython_builtin + [] + __lpython_overloaded_8__pow + Public + ), + pow@__lpython_overloaded_9__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_9__pow + 4 __lpython_overloaded_9__pow + lpython_builtin + [] + __lpython_overloaded_9__pow + Public + ), + x: + (Variable + 3 + x + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + y: + (Variable + 3 + y + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ) + }) + test_pow + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [pow@__lpython_overloaded_0__pow + pow@__lpython_overloaded_1__pow + pow@__lpython_overloaded_2__pow + pow@__lpython_overloaded_4__pow + pow@__lpython_overloaded_5__pow + pow@__lpython_overloaded_8__pow + pow@__lpython_overloaded_3__pow + pow@__lpython_overloaded_6__pow + pow@__lpython_overloaded_7__pow + pow@__lpython_overloaded_11__pow + pow@__lpython_overloaded_10__pow + complex@__lpython_overloaded_9__complex + pow@__lpython_overloaded_9__pow] + [] + [(= + (Var 3 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (= + (Var 3 a) + (IntegerConstant 2 (Integer 4)) + () + ) + (= + (Var 3 b) + (IntegerConstant 5 (Integer 4)) + () + ) + (Assert + (IntegerCompare + (Cast + (FunctionCall + 3 pow@__lpython_overloaded_0__pow + 3 pow + [((Var 3 a)) + ((Var 3 b))] + (Real 8) + () + () + ) + RealToInteger + (Integer 4) + () + ) + Eq + (IntegerConstant 32 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 a) + (IntegerConstant 6 (Integer 4)) + () + ) + (= + (Var 3 b) + (IntegerConstant 3 (Integer 4)) + () + ) + (Assert + (IntegerCompare + (Cast + (FunctionCall + 3 pow@__lpython_overloaded_0__pow + 3 pow + [((Var 3 a)) + ((Var 3 b))] + (Real 8) + () + () + ) + RealToInteger + (Integer 4) + () + ) + Eq + (IntegerConstant 216 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 a) + (IntegerConstant 2 (Integer 4)) + () + ) + (= + (Var 3 b) + (IntegerConstant 0 (Integer 4)) + () + ) + (Assert + (IntegerCompare + (Cast + (FunctionCall + 3 pow@__lpython_overloaded_0__pow + 3 pow + [((Var 3 a)) + ((Var 3 b))] + (Real 8) + () + () + ) + RealToInteger + (Integer 4) + () + ) + Eq + (IntegerConstant 1 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 a) + (IntegerConstant 2 (Integer 4)) + () + ) + (= + (Var 3 b) + (IntegerUnaryMinus + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant -1 (Integer 4)) + ) + () + ) + (= + (Var 3 a) + (IntegerConstant 6 (Integer 4)) + () + ) + (= + (Var 3 b) + (IntegerUnaryMinus + (IntegerConstant 4 (Integer 4)) + (Integer 4) + (IntegerConstant -4 (Integer 4)) + ) + () + ) + (= + (Var 3 i1) + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 2 (Integer 8)) + ) + () + ) + (= + (Var 3 i2) + (Cast + (IntegerConstant 5 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 5 (Integer 8)) + ) + () + ) + (Assert + (IntegerCompare + (Cast + (FunctionCall + 3 pow@__lpython_overloaded_1__pow + 3 pow + [((Var 3 i1)) + ((Var 3 i2))] + (Real 8) + () + () + ) + RealToInteger + (Integer 8) + () + ) + Eq + (Cast + (IntegerConstant 32 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 32 (Integer 8)) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i1) + (Cast + (IntegerConstant 6 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 6 (Integer 8)) + ) + () + ) + (= + (Var 3 i2) + (IntegerUnaryMinus + (Cast + (IntegerConstant 3 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 3 (Integer 8)) + ) + (Integer 8) + (IntegerConstant -3 (Integer 8)) + ) + () + ) + (= + (Var 3 f1) + (Cast + (RealBinOp + (Cast + (IntegerConstant 525346 (Integer 4)) + IntegerToReal + (Real 8) + (RealConstant + 525346.000000 + (Real 8) + ) + ) + Div + (Cast + (IntegerConstant 66456 (Integer 4)) + IntegerToReal + (Real 8) + (RealConstant + 66456.000000 + (Real 8) + ) + ) + (Real 8) + (RealConstant + 7.905170 + (Real 8) + ) + ) + RealToReal + (Real 4) + (RealConstant + 7.905170 + (Real 4) + ) + ) + () + ) + (= + (Var 3 f2) + (Cast + (RealConstant + 3.000000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 3.000000 + (Real 4) + ) + ) + () + ) + (= + (Var 3 p) + (FunctionCall + 3 pow@__lpython_overloaded_2__pow + 3 pow + [((Var 3 f1)) + ((Var 3 f2))] + (Real 4) + () + () + ) + () + ) + (= + (Var 3 f1) + (FunctionCall + 3 pow@__lpython_overloaded_4__pow + 3 pow + [((Var 3 a)) + ((Var 3 f2))] + (Real 4) + () + () + ) + () + ) + (= + (Var 3 f1) + (FunctionCall + 3 pow@__lpython_overloaded_5__pow + 3 pow + [((Var 3 f2)) + ((Var 3 a))] + (Real 4) + () + () + ) + () + ) + (= + (Var 3 b1) + (LogicalConstant + .true. + (Logical 4) + ) + () + ) + (= + (Var 3 b2) + (LogicalConstant + .false. + (Logical 4) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 pow@__lpython_overloaded_8__pow + 3 pow + [((Var 3 b1)) + ((Var 3 b2))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 1 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 pow@__lpython_overloaded_8__pow + 3 pow + [((Var 3 b2)) + ((Var 3 b1))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 0 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 pow@__lpython_overloaded_8__pow + 3 pow + [((Var 3 b1)) + ((Var 3 b2))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 1 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 pow@__lpython_overloaded_8__pow + 3 pow + [((LogicalConstant + .false. + (Logical 4) + )) + ((LogicalConstant + .false. + (Logical 4) + ))] + (Integer 4) + (IntegerConstant 1 (Integer 4)) + () + ) + Eq + (IntegerConstant 1 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 a1) + (RealConstant + 4.500000 + (Real 8) + ) + () + ) + (= + (Var 3 a2) + (RealConstant + 2.300000 + (Real 8) + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_3__pow + 3 pow + [((Var 3 a1)) + ((Var 3 a2))] + (Real 8) + () + () + ) + Sub + (RealConstant + 31.797193 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_3__pow + 3 pow + [((Var 3 a2)) + ((Var 3 a1))] + (Real 8) + () + () + ) + Sub + (RealConstant + 42.439989 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (= + (Var 3 x) + (IntegerConstant 3 (Integer 4)) + () + ) + (= + (Var 3 y) + (RealConstant + 2.300000 + (Real 8) + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_6__pow + 3 pow + [((Var 3 x)) + ((Var 3 y))] + (Real 8) + () + () + ) + Sub + (RealConstant + 12.513503 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_7__pow + 3 pow + [((Var 3 y)) + ((Var 3 x))] + (Real 8) + () + () + ) + Sub + (RealConstant + 12.167000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_6__pow + 3 pow + [((Var 3 x)) + ((RealConstant + 5.500000 + (Real 8) + ))] + (Real 8) + () + () + ) + Sub + (RealConstant + 420.888346 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_1__pow + 3 pow + [((Cast + (IntegerConstant 2 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 2 (Integer 8)) + )) + ((IntegerUnaryMinus + (Cast + (IntegerConstant 1 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 1 (Integer 8)) + ) + (Integer 8) + (IntegerConstant -1 (Integer 8)) + ))] + (Real 8) + (RealConstant + 0.500000 + (Real 8) + ) + () + ) + Sub + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_1__pow + 3 pow + [((Cast + (IntegerConstant 6 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 6 (Integer 8)) + )) + ((IntegerUnaryMinus + (Cast + (IntegerConstant 4 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 4 (Integer 8)) + ) + (Integer 8) + (IntegerConstant -4 (Integer 8)) + ))] + (Real 8) + (RealConstant + 0.000772 + (Real 8) + ) + () + ) + Sub + (RealConstant + 0.000772 + (Real 8) + ) + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_1__pow + 3 pow + [((IntegerUnaryMinus + (Cast + (IntegerConstant 3 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 3 (Integer 8)) + ) + (Integer 8) + (IntegerConstant -3 (Integer 8)) + )) + ((IntegerUnaryMinus + (Cast + (IntegerConstant 5 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 5 (Integer 8)) + ) + (Integer 8) + (IntegerConstant -5 (Integer 8)) + ))] + (Real 8) + (RealConstant + -0.004115 + (Real 8) + ) + () + ) + Add + (RealConstant + 0.004115 + (Real 8) + ) + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_1__pow + 3 pow + [((Cast + (IntegerConstant 6 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 6 (Integer 8)) + )) + ((IntegerUnaryMinus + (Cast + (IntegerConstant 4 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 4 (Integer 8)) + ) + (Integer 8) + (IntegerConstant -4 (Integer 8)) + ))] + (Real 8) + (RealConstant + 0.000772 + (Real 8) + ) + () + ) + Sub + (RealConstant + 0.000772 + (Real 8) + ) + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_3__pow + 3 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) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_3__pow + 3 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) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_3__pow + 3 pow + [((RealConstant + 2.300000 + (Real 8) + )) + ((RealUnaryMinus + (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) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_6__pow + 3 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) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_6__pow + 3 pow + [((IntegerConstant 2 (Integer 4))) + ((RealUnaryMinus + (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) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_7__pow + 3 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) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_7__pow + 3 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) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (Cast + (FunctionCall + 3 pow@__lpython_overloaded_0__pow + 3 pow + [((IntegerConstant 4 (Integer 4))) + ((IntegerConstant 2 (Integer 4)))] + (Real 8) + (RealConstant + 16.000000 + (Real 8) + ) + () + ) + RealToInteger + (Integer 4) + (IntegerConstant 16 (Integer 4)) + ) + Eq + (IntegerConstant 16 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (FunctionCall + 3 pow@__lpython_overloaded_7__pow + 3 pow + [((RealUnaryMinus + (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) + ) + )] + 0 + (Real 8) + (RealConstant + 0.000000 + (Real 8) + ) + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i) + (Cast + (IntegerConstant 7 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 7 (Integer 8)) + ) + () + ) + (= + (Var 3 j) + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 2 (Integer 8)) + ) + () + ) + (= + (Var 3 k) + (Cast + (IntegerConstant 5 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 5 (Integer 8)) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 pow@__lpython_overloaded_11__pow + 3 pow + [((Var 3 i)) + ((Var 3 j)) + ((Var 3 k))] + (Integer 8) + () + () + ) + Eq + (Cast + (IntegerConstant 4 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 4 (Integer 8)) + ) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 pow@__lpython_overloaded_10__pow + 3 pow + [((IntegerConstant 102 (Integer 4))) + ((IntegerConstant 3 (Integer 4))) + ((IntegerConstant 121 (Integer 4)))] + (Integer 4) + (RealConstant + 38.000000 + (Real 8) + ) + () + ) + Eq + (IntegerConstant 38 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 c1) + (Cast + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 complex + [((IntegerConstant 4 (Integer 4))) + ((IntegerConstant 5 (Integer 4)))] + (Complex 8) + (ComplexConstant + 4.000000 + 5.000000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 4.000000 + 5.000000 + (Complex 4) + ) + ) + () + ) + (= + (Var 3 c1) + (FunctionCall + 3 pow@__lpython_overloaded_9__pow + 3 pow + [((Var 3 c1)) + ((IntegerConstant 4 (Integer 4)))] + (Complex 4) + () + () + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 122 + { + __main__global_stmts: + (ExternalSymbol + 122 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 122 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-test_builtin_round-7417a21.json b/tests/reference/asr-test_builtin_round-7417a21.json index efcd6cc31e..debc729721 100644 --- a/tests/reference/asr-test_builtin_round-7417a21.json +++ b/tests/reference/asr-test_builtin_round-7417a21.json @@ -5,9 +5,9 @@ "infile_hash": "a4ff4032a45ce084eb524069046afb6ec44f1b24a667c84c7605f2c7", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_builtin_round-7417a21.stderr", - "stderr_hash": "a58af3b9f4312b1036b728dc70928fe9c05f87d1b96d92b5c3da881f", - "returncode": 2 + "stdout": "asr-test_builtin_round-7417a21.stdout", + "stdout_hash": "8ec417ebc27049f4972e2c81e79c94f0983df641747977d0cfd8e5ff", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_builtin_round-7417a21.stdout b/tests/reference/asr-test_builtin_round-7417a21.stdout new file mode 100644 index 0000000000..093b8fb207 --- /dev/null +++ b/tests/reference/asr-test_builtin_round-7417a21.stdout @@ -0,0 +1,919 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 121 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_round] + [] + [(SubroutineCall + 2 test_round + () + [] + () + )] + () + Public + .false. + .false. + () + ), + test_round: + (Function + (SymbolTable + 3 + { + b: + (Variable + 3 + b + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + f: + (Variable + 3 + f + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + f2: + (Variable + 3 + f2 + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + i: + (Variable + 3 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + i2: + (Variable + 3 + i2 + [] + Local + () + () + Default + (Integer 1) + () + Source + Public + Required + .false. + ), + i3: + (Variable + 3 + i3 + [] + Local + () + () + Default + (Integer 2) + () + Source + Public + Required + .false. + ), + i4: + (Variable + 3 + i4 + [] + Local + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ), + round: + (ExternalSymbol + 3 + round + 4 round + lpython_builtin + [] + round + Private + ), + round@__lpython_overloaded_0__round: + (ExternalSymbol + 3 + round@__lpython_overloaded_0__round + 4 __lpython_overloaded_0__round + lpython_builtin + [] + __lpython_overloaded_0__round + Public + ), + round@__lpython_overloaded_1__round: + (ExternalSymbol + 3 + round@__lpython_overloaded_1__round + 4 __lpython_overloaded_1__round + lpython_builtin + [] + __lpython_overloaded_1__round + Public + ), + round@__lpython_overloaded_2__round: + (ExternalSymbol + 3 + round@__lpython_overloaded_2__round + 4 __lpython_overloaded_2__round + lpython_builtin + [] + __lpython_overloaded_2__round + Public + ), + round@__lpython_overloaded_3__round: + (ExternalSymbol + 3 + round@__lpython_overloaded_3__round + 4 __lpython_overloaded_3__round + lpython_builtin + [] + __lpython_overloaded_3__round + Public + ), + round@__lpython_overloaded_4__round: + (ExternalSymbol + 3 + round@__lpython_overloaded_4__round + 4 __lpython_overloaded_4__round + lpython_builtin + [] + __lpython_overloaded_4__round + Public + ), + round@__lpython_overloaded_5__round: + (ExternalSymbol + 3 + round@__lpython_overloaded_5__round + 4 __lpython_overloaded_5__round + lpython_builtin + [] + __lpython_overloaded_5__round + Public + ), + round@__lpython_overloaded_6__round: + (ExternalSymbol + 3 + round@__lpython_overloaded_6__round + 4 __lpython_overloaded_6__round + lpython_builtin + [] + __lpython_overloaded_6__round + Public + ) + }) + test_round + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [round@__lpython_overloaded_0__round + round@__lpython_overloaded_1__round + round@__lpython_overloaded_2__round + round@__lpython_overloaded_4__round + round@__lpython_overloaded_5__round + round@__lpython_overloaded_3__round + round@__lpython_overloaded_6__round] + [] + [(= + (Var 3 f) + (RealConstant + 5.678000 + (Real 8) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((Var 3 f))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 6 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 f) + (RealUnaryMinus + (RealConstant + 183745.230000 + (Real 8) + ) + (Real 8) + (RealConstant + -183745.230000 + (Real 8) + ) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((Var 3 f))] + (Integer 4) + () + () + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 183745 (Integer 4)) + (Integer 4) + (IntegerConstant -183745 (Integer 4)) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 3 f) + (RealConstant + 44.340000 + (Real 8) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((Var 3 f))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 44 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 f) + (RealConstant + 0.500000 + (Real 8) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((Var 3 f))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 0 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 f) + (RealUnaryMinus + (RealConstant + 50.500000 + (Real 8) + ) + (Real 8) + (RealConstant + -50.500000 + (Real 8) + ) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((Var 3 f))] + (Integer 4) + () + () + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 50 (Integer 4)) + (Integer 4) + (IntegerConstant -50 (Integer 4)) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 3 f) + (RealConstant + 1.500000 + (Real 8) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((Var 3 f))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 2 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((RealConstant + 13.001000 + (Real 8) + ))] + (Integer 4) + (IntegerConstant 13 (Integer 4)) + () + ) + Eq + (IntegerConstant 13 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((RealUnaryMinus + (RealConstant + 40.499990 + (Real 8) + ) + (Real 8) + (RealConstant + -40.499990 + (Real 8) + ) + ))] + (Integer 4) + (IntegerConstant -40 (Integer 4)) + () + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 40 (Integer 4)) + (Integer 4) + (IntegerConstant -40 (Integer 4)) + ) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((RealConstant + 0.500000 + (Real 8) + ))] + (Integer 4) + (IntegerConstant 0 (Integer 4)) + () + ) + Eq + (IntegerConstant 0 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((RealUnaryMinus + (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 + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((RealConstant + 1.500000 + (Real 8) + ))] + (Integer 4) + (IntegerConstant 2 (Integer 4)) + () + ) + Eq + (IntegerConstant 2 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((RealConstant + 50.500000 + (Real 8) + ))] + (Integer 4) + (IntegerConstant 50 (Integer 4)) + () + ) + Eq + (IntegerConstant 50 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_0__round + 3 round + [((RealConstant + 56.780000 + (Real 8) + ))] + (Integer 4) + (IntegerConstant 57 (Integer 4)) + () + ) + Eq + (IntegerConstant 57 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 f2) + (Cast + (RealConstant + 5.678000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 5.678000 + (Real 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_1__round + 3 round + [((Var 3 f2))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 6 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i) + (IntegerUnaryMinus + (IntegerConstant 5 (Integer 4)) + (Integer 4) + (IntegerConstant -5 (Integer 4)) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_2__round + 3 round + [((Var 3 i))] + (Integer 4) + () + () + ) + Eq + (IntegerUnaryMinus + (IntegerConstant 5 (Integer 4)) + (Integer 4) + (IntegerConstant -5 (Integer 4)) + ) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_2__round + 3 round + [((IntegerConstant 4 (Integer 4)))] + (Integer 4) + (IntegerConstant 4 (Integer 4)) + () + ) + Eq + (IntegerConstant 4 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (= + (Var 3 i2) + (Cast + (IntegerConstant 7 (Integer 4)) + IntegerToInteger + (Integer 1) + (IntegerConstant 7 (Integer 1)) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_4__round + 3 round + [((Var 3 i2))] + (Integer 1) + () + () + ) + Eq + (Cast + (IntegerConstant 7 (Integer 4)) + IntegerToInteger + (Integer 1) + (IntegerConstant 7 (Integer 1)) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i3) + (Cast + (IntegerUnaryMinus + (IntegerConstant 8 (Integer 4)) + (Integer 4) + (IntegerConstant -8 (Integer 4)) + ) + IntegerToInteger + (Integer 2) + (IntegerConstant -8 (Integer 2)) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_5__round + 3 round + [((Var 3 i3))] + (Integer 2) + () + () + ) + Eq + (Cast + (IntegerUnaryMinus + (IntegerConstant 8 (Integer 4)) + (Integer 4) + (IntegerConstant -8 (Integer 4)) + ) + IntegerToInteger + (Integer 2) + (IntegerConstant -8 (Integer 2)) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 3 i4) + (Cast + (IntegerConstant 0 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 0 (Integer 8)) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_3__round + 3 round + [((Var 3 i4))] + (Integer 8) + () + () + ) + Eq + (Cast + (IntegerConstant 0 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 0 (Integer 8)) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 3 b) + (LogicalConstant + .true. + (Logical 4) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_6__round + 3 round + [((Var 3 b))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 1 (Integer 4)) + (Logical 4) + () + ) + () + ) + (= + (Var 3 b) + (LogicalConstant + .false. + (Logical 4) + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_6__round + 3 round + [((Var 3 b))] + (Integer 4) + () + () + ) + Eq + (IntegerConstant 0 (Integer 4)) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 round@__lpython_overloaded_6__round + 3 round + [((LogicalConstant + .false. + (Logical 4) + ))] + (Integer 4) + (IntegerConstant 0 (Integer 4)) + () + ) + Eq + (IntegerConstant 0 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 122 + { + __main__global_stmts: + (ExternalSymbol + 122 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 122 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-test_complex_01-a6def58.json b/tests/reference/asr-test_complex_01-a6def58.json index 2a3e22a7fa..ab4945b830 100644 --- a/tests/reference/asr-test_complex_01-a6def58.json +++ b/tests/reference/asr-test_complex_01-a6def58.json @@ -5,9 +5,9 @@ "infile_hash": "e580480b37e5bbfcd01d5eb412375a8a3c1ef374b5fedfb661485763", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_complex_01-a6def58.stderr", - "stderr_hash": "5e372192068e09afc8e388039c24decbd5a11c27b4143b5643bebd10", - "returncode": 2 + "stdout": "asr-test_complex_01-a6def58.stdout", + "stdout_hash": "4ab2fa7e918c8c1e522ff135ff52547786b5dba9449e7eba6bb07c3c", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_complex_01-a6def58.stdout b/tests/reference/asr-test_complex_01-a6def58.stdout new file mode 100644 index 0000000000..97c1c2f37c --- /dev/null +++ b/tests/reference/asr-test_complex_01-a6def58.stdout @@ -0,0 +1,2013 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 125 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [check] + [] + [(SubroutineCall + 2 check + () + [] + () + )] + () + Public + .false. + .false. + () + ), + check: + (Function + (SymbolTable + 7 + { + + }) + check + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_real_imag + test_complex + test_complex_unary_minus + test_complex_not] + [] + [(SubroutineCall + 2 test_real_imag + () + [] + () + ) + (SubroutineCall + 2 test_complex + () + [] + () + ) + (SubroutineCall + 2 test_complex_unary_minus + () + [] + () + ) + (SubroutineCall + 2 test_complex_not + () + [] + () + )] + () + Public + .false. + .false. + () + ), + test_complex: + (Function + (SymbolTable + 4 + { + a: + (Variable + 4 + a + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + a2: + (Variable + 4 + a2 + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + a3: + (Variable + 4 + a3 + [] + Local + () + () + Default + (Real 4) + () + Source + Public + Required + .false. + ), + complex: + (ExternalSymbol + 4 + complex + 8 complex + lpython_builtin + [] + complex + Private + ), + complex@__lpython_overloaded_10__complex: + (ExternalSymbol + 4 + complex@__lpython_overloaded_10__complex + 8 __lpython_overloaded_10__complex + lpython_builtin + [] + __lpython_overloaded_10__complex + Public + ), + complex@__lpython_overloaded_11__complex: + (ExternalSymbol + 4 + complex@__lpython_overloaded_11__complex + 8 __lpython_overloaded_11__complex + lpython_builtin + [] + __lpython_overloaded_11__complex + Public + ), + complex@__lpython_overloaded_12__complex: + (ExternalSymbol + 4 + complex@__lpython_overloaded_12__complex + 8 __lpython_overloaded_12__complex + lpython_builtin + [] + __lpython_overloaded_12__complex + Public + ), + complex@__lpython_overloaded_13__complex: + (ExternalSymbol + 4 + complex@__lpython_overloaded_13__complex + 8 __lpython_overloaded_13__complex + lpython_builtin + [] + __lpython_overloaded_13__complex + Public + ), + complex@__lpython_overloaded_14__complex: + (ExternalSymbol + 4 + complex@__lpython_overloaded_14__complex + 8 __lpython_overloaded_14__complex + lpython_builtin + [] + __lpython_overloaded_14__complex + Public + ), + complex@__lpython_overloaded_5__complex: + (ExternalSymbol + 4 + complex@__lpython_overloaded_5__complex + 8 __lpython_overloaded_5__complex + lpython_builtin + [] + __lpython_overloaded_5__complex + Public + ), + complex@__lpython_overloaded_6__complex: + (ExternalSymbol + 4 + complex@__lpython_overloaded_6__complex + 8 __lpython_overloaded_6__complex + lpython_builtin + [] + __lpython_overloaded_6__complex + Public + ), + complex@__lpython_overloaded_7__complex: + (ExternalSymbol + 4 + complex@__lpython_overloaded_7__complex + 8 __lpython_overloaded_7__complex + lpython_builtin + [] + __lpython_overloaded_7__complex + Public + ), + complex@__lpython_overloaded_8__complex: + (ExternalSymbol + 4 + complex@__lpython_overloaded_8__complex + 8 __lpython_overloaded_8__complex + lpython_builtin + [] + __lpython_overloaded_8__complex + Public + ), + complex@__lpython_overloaded_9__complex: + (ExternalSymbol + 4 + complex@__lpython_overloaded_9__complex + 8 __lpython_overloaded_9__complex + lpython_builtin + [] + __lpython_overloaded_9__complex + Public + ), + eps: + (Variable + 4 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + i1: + (Variable + 4 + i1 + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + i2: + (Variable + 4 + i2 + [] + Local + () + () + Default + (Integer 8) + () + Source + Public + Required + .false. + ), + x: + (Variable + 4 + x + [] + Local + () + () + Default + (Complex 8) + () + Source + Public + Required + .false. + ), + x2: + (Variable + 4 + x2 + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ) + }) + test_complex + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [complex@__lpython_overloaded_5__complex + complex@__lpython_overloaded_9__complex + complex@__lpython_overloaded_13__complex + complex@__lpython_overloaded_14__complex + complex@__lpython_overloaded_6__complex + complex@__lpython_overloaded_7__complex + complex@__lpython_overloaded_8__complex + complex@__lpython_overloaded_11__complex + complex@__lpython_overloaded_10__complex + complex@__lpython_overloaded_12__complex] + [] + [(= + (Var 4 x) + (FunctionCall + 4 complex@__lpython_overloaded_5__complex + 4 complex + [((RealConstant + 4.500000 + (Real 8) + )) + ((RealConstant + 6.700000 + (Real 8) + ))] + (Complex 8) + (ComplexConstant + 4.500000 + 6.700000 + (Complex 8) + ) + () + ) + () + ) + (= + (Var 4 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexRe + (Var 4 x) + (Real 8) + () + ) + Sub + (RealConstant + 4.500000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 4 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexIm + (Var 4 x) + (Real 8) + () + ) + Sub + (RealConstant + 6.700000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 4 eps) + (Logical 4) + () + ) + () + ) + (= + (Var 4 x) + (FunctionCall + 4 complex@__lpython_overloaded_9__complex + 4 complex + [((IntegerUnaryMinus + (IntegerConstant 4 (Integer 4)) + (Integer 4) + (IntegerConstant -4 (Integer 4)) + )) + ((IntegerConstant 2 (Integer 4)))] + (Complex 8) + (ComplexConstant + -4.000000 + 2.000000 + (Complex 8) + ) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexRe + (Var 4 x) + (Real 8) + () + ) + Sub + (RealUnaryMinus + (RealConstant + 4.000000 + (Real 8) + ) + (Real 8) + (RealConstant + -4.000000 + (Real 8) + ) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 4 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexIm + (Var 4 x) + (Real 8) + () + ) + Sub + (RealConstant + 2.000000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 4 eps) + (Logical 4) + () + ) + () + ) + (= + (Var 4 x) + (FunctionCall + 4 complex@__lpython_overloaded_13__complex + 4 complex + [((IntegerConstant 4 (Integer 4))) + ((RealConstant + 7.890000 + (Real 8) + ))] + (Complex 8) + (ComplexConstant + 4.000000 + 7.890000 + (Complex 8) + ) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexRe + (Var 4 x) + (Real 8) + () + ) + Sub + (RealConstant + 4.000000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 4 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexIm + (Var 4 x) + (Real 8) + () + ) + Sub + (RealConstant + 7.890000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 4 eps) + (Logical 4) + () + ) + () + ) + (= + (Var 4 x) + (FunctionCall + 4 complex@__lpython_overloaded_14__complex + 4 complex + [((RealConstant + 5.600000 + (Real 8) + )) + ((IntegerConstant 0 (Integer 4)))] + (Complex 8) + (ComplexConstant + 5.600000 + 0.000000 + (Complex 8) + ) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexRe + (Var 4 x) + (Real 8) + () + ) + Sub + (RealConstant + 5.600000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 4 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexIm + (Var 4 x) + (Real 8) + () + ) + Sub + (RealConstant + 0.000000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 4 eps) + (Logical 4) + () + ) + () + ) + (= + (Var 4 a) + (RealConstant + 534.600000 + (Real 8) + ) + () + ) + (= + (Var 4 x) + (FunctionCall + 4 complex@__lpython_overloaded_5__complex + 4 complex + [((Var 4 a)) + ((RealUnaryMinus + (Var 4 a) + (Real 8) + () + ))] + (Complex 8) + () + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexRe + (Var 4 x) + (Real 8) + () + ) + Sub + (RealConstant + 534.600000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 4 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexIm + (Var 4 x) + (Real 8) + () + ) + Sub + (RealUnaryMinus + (RealConstant + 534.600000 + (Real 8) + ) + (Real 8) + (RealConstant + -534.600000 + (Real 8) + ) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 4 eps) + (Logical 4) + () + ) + () + ) + (= + (Var 4 a2) + (RealUnaryMinus + (Cast + (RealConstant + 423.543081 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 423.543081 + (Real 4) + ) + ) + (Real 4) + (RealConstant + -423.543081 + (Real 4) + ) + ) + () + ) + (= + (Var 4 a3) + (Cast + (RealConstant + 34.500000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 34.500000 + (Real 4) + ) + ) + () + ) + (= + (Var 4 x2) + (FunctionCall + 4 complex@__lpython_overloaded_6__complex + 4 complex + [((Var 4 a2)) + ((Var 4 a3))] + (Complex 4) + () + () + ) + () + ) + (Assert + (RealCompare + (Cast + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexIm + (Var 4 x2) + (Real 4) + () + ) + Sub + (Cast + (RealConstant + 34.500000 + (Real 8) + ) + RealToReal + (Real 4) + (RealConstant + 34.500000 + (Real 4) + ) + ) + (Real 4) + () + )] + 0 + (Real 4) + () + ) + RealToReal + (Real 8) + () + ) + LtE + (Var 4 eps) + (Logical 4) + () + ) + () + ) + (= + (Var 4 i1) + (IntegerUnaryMinus + (IntegerConstant 5 (Integer 4)) + (Integer 4) + (IntegerConstant -5 (Integer 4)) + ) + () + ) + (= + (Var 4 i2) + (IntegerUnaryMinus + (Cast + (IntegerConstant 6 (Integer 4)) + IntegerToInteger + (Integer 8) + (IntegerConstant 6 (Integer 8)) + ) + (Integer 8) + (IntegerConstant -6 (Integer 8)) + ) + () + ) + (= + (Var 4 x) + (FunctionCall + 4 complex@__lpython_overloaded_7__complex + 4 complex + [((Var 4 a3)) + ((Var 4 a))] + (Complex 8) + () + () + ) + () + ) + (= + (Var 4 x) + (FunctionCall + 4 complex@__lpython_overloaded_8__complex + 4 complex + [((Var 4 a)) + ((Var 4 a3))] + (Complex 8) + () + () + ) + () + ) + (= + (Var 4 x) + (FunctionCall + 4 complex@__lpython_overloaded_11__complex + 4 complex + [((Var 4 i1)) + ((Var 4 i2))] + (Complex 8) + () + () + ) + () + ) + (= + (Var 4 x) + (FunctionCall + 4 complex@__lpython_overloaded_9__complex + 4 complex + [((Var 4 i1)) + ((IntegerUnaryMinus + (Var 4 i1) + (Integer 4) + () + ))] + (Complex 8) + () + () + ) + () + ) + (= + (Var 4 x) + (FunctionCall + 4 complex@__lpython_overloaded_10__complex + 4 complex + [((IntegerUnaryMinus + (Var 4 i2) + (Integer 8) + () + )) + ((IntegerUnaryMinus + (Var 4 i2) + (Integer 8) + () + ))] + (Complex 8) + () + () + ) + () + ) + (= + (Var 4 x) + (FunctionCall + 4 complex@__lpython_overloaded_12__complex + 4 complex + [((Var 4 i2)) + ((IntegerUnaryMinus + (Var 4 i1) + (Integer 4) + () + ))] + (Complex 8) + () + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_complex_not: + (Function + (SymbolTable + 6 + { + b: + (Variable + 6 + b + [] + Local + () + () + Default + (Logical 4) + () + Source + Public + Required + .false. + ), + c: + (Variable + 6 + c + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ), + c2: + (Variable + 6 + c2 + [] + Local + () + () + Default + (Complex 8) + () + Source + Public + Required + .false. + ), + complex: + (ExternalSymbol + 6 + complex + 8 complex + lpython_builtin + [] + complex + Private + ), + complex@__lpython_overloaded_9__complex: + (ExternalSymbol + 6 + complex@__lpython_overloaded_9__complex + 8 __lpython_overloaded_9__complex + lpython_builtin + [] + __lpython_overloaded_9__complex + Public + ) + }) + test_complex_not + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [complex@__lpython_overloaded_9__complex] + [] + [(= + (Var 6 c) + (Cast + (FunctionCall + 6 complex@__lpython_overloaded_9__complex + 6 complex + [((IntegerConstant 4 (Integer 4))) + ((IntegerConstant 5 (Integer 4)))] + (Complex 8) + (ComplexConstant + 4.000000 + 5.000000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 4.000000 + 5.000000 + (Complex 4) + ) + ) + () + ) + (= + (Var 6 b) + (LogicalNot + (Cast + (Var 6 c) + ComplexToLogical + (Logical 4) + () + ) + (Logical 4) + () + ) + () + ) + (Assert + (LogicalNot + (Var 6 b) + (Logical 4) + () + ) + () + ) + (= + (Var 6 c2) + (FunctionCall + 6 complex@__lpython_overloaded_9__complex + 6 complex + [((IntegerConstant 0 (Integer 4))) + ((IntegerConstant 0 (Integer 4)))] + (Complex 8) + (ComplexConstant + 0.000000 + 0.000000 + (Complex 8) + ) + () + ) + () + ) + (= + (Var 6 b) + (LogicalNot + (Cast + (Var 6 c2) + ComplexToLogical + (Logical 4) + () + ) + (Logical 4) + () + ) + () + ) + (Assert + (Var 6 b) + () + )] + () + Public + .false. + .false. + () + ), + test_complex_unary_minus: + (Function + (SymbolTable + 5 + { + _c: + (Variable + 5 + _c + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ), + c: + (Variable + 5 + c + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ), + c2: + (Variable + 5 + c2 + [] + Local + () + () + Default + (Complex 8) + () + Source + Public + Required + .false. + ), + complex: + (ExternalSymbol + 5 + complex + 8 complex + lpython_builtin + [] + complex + Private + ), + complex@__lpython_overloaded_13__complex: + (ExternalSymbol + 5 + complex@__lpython_overloaded_13__complex + 8 __lpython_overloaded_13__complex + lpython_builtin + [] + __lpython_overloaded_13__complex + Public + ), + complex@__lpython_overloaded_5__complex: + (ExternalSymbol + 5 + complex@__lpython_overloaded_5__complex + 8 __lpython_overloaded_5__complex + lpython_builtin + [] + __lpython_overloaded_5__complex + Public + ), + complex@__lpython_overloaded_9__complex: + (ExternalSymbol + 5 + complex@__lpython_overloaded_9__complex + 8 __lpython_overloaded_9__complex + lpython_builtin + [] + __lpython_overloaded_9__complex + Public + ) + }) + test_complex_unary_minus + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [complex@__lpython_overloaded_13__complex + complex@__lpython_overloaded_9__complex + complex@__lpython_overloaded_5__complex] + [] + [(= + (Var 5 c) + (Cast + (FunctionCall + 5 complex@__lpython_overloaded_13__complex + 5 complex + [((IntegerConstant 3 (Integer 4))) + ((RealConstant + 4.500000 + (Real 8) + ))] + (Complex 8) + (ComplexConstant + 3.000000 + 4.500000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 3.000000 + 4.500000 + (Complex 4) + ) + ) + () + ) + (= + (Var 5 _c) + (ComplexUnaryMinus + (Var 5 c) + (Complex 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (Cast + (ComplexRe + (Var 5 _c) + (Real 4) + () + ) + RealToReal + (Real 8) + () + ) + Sub + (RealUnaryMinus + (RealConstant + 3.000000 + (Real 8) + ) + (Real 8) + (RealConstant + -3.000000 + (Real 8) + ) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (RealConstant + 0.000000 + (Real 8) + ) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (Cast + (ComplexIm + (Var 5 _c) + (Real 4) + () + ) + RealToReal + (Real 8) + () + ) + Sub + (RealUnaryMinus + (RealConstant + 4.500000 + (Real 8) + ) + (Real 8) + (RealConstant + -4.500000 + (Real 8) + ) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (RealConstant + 0.000000 + (Real 8) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 5 _c) + (Cast + (FunctionCall + 5 complex@__lpython_overloaded_9__complex + 5 complex + [((IntegerConstant 5 (Integer 4))) + ((IntegerUnaryMinus + (IntegerConstant 78 (Integer 4)) + (Integer 4) + (IntegerConstant -78 (Integer 4)) + ))] + (Complex 8) + (ComplexConstant + 5.000000 + -78.000000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 5.000000 + -78.000000 + (Complex 4) + ) + ) + () + ) + (= + (Var 5 _c) + (ComplexUnaryMinus + (Var 5 _c) + (Complex 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (Cast + (ComplexRe + (Var 5 _c) + (Real 4) + () + ) + RealToReal + (Real 8) + () + ) + Sub + (RealUnaryMinus + (RealConstant + 5.000000 + (Real 8) + ) + (Real 8) + (RealConstant + -5.000000 + (Real 8) + ) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (RealConstant + 0.000000 + (Real 8) + ) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (Cast + (ComplexIm + (Var 5 _c) + (Real 4) + () + ) + RealToReal + (Real 8) + () + ) + Sub + (RealConstant + 78.000000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (RealConstant + 0.000000 + (Real 8) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 5 c2) + (FunctionCall + 5 complex@__lpython_overloaded_5__complex + 5 complex + [((RealUnaryMinus + (RealConstant + 4.500000 + (Real 8) + ) + (Real 8) + (RealConstant + -4.500000 + (Real 8) + ) + )) + ((RealUnaryMinus + (RealConstant + 7.800000 + (Real 8) + ) + (Real 8) + (RealConstant + -7.800000 + (Real 8) + ) + ))] + (Complex 8) + (ComplexConstant + -4.500000 + -7.800000 + (Complex 8) + ) + () + ) + () + ) + (= + (Var 5 c2) + (ComplexUnaryMinus + (Var 5 c2) + (Complex 8) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexRe + (Var 5 c2) + (Real 8) + () + ) + Sub + (RealConstant + 4.500000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (RealConstant + 0.000000 + (Real 8) + ) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexIm + (Var 5 c2) + (Real 8) + () + ) + Sub + (RealConstant + 7.800000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (RealConstant + 0.000000 + (Real 8) + ) + (Logical 4) + () + ) + () + ) + (= + (Var 5 c2) + (ComplexBinOp + (Cast + (IntegerConstant 3 (Integer 4)) + IntegerToComplex + (Complex 8) + (ComplexConstant + 3.000000 + 0.000000 + (Complex 8) + ) + ) + Add + (ComplexConstant + 0.000000 + 4.000000 + (Complex 8) + ) + (Complex 8) + (ComplexConstant + 3.000000 + 4.000000 + (Complex 8) + ) + ) + () + ) + (= + (Var 5 c2) + (ComplexUnaryMinus + (Var 5 c2) + (Complex 8) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexRe + (Var 5 c2) + (Real 8) + () + ) + Sub + (RealUnaryMinus + (RealConstant + 3.000000 + (Real 8) + ) + (Real 8) + (RealConstant + -3.000000 + (Real 8) + ) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (RealConstant + 0.000000 + (Real 8) + ) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ComplexIm + (Var 5 c2) + (Real 8) + () + ) + Sub + (RealUnaryMinus + (RealConstant + 4.000000 + (Real 8) + ) + (Real 8) + (RealConstant + -4.000000 + (Real 8) + ) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (RealConstant + 0.000000 + (Real 8) + ) + (Logical 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_real_imag: + (Function + (SymbolTable + 3 + { + a: + (Variable + 3 + a + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + b: + (Variable + 3 + b + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + eps: + (Variable + 3 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + x: + (Variable + 3 + x + [] + Local + () + () + Default + (Complex 8) + () + Source + Public + Required + .false. + ) + }) + test_real_imag + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 3 x) + (ComplexBinOp + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToComplex + (Complex 8) + (ComplexConstant + 2.000000 + 0.000000 + (Complex 8) + ) + ) + Add + (ComplexConstant + 0.000000 + 3.000000 + (Complex 8) + ) + (Complex 8) + (ComplexConstant + 2.000000 + 3.000000 + (Complex 8) + ) + ) + () + ) + (= + (Var 3 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (= + (Var 3 a) + (ComplexRe + (Var 3 x) + (Real 8) + () + ) + () + ) + (= + (Var 3 b) + (ComplexIm + (Var 3 x) + (Real 8) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (Var 3 a) + Sub + (RealConstant + 2.000000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (Var 3 b) + Sub + (RealConstant + 3.000000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 3 eps) + (Logical 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 126 + { + __main__global_stmts: + (ExternalSymbol + 126 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 126 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-test_complex_02-782ba2d.json b/tests/reference/asr-test_complex_02-782ba2d.json index 3fa259e305..aaae96d603 100644 --- a/tests/reference/asr-test_complex_02-782ba2d.json +++ b/tests/reference/asr-test_complex_02-782ba2d.json @@ -5,9 +5,9 @@ "infile_hash": "e6ee66d952deccec11d316a09f1d5b4bb4916ceb56a41a11dee03ae9", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_complex_02-782ba2d.stderr", - "stderr_hash": "dc3a153532aa537903852b8334a63d785edb99a11aff4e951c28b5c6", - "returncode": 2 + "stdout": "asr-test_complex_02-782ba2d.stdout", + "stdout_hash": "9d48f746f6667e237566131eacf2d1892d5bcfa64337722fcfacaaaa", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_complex_02-782ba2d.stdout b/tests/reference/asr-test_complex_02-782ba2d.stdout new file mode 100644 index 0000000000..6580d5d90d --- /dev/null +++ b/tests/reference/asr-test_complex_02-782ba2d.stdout @@ -0,0 +1,718 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 124 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [check] + [] + [(SubroutineCall + 2 check + () + [] + () + )] + () + Public + .false. + .false. + () + ), + check: + (Function + (SymbolTable + 6 + { + + }) + check + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_complex_abs + test_complex_binop_32 + test_complex_binop_64] + [] + [(SubroutineCall + 2 test_complex_abs + () + [] + () + ) + (SubroutineCall + 2 test_complex_binop_32 + () + [] + () + ) + (SubroutineCall + 2 test_complex_binop_64 + () + [] + () + )] + () + Public + .false. + .false. + () + ), + test_complex_abs: + (Function + (SymbolTable + 3 + { + complex: + (ExternalSymbol + 3 + complex + 7 complex + lpython_builtin + [] + complex + Private + ), + complex@__lpython_overloaded_9__complex: + (ExternalSymbol + 3 + complex@__lpython_overloaded_9__complex + 7 __lpython_overloaded_9__complex + lpython_builtin + [] + __lpython_overloaded_9__complex + Public + ), + eps: + (Variable + 3 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + x: + (Variable + 3 + x + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ), + y: + (Variable + 3 + y + [] + Local + () + () + Default + (Complex 8) + () + Source + Public + Required + .false. + ) + }) + test_complex_abs + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [complex@__lpython_overloaded_9__complex] + [] + [(= + (Var 3 x) + (Cast + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 complex + [((IntegerConstant 3 (Integer 4))) + ((IntegerConstant 4 (Integer 4)))] + (Complex 8) + (ComplexConstant + 3.000000 + 4.000000 + (Complex 8) + ) + () + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 3.000000 + 4.000000 + (Complex 4) + ) + ) + () + ) + (= + (Var 3 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (Cast + (IntrinsicScalarFunction + Abs + [(Var 3 x)] + 0 + (Real 4) + () + ) + RealToReal + (Real 8) + () + ) + Sub + (RealConstant + 5.000000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + ) + (= + (Var 3 y) + (FunctionCall + 3 complex@__lpython_overloaded_9__complex + 3 complex + [((IntegerConstant 6 (Integer 4))) + ((IntegerConstant 8 (Integer 4)))] + (Complex 8) + (ComplexConstant + 6.000000 + 8.000000 + (Complex 8) + ) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (IntrinsicScalarFunction + Abs + [(Var 3 y)] + 0 + (Real 8) + () + ) + Sub + (RealConstant + 10.000000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + Lt + (Var 3 eps) + (Logical 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_complex_binop_32: + (Function + (SymbolTable + 4 + { + x: + (Variable + 4 + x + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ), + y: + (Variable + 4 + y + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ), + z: + (Variable + 4 + z + [] + Local + () + () + Default + (Complex 4) + () + Source + Public + Required + .false. + ) + }) + test_complex_binop_32 + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 4 x) + (Cast + (ComplexBinOp + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToComplex + (Complex 8) + (ComplexConstant + 2.000000 + 0.000000 + (Complex 8) + ) + ) + Add + (ComplexConstant + 0.000000 + 3.000000 + (Complex 8) + ) + (Complex 8) + (ComplexConstant + 2.000000 + 3.000000 + (Complex 8) + ) + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 2.000000 + 3.000000 + (Complex 4) + ) + ) + () + ) + (= + (Var 4 y) + (Cast + (ComplexBinOp + (Cast + (IntegerConstant 4 (Integer 4)) + IntegerToComplex + (Complex 8) + (ComplexConstant + 4.000000 + 0.000000 + (Complex 8) + ) + ) + Add + (ComplexConstant + 0.000000 + 5.000000 + (Complex 8) + ) + (Complex 8) + (ComplexConstant + 4.000000 + 5.000000 + (Complex 8) + ) + ) + ComplexToComplex + (Complex 4) + (ComplexConstant + 4.000000 + 5.000000 + (Complex 4) + ) + ) + () + ) + (= + (Var 4 z) + (ComplexBinOp + (Var 4 x) + Add + (Var 4 y) + (Complex 4) + () + ) + () + ) + (= + (Var 4 z) + (ComplexBinOp + (Var 4 x) + Sub + (Var 4 y) + (Complex 4) + () + ) + () + ) + (= + (Var 4 z) + (ComplexBinOp + (Var 4 x) + Mul + (Var 4 y) + (Complex 4) + () + ) + () + ) + (= + (Var 4 z) + (ComplexBinOp + (Var 4 x) + Pow + (Var 4 y) + (Complex 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_complex_binop_64: + (Function + (SymbolTable + 5 + { + x: + (Variable + 5 + x + [] + Local + () + () + Default + (Complex 8) + () + Source + Public + Required + .false. + ), + y: + (Variable + 5 + y + [] + Local + () + () + Default + (Complex 8) + () + Source + Public + Required + .false. + ), + z: + (Variable + 5 + z + [] + Local + () + () + Default + (Complex 8) + () + Source + Public + Required + .false. + ) + }) + test_complex_binop_64 + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 5 x) + (ComplexBinOp + (Cast + (IntegerConstant 2 (Integer 4)) + IntegerToComplex + (Complex 8) + (ComplexConstant + 2.000000 + 0.000000 + (Complex 8) + ) + ) + Add + (ComplexConstant + 0.000000 + 3.000000 + (Complex 8) + ) + (Complex 8) + (ComplexConstant + 2.000000 + 3.000000 + (Complex 8) + ) + ) + () + ) + (= + (Var 5 y) + (ComplexBinOp + (Cast + (IntegerConstant 4 (Integer 4)) + IntegerToComplex + (Complex 8) + (ComplexConstant + 4.000000 + 0.000000 + (Complex 8) + ) + ) + Add + (ComplexConstant + 0.000000 + 5.000000 + (Complex 8) + ) + (Complex 8) + (ComplexConstant + 4.000000 + 5.000000 + (Complex 8) + ) + ) + () + ) + (= + (Var 5 z) + (ComplexBinOp + (Var 5 x) + Add + (Var 5 y) + (Complex 8) + () + ) + () + ) + (= + (Var 5 z) + (ComplexBinOp + (Var 5 x) + Sub + (Var 5 y) + (Complex 8) + () + ) + () + ) + (= + (Var 5 z) + (ComplexBinOp + (Var 5 x) + Mul + (Var 5 y) + (Complex 8) + () + ) + () + ) + (= + (Var 5 z) + (ComplexBinOp + (Var 5 x) + Pow + (Var 5 y) + (Complex 8) + () + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 125 + { + __main__global_stmts: + (ExternalSymbol + 125 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 125 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-test_dict13-683b290.json b/tests/reference/asr-test_dict13-683b290.json index 3f08b12f0a..982bd80540 100644 --- a/tests/reference/asr-test_dict13-683b290.json +++ b/tests/reference/asr-test_dict13-683b290.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_dict13-683b290.stderr", - "stderr_hash": "26039da2a42594ace7df2672a7bec3e88607caa7b45e35024b33df62", + "stderr_hash": "60bc3be332a1b638ade1cf40068ee4381ba4a79942a76c104c9cdebd", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_dict13-683b290.stderr b/tests/reference/asr-test_dict13-683b290.stderr index b22b070fa2..9dc7b6ef9c 100644 --- a/tests/reference/asr-test_dict13-683b290.stderr +++ b/tests/reference/asr-test_dict13-683b290.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded - --> tests/errors/test_dict13.py:2:12 +semantic error: 'dict' key type cannot be float/complex because resolving collisions by exact comparison of float/complex values will result in unexpected behaviours. In addition fuzzy equality checks with a certain tolerance does not follow transitivity with float/complex values. + --> tests/errors/test_dict13.py:2:11 | 2 | print({complex(0.0, 1.0): 1.1}) # constant dict with complex value as key - | ^^^^^^^^^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/reference/asr-test_max_min-3c2fc51.json b/tests/reference/asr-test_max_min-3c2fc51.json index 7c51d764ca..33f72d8194 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.json +++ b/tests/reference/asr-test_max_min-3c2fc51.json @@ -5,9 +5,9 @@ "infile_hash": "1aba932852adf8cc5dbff4a6ff83aa5de030dba5a5721eeace90a5d4", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_max_min-3c2fc51.stderr", - "stderr_hash": "bc3642925ccc0f3f61e37e0bd20fc7100fddbfb37c06a3609ff78daf", - "returncode": 2 + "stdout": "asr-test_max_min-3c2fc51.stdout", + "stdout_hash": "0737db3b75fc1a40cec30cff3e48c0ea621fad7872c77dab74ff0388", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_max_min-3c2fc51.stdout b/tests/reference/asr-test_max_min-3c2fc51.stdout new file mode 100644 index 0000000000..635593464e --- /dev/null +++ b/tests/reference/asr-test_max_min-3c2fc51.stdout @@ -0,0 +1,814 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 125 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [check] + [] + [(SubroutineCall + 2 check + () + [] + () + )] + () + Public + .false. + .false. + () + ), + check: + (Function + (SymbolTable + 7 + { + + }) + check + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_max_int + test_max_float + test_min_int + test_min_float] + [] + [(SubroutineCall + 2 test_max_int + () + [] + () + ) + (SubroutineCall + 2 test_max_float + () + [] + () + ) + (SubroutineCall + 2 test_min_int + () + [] + () + ) + (SubroutineCall + 2 test_min_float + () + [] + () + )] + () + Public + .false. + .false. + () + ), + test_max_float: + (Function + (SymbolTable + 4 + { + d: + (Variable + 4 + d + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + e: + (Variable + 4 + e + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + f: + (Variable + 4 + f + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + max: + (ExternalSymbol + 4 + max + 8 max + lpython_builtin + [] + max + Private + ), + max@__lpython_overloaded_2__max: + (ExternalSymbol + 4 + max@__lpython_overloaded_2__max + 8 __lpython_overloaded_2__max + lpython_builtin + [] + __lpython_overloaded_2__max + Public + ), + max@__lpython_overloaded_3__max: + (ExternalSymbol + 4 + max@__lpython_overloaded_3__max + 8 __lpython_overloaded_3__max + lpython_builtin + [] + __lpython_overloaded_3__max + Public + ) + }) + test_max_float + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [max@__lpython_overloaded_2__max + max@__lpython_overloaded_3__max] + [] + [(= + (Var 4 d) + (RealConstant + 23.233000 + (Real 8) + ) + () + ) + (= + (Var 4 e) + (RealConstant + 23.223300 + (Real 8) + ) + () + ) + (= + (Var 4 f) + (RealConstant + 21.230000 + (Real 8) + ) + () + ) + (Assert + (RealCompare + (FunctionCall + 4 max@__lpython_overloaded_2__max + 4 max + [((Var 4 d)) + ((Var 4 e)) + ((Var 4 f))] + (Real 8) + () + () + ) + Eq + (Var 4 d) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (FunctionCall + 4 max@__lpython_overloaded_3__max + 4 max + [((Var 4 e)) + ((Var 4 f))] + (Real 8) + () + () + ) + Eq + (Var 4 e) + (Logical 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_max_int: + (Function + (SymbolTable + 3 + { + a: + (Variable + 3 + a + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + b: + (Variable + 3 + b + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + c: + (Variable + 3 + c + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + max: + (ExternalSymbol + 3 + max + 8 max + lpython_builtin + [] + max + Private + ), + max@__lpython_overloaded_0__max: + (ExternalSymbol + 3 + max@__lpython_overloaded_0__max + 8 __lpython_overloaded_0__max + lpython_builtin + [] + __lpython_overloaded_0__max + Public + ), + max@__lpython_overloaded_1__max: + (ExternalSymbol + 3 + max@__lpython_overloaded_1__max + 8 __lpython_overloaded_1__max + lpython_builtin + [] + __lpython_overloaded_1__max + Public + ) + }) + test_max_int + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [max@__lpython_overloaded_0__max + max@__lpython_overloaded_1__max] + [] + [(= + (Var 3 a) + (IntegerConstant 1 (Integer 4)) + () + ) + (= + (Var 3 b) + (IntegerConstant 2 (Integer 4)) + () + ) + (= + (Var 3 c) + (IntegerConstant 3 (Integer 4)) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 max@__lpython_overloaded_0__max + 3 max + [((Var 3 a)) + ((Var 3 b))] + (Integer 4) + () + () + ) + Eq + (Var 3 b) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 max@__lpython_overloaded_1__max + 3 max + [((Var 3 a)) + ((Var 3 b)) + ((Var 3 c))] + (Integer 4) + () + () + ) + Eq + (Var 3 c) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (FunctionCall + 3 max@__lpython_overloaded_1__max + 3 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 + (IntegerCompare + (FunctionCall + 3 max@__lpython_overloaded_0__max + 3 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) + ) + ) + () + )] + () + Public + .false. + .false. + () + ), + test_min_float: + (Function + (SymbolTable + 6 + { + d: + (Variable + 6 + d + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + e: + (Variable + 6 + e + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + f: + (Variable + 6 + f + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ) + }) + test_min_float + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 6 d) + (RealConstant + 23.233000 + (Real 8) + ) + () + ) + (= + (Var 6 e) + (RealConstant + 23.223300 + (Real 8) + ) + () + ) + (= + (Var 6 f) + (RealConstant + 21.230000 + (Real 8) + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Min + [(Var 6 d) + (Var 6 e) + (Var 6 f)] + 0 + (Real 8) + () + ) + Eq + (Var 6 f) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Min + [(Var 6 e) + (Var 6 f)] + 0 + (Real 8) + () + ) + Eq + (Var 6 f) + (Logical 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_min_int: + (Function + (SymbolTable + 5 + { + a: + (Variable + 5 + a + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + b: + (Variable + 5 + b + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + c: + (Variable + 5 + c + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + test_min_int + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 5 a) + (IntegerConstant 1 (Integer 4)) + () + ) + (= + (Var 5 b) + (IntegerConstant 2 (Integer 4)) + () + ) + (= + (Var 5 c) + (IntegerConstant 3 (Integer 4)) + () + ) + (Assert + (IntegerCompare + (IntrinsicScalarFunction + Min + [(Var 5 a) + (Var 5 b)] + 0 + (Integer 4) + () + ) + Eq + (Var 5 a) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (IntrinsicScalarFunction + Min + [(Var 5 a) + (Var 5 b) + (Var 5 c)] + 0 + (Integer 4) + () + ) + Eq + (Var 5 a) + (Logical 4) + () + ) + () + ) + (Assert + (IntegerCompare + (IntrinsicScalarFunction + Min + [(IntegerConstant 1 (Integer 4)) + (IntegerConstant 2 (Integer 4)) + (IntegerConstant 3 (Integer 4))] + 0 + (Integer 4) + (IntegerConstant 1 (Integer 4)) + ) + Eq + (IntegerConstant 1 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + ) + (Assert + (IntegerCompare + (IntrinsicScalarFunction + Min + [(IntegerConstant 1 (Integer 4)) + (IntegerConstant 6 (Integer 4))] + 0 + (Integer 4) + (IntegerConstant 1 (Integer 4)) + ) + Eq + (IntegerConstant 1 (Integer 4)) + (Logical 4) + (LogicalConstant + .true. + (Logical 4) + ) + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 126 + { + __main__global_stmts: + (ExternalSymbol + 126 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 126 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-test_numpy_03-e600a49.json b/tests/reference/asr-test_numpy_03-e600a49.json index 11537ffe29..1d1df0b8cd 100644 --- a/tests/reference/asr-test_numpy_03-e600a49.json +++ b/tests/reference/asr-test_numpy_03-e600a49.json @@ -5,9 +5,9 @@ "infile_hash": "5c3ea7436668441c056bd576ea77cdfb49e44a5f0e95088d0f62184e", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_numpy_03-e600a49.stderr", - "stderr_hash": "934ed2ca36b7a4e431b1e4fc8dbd37edd550f7dbb5d9dca7ed49ce61", - "returncode": 2 + "stdout": "asr-test_numpy_03-e600a49.stdout", + "stdout_hash": "327db223a7c8892168c63f6c33339d0b81db8c8bb152b119a2c92591", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_numpy_03-e600a49.stdout b/tests/reference/asr-test_numpy_03-e600a49.stdout new file mode 100644 index 0000000000..e238153e7f --- /dev/null +++ b/tests/reference/asr-test_numpy_03-e600a49.stdout @@ -0,0 +1,1938 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 220 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_reshape_with_argument] + [] + [(SubroutineCall + 2 test_reshape_with_argument + () + [] + () + )] + () + Public + .false. + .false. + () + ), + test_1d_to_nd: + (Function + (SymbolTable + 204 + { + a: + (Variable + 204 + a + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + b: + (Variable + 204 + b + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + c: + (Variable + 204 + c + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + d: + (Variable + 204 + d + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + eps: + (Variable + 204 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + i: + (Variable + 204 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 204 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + k: + (Variable + 204 + k + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + l: + (Variable + 204 + l + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + newshape: + (Variable + 204 + newshape + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 2 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + newshape1: + (Variable + 204 + newshape1 + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ) + }) + test_1d_to_nd + (FunctionType + [(Array + (Real 8) + [(() + ())] + DescriptorArray + )] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 204 d)] + [(= + (Var 204 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (= + (Var 204 b) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 204 k) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 256 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 255 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (Var 204 i) + (IntrinsicScalarFunction + FloorDiv + [(Var 204 k) + (IntegerConstant 16 (Integer 4))] + 0 + (Integer 4) + () + ) + () + ) + (= + (Var 204 j) + (IntegerBinOp + (Var 204 k) + Sub + (IntegerBinOp + (Var 204 i) + Mul + (IntegerConstant 16 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (= + (ArrayItem + (Var 204 b) + [(() + (Var 204 k) + ())] + (Real 8) + RowMajor + () + ) + (RealBinOp + (Cast + (IntegerBinOp + (Var 204 i) + Add + (Var 204 j) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + Add + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + () + ) + () + )] + ) + (= + (Var 204 a) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 204 newshape) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 2 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 204 newshape) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 16 (Integer 4)) + () + ) + (= + (ArrayItem + (Var 204 newshape) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 16 (Integer 4)) + () + ) + (= + (Var 204 a) + (ArrayReshape + (Var 204 b) + (ArrayPhysicalCast + (Var 204 newshape) + FixedSizeArray + DescriptorArray + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 2 (Integer 4)))] + DescriptorArray + ) + () + ) + (Array + (Real 8) + [(() + ())] + FixedSizeArray + ) + () + ) + () + ) + (DoLoop + () + ((Var 204 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 16 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 15 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 204 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 16 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 15 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (RealBinOp + (ArrayItem + (Var 204 a) + [(() + (Var 204 i) + ()) + (() + (Var 204 j) + ())] + (Real 8) + RowMajor + () + ) + Sub + (Cast + (IntegerBinOp + (Var 204 i) + Add + (Var 204 j) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + (Real 8) + () + ) + Sub + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 204 eps) + (Logical 4) + () + ) + () + )] + )] + ) + (= + (Var 204 c) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 204 newshape1) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 204 newshape1) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 16 (Integer 4)) + () + ) + (= + (ArrayItem + (Var 204 newshape1) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 16 (Integer 4)) + () + ) + (= + (ArrayItem + (Var 204 newshape1) + [(() + (IntegerConstant 2 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 16 (Integer 4)) + () + ) + (= + (Var 204 c) + (ArrayReshape + (Var 204 d) + (ArrayPhysicalCast + (Var 204 newshape1) + FixedSizeArray + DescriptorArray + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + DescriptorArray + ) + () + ) + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + () + ) + () + ) + (DoLoop + () + ((Var 204 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 16 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 15 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 204 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 16 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 15 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 204 k) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 16 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 15 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (RealBinOp + (ArrayItem + (Var 204 c) + [(() + (Var 204 i) + ()) + (() + (Var 204 j) + ()) + (() + (Var 204 k) + ())] + (Real 8) + RowMajor + () + ) + Sub + (Cast + (IntegerBinOp + (IntegerBinOp + (Var 204 i) + Add + (Var 204 j) + (Integer 4) + () + ) + Add + (Var 204 k) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + (Real 8) + () + ) + Sub + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 204 eps) + (Logical 4) + () + ) + () + )] + )] + )] + )] + () + Public + .false. + .false. + () + ), + test_nd_to_1d: + (Function + (SymbolTable + 203 + { + a: + (Variable + 203 + a + [] + InOut + () + () + Default + (Array + (Real 8) + [(() + ()) + (() + ())] + DescriptorArray + ) + () + Source + Public + Required + .false. + ), + b: + (Variable + 203 + b + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + c: + (Variable + 203 + c + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + d: + (Variable + 203 + d + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4096 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + eps: + (Variable + 203 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + i: + (Variable + 203 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 203 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + k: + (Variable + 203 + k + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + l: + (Variable + 203 + l + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + newshape: + (Variable + 203 + newshape + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + newshape1: + (Variable + 203 + newshape1 + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ) + }) + test_nd_to_1d + (FunctionType + [(Array + (Real 8) + [(() + ()) + (() + ())] + DescriptorArray + )] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 203 a)] + [(= + (Var 203 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (= + (Var 203 b) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 256 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 203 newshape) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 203 newshape) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 256 (Integer 4)) + () + ) + (= + (Var 203 b) + (ArrayReshape + (Var 203 a) + (ArrayPhysicalCast + (Var 203 newshape) + FixedSizeArray + DescriptorArray + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + DescriptorArray + ) + () + ) + (Array + (Real 8) + [(() + ())] + DescriptorArray + ) + () + ) + () + ) + (DoLoop + () + ((Var 203 k) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 256 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 255 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (Var 203 i) + (IntrinsicScalarFunction + FloorDiv + [(Var 203 k) + (IntegerConstant 16 (Integer 4))] + 0 + (Integer 4) + () + ) + () + ) + (= + (Var 203 j) + (IntegerBinOp + (Var 203 k) + Sub + (IntegerBinOp + (Var 203 i) + Mul + (IntegerConstant 16 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (RealBinOp + (ArrayItem + (Var 203 b) + [(() + (Var 203 k) + ())] + (Real 8) + RowMajor + () + ) + Sub + (Cast + (IntegerBinOp + (Var 203 i) + Add + (Var 203 j) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + (Real 8) + () + ) + Sub + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 203 eps) + (Logical 4) + () + ) + () + )] + ) + (= + (Var 203 c) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 203 c) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 203 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 16 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 15 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 203 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 16 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 15 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 203 k) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 16 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 15 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 203 c) + [(() + (Var 203 i) + ()) + (() + (Var 203 j) + ()) + (() + (Var 203 k) + ())] + (Real 8) + RowMajor + () + ) + (RealBinOp + (Cast + (IntegerBinOp + (IntegerBinOp + (Var 203 i) + Add + (Var 203 j) + (Integer 4) + () + ) + Add + (Var 203 k) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + Add + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + () + ) + () + )] + )] + )] + ) + (= + (Var 203 d) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4096 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 203 newshape1) + (ArrayConstant + [] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (ArrayItem + (Var 203 newshape1) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + (IntegerConstant 4096 (Integer 4)) + () + ) + (= + (Var 203 d) + (ArrayReshape + (Var 203 c) + (ArrayPhysicalCast + (Var 203 newshape1) + FixedSizeArray + DescriptorArray + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 1 (Integer 4)))] + DescriptorArray + ) + () + ) + (Array + (Real 8) + [(() + ())] + FixedSizeArray + ) + () + ) + () + ) + (DoLoop + () + ((Var 203 l) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 4096 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 4095 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (Var 203 i) + (Cast + (RealBinOp + (Cast + (Var 203 l) + IntegerToReal + (Real 8) + () + ) + Div + (Cast + (IntegerConstant 256 (Integer 4)) + IntegerToReal + (Real 8) + (RealConstant + 256.000000 + (Real 8) + ) + ) + (Real 8) + () + ) + RealToInteger + (Integer 4) + () + ) + () + ) + (= + (Var 203 j) + (IntrinsicScalarFunction + FloorDiv + [(IntegerBinOp + (Var 203 l) + Sub + (IntegerBinOp + (Var 203 i) + Mul + (IntegerConstant 256 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + (IntegerConstant 16 (Integer 4))] + 0 + (Integer 4) + () + ) + () + ) + (= + (Var 203 k) + (IntegerBinOp + (IntegerBinOp + (Var 203 l) + Sub + (IntegerBinOp + (Var 203 i) + Mul + (IntegerConstant 256 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + Sub + (IntegerBinOp + (Var 203 j) + Mul + (IntegerConstant 16 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (RealBinOp + (ArrayItem + (Var 203 d) + [(() + (Var 203 l) + ())] + (Real 8) + RowMajor + () + ) + Sub + (Cast + (IntegerBinOp + (IntegerBinOp + (Var 203 i) + Add + (Var 203 j) + (Integer 4) + () + ) + Add + (Var 203 k) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + (Real 8) + () + ) + Sub + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 203 eps) + (Logical 4) + () + ) + () + )] + )] + () + Public + .false. + .false. + () + ), + test_reshape_with_argument: + (Function + (SymbolTable + 205 + { + a: + (Variable + 205 + a + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + d: + (Variable + 205 + d + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4096 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 205 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + j: + (Variable + 205 + j + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + k: + (Variable + 205 + k + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + l: + (Variable + 205 + l + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + test_reshape_with_argument + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_nd_to_1d + test_1d_to_nd] + [] + [(= + (Var 205 a) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 205 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 16 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 15 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(DoLoop + () + ((Var 205 j) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 16 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 15 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 205 a) + [(() + (Var 205 i) + ()) + (() + (Var 205 j) + ())] + (Real 8) + RowMajor + () + ) + (RealBinOp + (Cast + (IntegerBinOp + (Var 205 i) + Add + (Var 205 j) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + Add + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + () + ) + () + )] + )] + ) + (SubroutineCall + 2 test_nd_to_1d + () + [((ArrayPhysicalCast + (Var 205 a) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4))) + ((IntegerConstant 0 (Integer 4)) + (IntegerConstant 16 (Integer 4)))] + DescriptorArray + ) + () + ))] + () + ) + (= + (Var 205 d) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4096 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 205 l) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 4096 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 4095 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (Var 205 i) + (Cast + (RealBinOp + (Cast + (Var 205 l) + IntegerToReal + (Real 8) + () + ) + Div + (Cast + (IntegerConstant 256 (Integer 4)) + IntegerToReal + (Real 8) + (RealConstant + 256.000000 + (Real 8) + ) + ) + (Real 8) + () + ) + RealToInteger + (Integer 4) + () + ) + () + ) + (= + (Var 205 j) + (IntrinsicScalarFunction + FloorDiv + [(IntegerBinOp + (Var 205 l) + Sub + (IntegerBinOp + (Var 205 i) + Mul + (IntegerConstant 256 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + (IntegerConstant 16 (Integer 4))] + 0 + (Integer 4) + () + ) + () + ) + (= + (Var 205 k) + (IntegerBinOp + (IntegerBinOp + (Var 205 l) + Sub + (IntegerBinOp + (Var 205 i) + Mul + (IntegerConstant 256 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + Sub + (IntegerBinOp + (Var 205 j) + Mul + (IntegerConstant 16 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (= + (ArrayItem + (Var 205 d) + [(() + (Var 205 l) + ())] + (Real 8) + RowMajor + () + ) + (RealBinOp + (Cast + (IntegerBinOp + (IntegerBinOp + (Var 205 i) + Add + (Var 205 j) + (Integer 4) + () + ) + Add + (Var 205 k) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + Add + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + () + ) + () + )] + ) + (SubroutineCall + 2 test_1d_to_nd + () + [((ArrayPhysicalCast + (Var 205 d) + FixedSizeArray + DescriptorArray + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 4096 (Integer 4)))] + DescriptorArray + ) + () + ))] + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [numpy] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 221 + { + __main__global_stmts: + (ExternalSymbol + 221 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 221 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ), + numpy: + (Module numpy) + }) + [] +) diff --git a/tests/reference/asr-test_numpy_04-ecbb614.json b/tests/reference/asr-test_numpy_04-ecbb614.json index a0e2dcecdb..2b9536df32 100644 --- a/tests/reference/asr-test_numpy_04-ecbb614.json +++ b/tests/reference/asr-test_numpy_04-ecbb614.json @@ -5,9 +5,9 @@ "infile_hash": "0fbd0a4280966dd9a917d3a005887954325fb1ea5468fd28dcae930f", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-test_numpy_04-ecbb614.stderr", - "stderr_hash": "8f73238d34192a66d0659b3cc8e5f8a5339755da83a50790689cf53b", - "returncode": 2 + "stdout": "asr-test_numpy_04-ecbb614.stdout", + "stdout_hash": "d1ea2156aa8b19fa86f88a074c69680f1acefe00084af7dbc7caefc2", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_numpy_04-ecbb614.stdout b/tests/reference/asr-test_numpy_04-ecbb614.stdout new file mode 100644 index 0000000000..03f436c422 --- /dev/null +++ b/tests/reference/asr-test_numpy_04-ecbb614.stdout @@ -0,0 +1,519 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 206 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [check] + [] + [(SubroutineCall + 2 check + () + [] + () + )] + () + Public + .false. + .false. + () + ), + check: + (Function + (SymbolTable + 205 + { + + }) + check + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [test_array_01 + test_array_02] + [] + [(SubroutineCall + 2 test_array_01 + () + [] + () + ) + (SubroutineCall + 2 test_array_02 + () + [] + () + )] + () + Public + .false. + .false. + () + ), + test_array_01: + (Function + (SymbolTable + 203 + { + eps: + (Variable + 203 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + x: + (Variable + 203 + x + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ) + }) + test_array_01 + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 203 x) + (ArrayConstant + [(RealConstant + 1.000000 + (Real 8) + ) + (RealConstant + 2.000000 + (Real 8) + ) + (RealConstant + 3.000000 + (Real 8) + )] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + PointerToDataArray + ) + RowMajor + ) + () + ) + (= + (Var 203 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ArrayItem + (Var 203 x) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Real 8) + RowMajor + () + ) + Sub + (RealConstant + 1.000000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + Lt + (Var 203 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ArrayItem + (Var 203 x) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Real 8) + RowMajor + () + ) + Sub + (RealConstant + 2.000000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + Lt + (Var 203 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (ArrayItem + (Var 203 x) + [(() + (IntegerConstant 2 (Integer 4)) + ())] + (Real 8) + RowMajor + () + ) + Sub + (RealConstant + 3.000000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + Lt + (Var 203 eps) + (Logical 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ), + test_array_02: + (Function + (SymbolTable + 204 + { + eps: + (Variable + 204 + eps + [] + Local + () + () + Default + (Real 8) + () + Source + Public + Required + .false. + ), + x: + (Variable + 204 + x + [] + Local + () + () + Default + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ) + }) + test_array_02 + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 204 x) + (ArrayConstant + [(IntegerConstant 1 (Integer 4)) + (IntegerConstant 2 (Integer 4)) + (IntegerConstant 3 (Integer 4))] + (Array + (Integer 4) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 3 (Integer 4)))] + PointerToDataArray + ) + RowMajor + ) + () + ) + (= + (Var 204 eps) + (RealConstant + 0.000000 + (Real 8) + ) + () + ) + (Assert + (RealCompare + (Cast + (IntrinsicScalarFunction + Abs + [(IntegerBinOp + (ArrayItem + (Var 204 x) + [(() + (IntegerConstant 0 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + )] + 0 + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + Lt + (Var 204 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (Cast + (IntrinsicScalarFunction + Abs + [(IntegerBinOp + (ArrayItem + (Var 204 x) + [(() + (IntegerConstant 1 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + Sub + (IntegerConstant 2 (Integer 4)) + (Integer 4) + () + )] + 0 + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + Lt + (Var 204 eps) + (Logical 4) + () + ) + () + ) + (Assert + (RealCompare + (Cast + (IntrinsicScalarFunction + Abs + [(IntegerBinOp + (ArrayItem + (Var 204 x) + [(() + (IntegerConstant 2 (Integer 4)) + ())] + (Integer 4) + RowMajor + () + ) + Sub + (IntegerConstant 3 (Integer 4)) + (Integer 4) + () + )] + 0 + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + Lt + (Var 204 eps) + (Logical 4) + () + ) + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [numpy] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 207 + { + __main__global_stmts: + (ExternalSymbol + 207 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 207 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ), + numpy: + (Module numpy) + }) + [] +) diff --git a/tests/reference/asr-test_pow-3f5d550.json b/tests/reference/asr-test_pow-3f5d550.json index 95344abe65..c42f85ff02 100644 --- a/tests/reference/asr-test_pow-3f5d550.json +++ b/tests/reference/asr-test_pow-3f5d550.json @@ -5,9 +5,9 @@ "infile_hash": "073bf734150500a8b5e46940a9b0440e7e0fe30d0e2789ca049cef17", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, + "stdout": "asr-test_pow-3f5d550.stdout", + "stdout_hash": "571772fdecca3b238429cfeb145ccf7f8d5d02a022f75056289ed4da", "stderr": "asr-test_pow-3f5d550.stderr", - "stderr_hash": "13a950a0d1f29b9a7cf4484858b22246b086a24919ca22f6b1d410b3", - "returncode": 2 + "stderr_hash": "3d950301563cce75654f28bf41f6f53428ed1f5ae997774345f374a3", + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-test_pow-3f5d550.stderr b/tests/reference/asr-test_pow-3f5d550.stderr index c955d6b4bc..712d80384b 100644 --- a/tests/reference/asr-test_pow-3f5d550.stderr +++ b/tests/reference/asr-test_pow-3f5d550.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/errors/test_pow.py:2:11 | 2 | print(pow(2, 2)) - | ^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ + | ^^^^^^^^^ '**' could be used instead diff --git a/tests/reference/asr-test_pow-3f5d550.stdout b/tests/reference/asr-test_pow-3f5d550.stdout new file mode 100644 index 0000000000..de8035313a --- /dev/null +++ b/tests/reference/asr-test_pow-3f5d550.stdout @@ -0,0 +1,159 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 121 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [main] + [] + [(SubroutineCall + 2 main + () + [] + () + )] + () + Public + .false. + .false. + () + ), + main: + (Function + (SymbolTable + 3 + { + pow: + (ExternalSymbol + 3 + pow + 4 pow + lpython_builtin + [] + pow + Private + ), + pow@__lpython_overloaded_0__pow: + (ExternalSymbol + 3 + pow@__lpython_overloaded_0__pow + 4 __lpython_overloaded_0__pow + lpython_builtin + [] + __lpython_overloaded_0__pow + Public + ) + }) + main + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [pow@__lpython_overloaded_0__pow] + [] + [(Print + () + [(FunctionCall + 3 pow@__lpython_overloaded_0__pow + 3 pow + [((IntegerConstant 2 (Integer 4))) + ((IntegerConstant 2 (Integer 4)))] + (Real 8) + (RealConstant + 4.000000 + (Real 8) + ) + () + )] + () + () + ) + (Print + () + [(IntegerBinOp + (IntegerConstant 2 (Integer 4)) + Pow + (IntegerConstant 2 (Integer 4)) + (Integer 4) + (IntegerConstant 4 (Integer 4)) + )] + () + () + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [lpython_builtin] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 122 + { + __main__global_stmts: + (ExternalSymbol + 122 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 122 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ) + }) + [] +) diff --git a/tests/reference/asr-test_pow1-581ef42.json b/tests/reference/asr-test_pow1-581ef42.json index 2ef657f3ac..a5584b1bc7 100644 --- a/tests/reference/asr-test_pow1-581ef42.json +++ b/tests/reference/asr-test_pow1-581ef42.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_pow1-581ef42.stderr", - "stderr_hash": "32fe0eecb3687de0e976228815c25c96f3dc3e8f6491adb21c105ee6", + "stderr_hash": "7f7cc07cf6f08f2d953d6e6c1f4892e6379faaf8aa668117234293d0", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_pow1-581ef42.stderr b/tests/reference/asr-test_pow1-581ef42.stderr index f1693701de..fa7160f584 100644 --- a/tests/reference/asr-test_pow1-581ef42.stderr +++ b/tests/reference/asr-test_pow1-581ef42.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/errors/test_pow1.py:4:11 | 4 | print(pow(x,3)) - | ^^^^^^^^ imported here + | ^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: Arguments do not match for any generic procedure, pow + --> tests/errors/test_pow1.py:4:11 + | +4 | print(pow(x,3)) + | ^^^^^^^^ diff --git a/tests/reference/asr-test_pow2-0dcbd7d.json b/tests/reference/asr-test_pow2-0dcbd7d.json index 129acc3859..083bc76b8d 100644 --- a/tests/reference/asr-test_pow2-0dcbd7d.json +++ b/tests/reference/asr-test_pow2-0dcbd7d.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_pow2-0dcbd7d.stderr", - "stderr_hash": "54113068b55d3eab93cd04927b2fbf6a384a4a0ed64f02aa6ea18f9b", + "stderr_hash": "1d1d3a4a308e068439ac40685fcad6f29750560722b910be3341ce3c", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_pow2-0dcbd7d.stderr b/tests/reference/asr-test_pow2-0dcbd7d.stderr index edc4007245..896faa98e5 100644 --- a/tests/reference/asr-test_pow2-0dcbd7d.stderr +++ b/tests/reference/asr-test_pow2-0dcbd7d.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/errors/test_pow2.py:12:11 | 12 | print(pow(a, b, c, d)) - | ^^^^^^^^^^^^^^^ imported here + | ^^^^^^^^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: Arguments do not match for any generic procedure, pow + --> tests/errors/test_pow2.py:12:11 + | +12 | print(pow(a, b, c, d)) + | ^^^^^^^^^^^^^^^ diff --git a/tests/reference/asr-test_pow3-79749ed.json b/tests/reference/asr-test_pow3-79749ed.json index 7c5d30d4da..cd0f9f0d33 100644 --- a/tests/reference/asr-test_pow3-79749ed.json +++ b/tests/reference/asr-test_pow3-79749ed.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_pow3-79749ed.stderr", - "stderr_hash": "199c8dc10f23e2053ec5498131683383bb4b20bf06b05bf1c5f7d747", + "stderr_hash": "4a6600740ad466d250f39b76130ab5ab796312b1ee89c2d72847500f", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_pow3-79749ed.stderr b/tests/reference/asr-test_pow3-79749ed.stderr index 3a157a0866..6456498803 100644 --- a/tests/reference/asr-test_pow3-79749ed.stderr +++ b/tests/reference/asr-test_pow3-79749ed.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/errors/test_pow3.py:8:11 | 8 | print(pow(x, a)) - | ^^^^^^^^^ imported here + | ^^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: Arguments do not match for any generic procedure, pow + --> tests/errors/test_pow3.py:8:11 + | +8 | print(pow(x, a)) + | ^^^^^^^^^ diff --git a/tests/reference/asr-test_pow4-ef60978.json b/tests/reference/asr-test_pow4-ef60978.json index 8cfd3c1460..2e98c401ce 100644 --- a/tests/reference/asr-test_pow4-ef60978.json +++ b/tests/reference/asr-test_pow4-ef60978.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_pow4-ef60978.stderr", - "stderr_hash": "e4796a76ca15b125485b820d259be4ce20ed67f403953372685b98d5", + "stderr_hash": "ddc8a81609479bf82d256c9cb8d4d54526bd6656632a0d1e2f1ada2c", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_pow4-ef60978.stderr b/tests/reference/asr-test_pow4-ef60978.stderr index 2dc752cd36..0663475b44 100644 --- a/tests/reference/asr-test_pow4-ef60978.stderr +++ b/tests/reference/asr-test_pow4-ef60978.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/errors/test_pow4.py:10:11 | 10 | print(pow(x, a, b)) - | ^^^^^^^^^^^^ imported here + | ^^^^^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +semantic error: Arguments do not match for any generic procedure, pow + --> tests/errors/test_pow4.py:10:11 + | +10 | print(pow(x, a, b)) + | ^^^^^^^^^^^^ diff --git a/tests/reference/asr-test_zero_division-3dd84e8.json b/tests/reference/asr-test_zero_division-3dd84e8.json index 129e181bef..5c135e76d4 100644 --- a/tests/reference/asr-test_zero_division-3dd84e8.json +++ b/tests/reference/asr-test_zero_division-3dd84e8.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_zero_division-3dd84e8.stderr", - "stderr_hash": "9403e36c7ace95241bf1d59a108732b298fbee5425c44455fb81ac77", + "stderr_hash": "e1770a0ba87c5155926e3d6bb3bd67e14a5c040b7584c4cf114a41b2", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_zero_division-3dd84e8.stderr b/tests/reference/asr-test_zero_division-3dd84e8.stderr index 7403437c96..57611f2b32 100644 --- a/tests/reference/asr-test_zero_division-3dd84e8.stderr +++ b/tests/reference/asr-test_zero_division-3dd84e8.stderr @@ -1,5 +1,5 @@ -semantic error: integer division by zero is not allowed +semantic error: Division by 0 is not allowed --> tests/errors/test_zero_division.py:4:16 | 4 | print(i // 0) - | ^ integer division by zero + | ^ diff --git a/tests/reference/asr-test_zero_division2-d84989f.json b/tests/reference/asr-test_zero_division2-d84989f.json index b9a7de7d1e..f1fb7cbb0e 100644 --- a/tests/reference/asr-test_zero_division2-d84989f.json +++ b/tests/reference/asr-test_zero_division2-d84989f.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_zero_division2-d84989f.stderr", - "stderr_hash": "09fcb9f6244ddf2c2d14cd76ec91274cffd240e24e2b2f1c0697c8b5", + "stderr_hash": "d2bac61e7df0875a7c93edb706661c80154b7b4d05dbf26663c36176", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_zero_division2-d84989f.stderr b/tests/reference/asr-test_zero_division2-d84989f.stderr index 8dc523a2a5..438ee0b6d4 100644 --- a/tests/reference/asr-test_zero_division2-d84989f.stderr +++ b/tests/reference/asr-test_zero_division2-d84989f.stderr @@ -1,5 +1,5 @@ -semantic error: float floor division by zero is not allowed +semantic error: Division by 0 is not allowed --> tests/errors/test_zero_division2.py:4:16 | 4 | print(v // 0.0) - | ^^^ float floor division by zero + | ^^^ diff --git a/tests/reference/asr-vec_01-66ac423.json b/tests/reference/asr-vec_01-66ac423.json index abd51bc145..3a816642b1 100644 --- a/tests/reference/asr-vec_01-66ac423.json +++ b/tests/reference/asr-vec_01-66ac423.json @@ -5,9 +5,9 @@ "infile_hash": "f85ca108780c53c54878d119822d56fb834cf4b5121511cbaca2c2fe", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "asr-vec_01-66ac423.stderr", - "stderr_hash": "67b435304368f453ffeda263b2c1c1a591ce3e9a4100d21fbf1ec7a5", - "returncode": 2 + "stdout": "asr-vec_01-66ac423.stdout", + "stdout_hash": "1ea0f258aa80b56382bd3f3df5439aeecc176af372c79c00a402ae57", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/asr-vec_01-66ac423.stdout b/tests/reference/asr-vec_01-66ac423.stdout new file mode 100644 index 0000000000..fb0b8bb903 --- /dev/null +++ b/tests/reference/asr-vec_01-66ac423.stdout @@ -0,0 +1,295 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 207 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [loop_vec] + [] + [(SubroutineCall + 2 loop_vec + () + [] + () + )] + () + Public + .false. + .false. + () + ), + loop_vec: + (Function + (SymbolTable + 203 + { + a: + (Variable + 203 + a + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 9216 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + b: + (Variable + 203 + b + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 9216 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 203 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + loop_vec + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [] + [(= + (Var 203 a) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 9216 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 203 b) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 9216 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 203 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 9216 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 9215 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 203 b) + [(() + (Var 203 i) + ())] + (Real 8) + RowMajor + () + ) + (RealConstant + 5.000000 + (Real 8) + ) + () + )] + ) + (DoLoop + () + ((Var 203 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 9216 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 9215 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 203 a) + [(() + (Var 203 i) + ())] + (Real 8) + RowMajor + () + ) + (ArrayItem + (Var 203 b) + [(() + (Var 203 i) + ())] + (Real 8) + RowMajor + () + ) + () + )] + ) + (DoLoop + () + ((Var 203 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 9216 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 9215 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(Assert + (RealCompare + (ArrayItem + (Var 203 a) + [(() + (Var 203 i) + ())] + (Real 8) + RowMajor + () + ) + Eq + (RealConstant + 5.000000 + (Real 8) + ) + (Logical 4) + () + ) + () + )] + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [numpy] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 208 + { + __main__global_stmts: + (ExternalSymbol + 208 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 208 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ), + numpy: + (Module numpy) + }) + [] +) diff --git a/tests/reference/c-expr7-bb2692a.json b/tests/reference/c-expr7-bb2692a.json index c0fcdfcb2c..84ee9e5ed5 100644 --- a/tests/reference/c-expr7-bb2692a.json +++ b/tests/reference/c-expr7-bb2692a.json @@ -5,9 +5,9 @@ "infile_hash": "7ef1383d1798621ee35adb7296bfe66dcdc08a21ac8dc86b9ce42878", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, + "stdout": "c-expr7-bb2692a.stdout", + "stdout_hash": "1d75b4cf61dcee73adafec2a5448c953bae5476aab2502115df2eecb", "stderr": "c-expr7-bb2692a.stderr", - "stderr_hash": "4d93a6488abad28138f2713c11c47b2f02e87e530f1bf6e2e38e88bf", - "returncode": 2 + "stderr_hash": "6e9790ac88db1a9ead8f64a91ba8a6605de67167037908a74b77be0c", + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/c-expr7-bb2692a.stderr b/tests/reference/c-expr7-bb2692a.stderr index d1b84ec030..a4fad29beb 100644 --- a/tests/reference/c-expr7-bb2692a.stderr +++ b/tests/reference/c-expr7-bb2692a.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/expr7.py:4:13 | 4 | a = i32(pow(2, 2)) - | ^^^^^^^^^ imported here + | ^^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +style suggestion: Could have used '**' instead of 'pow' + --> tests/expr7.py:8:15 + | +8 | res = i32(pow(a, b)) + | ^^^^^^^^^ '**' could be used instead diff --git a/tests/reference/c-expr7-bb2692a.stdout b/tests/reference/c-expr7-bb2692a.stdout new file mode 100644 index 0000000000..b85fda16c9 --- /dev/null +++ b/tests/reference/c-expr7-bb2692a.stdout @@ -0,0 +1,362 @@ +#include +#include +#include + +#include +#include +#include +#include +#include + +float _lcompilers_optimization_floordiv_f32(float a, float b); +double _lcompilers_optimization_floordiv_f64(double a, double b); +int16_t _lcompilers_optimization_floordiv_i16(int16_t a, int16_t b); +int32_t _lcompilers_optimization_floordiv_i32(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i321(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i3210(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i322(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i323(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i324(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i325(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i326(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i327(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i328(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i329(int32_t a, int32_t b); +int64_t _lcompilers_optimization_floordiv_i64(int64_t a, int64_t b); +int8_t _lcompilers_optimization_floordiv_i8(int8_t a, int8_t b); +uint16_t _lcompilers_optimization_floordiv_u16(uint16_t a, uint16_t b); +uint32_t _lcompilers_optimization_floordiv_u32(uint32_t a, uint32_t b); +uint64_t _lcompilers_optimization_floordiv_u64(uint64_t a, uint64_t b); +uint8_t _lcompilers_optimization_floordiv_u8(uint8_t a, uint8_t b); +void test_pow(); +int32_t test_pow_1(int32_t a, int32_t b); +void main0(); +void __main__global_stmts(); + + + +// Implementations +float _lcompilers_optimization_floordiv_f32(float a, float b) +{ + double r; + float result; + int64_t tmp; + r = a/b; + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = (float)(tmp); + return result; +} + +double _lcompilers_optimization_floordiv_f64(double a, double b) +{ + double r; + double result; + int64_t tmp; + r = a/b; + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = (double)(tmp); + return result; +} + +int16_t _lcompilers_optimization_floordiv_i16(int16_t a, int16_t b) +{ + double r; + int16_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i32(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i321(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i3210(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i322(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i323(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i324(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i325(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i326(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i327(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i328(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i329(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int64_t _lcompilers_optimization_floordiv_i64(int64_t a, int64_t b) +{ + double r; + int64_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int8_t _lcompilers_optimization_floordiv_i8(int8_t a, int8_t b) +{ + double r; + int8_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +uint16_t _lcompilers_optimization_floordiv_u16(uint16_t a, uint16_t b) +{ + double r; + uint16_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = (uint16_t)(tmp); + return result; +} + +uint32_t _lcompilers_optimization_floordiv_u32(uint32_t a, uint32_t b) +{ + double r; + uint32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = (uint32_t)(tmp); + return result; +} + +uint64_t _lcompilers_optimization_floordiv_u64(uint64_t a, uint64_t b) +{ + double r; + uint64_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = (uint64_t)(tmp); + return result; +} + +uint8_t _lcompilers_optimization_floordiv_u8(uint8_t a, uint8_t b) +{ + double r; + uint8_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = (uint8_t)(tmp); + return result; +} + +double __lpython_overloaded_0__pow(int32_t x, int32_t y) +{ + double _lpython_return_variable; + _lpython_return_variable = (double)(pow(x, y)); + return _lpython_return_variable; +} + +float _lfortran_caimag(float_complex_t x); + +double _lfortran_zaimag(double_complex_t x); + +void test_pow() +{ + int32_t a; + a = (int32_t)( 4.00000000000000000e+00); +} + +int32_t test_pow_1(int32_t a, int32_t b) +{ + int32_t _lpython_return_variable; + int32_t res; + res = (int32_t)(__lpython_overloaded_0__pow(a, b)); + _lpython_return_variable = res; + return _lpython_return_variable; +} + +void main0() +{ + int32_t c; + test_pow(); + c = test_pow_1(1, 2); +} + +void __main__global_stmts() +{ + main0(); +} + +int main(int argc, char* argv[]) +{ + _lpython_set_argv(argc, argv); + __main__global_stmts(); + return 0; +} diff --git a/tests/reference/cpp-expr15-1661c0d.json b/tests/reference/cpp-expr15-1661c0d.json index 812a9c4978..a75de781fb 100644 --- a/tests/reference/cpp-expr15-1661c0d.json +++ b/tests/reference/cpp-expr15-1661c0d.json @@ -5,9 +5,9 @@ "infile_hash": "f3fa7c8efa999392edc0a94ff9c7820ed0c3f1e849c77655151b8d72", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "cpp-expr15-1661c0d.stderr", - "stderr_hash": "abb193cadddd4745a52610eabc746e5facafefb220f85ba3310a7498", - "returncode": 2 + "stdout": "cpp-expr15-1661c0d.stdout", + "stdout_hash": "c6660bd5efa0a0602ea96a86d5c44220cb4390dea4eebf4cb16211bc", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/cpp-expr15-1661c0d.stdout b/tests/reference/cpp-expr15-1661c0d.stdout new file mode 100644 index 0000000000..f1932205ba --- /dev/null +++ b/tests/reference/cpp-expr15-1661c0d.stdout @@ -0,0 +1,92 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +template +Kokkos::View from_std_vector(const std::vector &v) +{ + Kokkos::View r("r", v.size()); + for (size_t i=0; i < v.size(); i++) { + r(i) = v[i]; + } + return r; +} + +// Forward declarations +void __main__global_stmts(); +double test1(); +std::complex test2(); +int32_t test3(); +std::complex __lpython_overloaded_9__complex(int32_t x, int32_t y); +float _lfortran_caimag(std::complex x); +double _lfortran_zaimag(std::complex x); +namespace { +} + +// Implementations +std::complex __lpython_overloaded_9__complex(int32_t x, int32_t y) +{ + std::complex _lpython_return_variable; + _lpython_return_variable = std::complex(x) + std::complex(y)*std::complex(0.000000, 1.000000); + return _lpython_return_variable; +} + +float _lfortran_caimag(std::complex x); + +double _lfortran_zaimag(std::complex x); + +double test1() +{ + double _lpython_return_variable; + double x; + x = 1.00000000000000000e+00; + _lpython_return_variable = x; + return _lpython_return_variable; +} + +std::complex test2() +{ + std::complex _lpython_return_variable; + std::complex x; + x = __lpython_overloaded_9__complex(2, 2); + _lpython_return_variable = x; + return _lpython_return_variable; +} + +int32_t test3() +{ + int32_t _lpython_return_variable; + std::complex x; + std::complex y; + x = std::complex(0.000000, 4.000000); + y = std::complex(0.000000, 4.000000); + _lpython_return_variable = 0; + return _lpython_return_variable; +} + +void __main__global_stmts() +{ + std::cout << test1() << std::endl; + std::cout << test2() << std::endl; + std::cout << test3() << std::endl; +} + +namespace { + +void main2() { + __main__global_stmts(); +} + +} +int main(int argc, char* argv[]) +{ + Kokkos::initialize(argc, argv); + main2(); + Kokkos::finalize(); + return 0; +} diff --git a/tests/reference/cpp-expr7-529bd53.json b/tests/reference/cpp-expr7-529bd53.json index be1428115b..9697eaa92d 100644 --- a/tests/reference/cpp-expr7-529bd53.json +++ b/tests/reference/cpp-expr7-529bd53.json @@ -5,9 +5,9 @@ "infile_hash": "7ef1383d1798621ee35adb7296bfe66dcdc08a21ac8dc86b9ce42878", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, + "stdout": "cpp-expr7-529bd53.stdout", + "stdout_hash": "8f72ce4b2d8f170884e171b1bdfa4a4ea07344825b6787d814a446cf", "stderr": "cpp-expr7-529bd53.stderr", - "stderr_hash": "4d93a6488abad28138f2713c11c47b2f02e87e530f1bf6e2e38e88bf", - "returncode": 2 + "stderr_hash": "6e9790ac88db1a9ead8f64a91ba8a6605de67167037908a74b77be0c", + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/cpp-expr7-529bd53.stderr b/tests/reference/cpp-expr7-529bd53.stderr index d1b84ec030..a4fad29beb 100644 --- a/tests/reference/cpp-expr7-529bd53.stderr +++ b/tests/reference/cpp-expr7-529bd53.stderr @@ -1,11 +1,11 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/expr7.py:4:13 | 4 | a = i32(pow(2, 2)) - | ^^^^^^^^^ imported here + | ^^^^^^^^^ '**' could be used instead -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ +style suggestion: Could have used '**' instead of 'pow' + --> tests/expr7.py:8:15 + | +8 | res = i32(pow(a, b)) + | ^^^^^^^^^ '**' could be used instead diff --git a/tests/reference/cpp-expr7-529bd53.stdout b/tests/reference/cpp-expr7-529bd53.stdout new file mode 100644 index 0000000000..81158df8ae --- /dev/null +++ b/tests/reference/cpp-expr7-529bd53.stdout @@ -0,0 +1,83 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +template +Kokkos::View from_std_vector(const std::vector &v) +{ + Kokkos::View r("r", v.size()); + for (size_t i=0; i < v.size(); i++) { + r(i) = v[i]; + } + return r; +} + +// Forward declarations +void __main__global_stmts(); +void main0(); +void test_pow(); +int32_t test_pow_1(int32_t a, int32_t b); +double __lpython_overloaded_0__pow(int32_t x, int32_t y); +float _lfortran_caimag(std::complex x); +double _lfortran_zaimag(std::complex x); +namespace { +} + +// Implementations +double __lpython_overloaded_0__pow(int32_t x, int32_t y) +{ + double _lpython_return_variable; + _lpython_return_variable = (double)(std::pow(x, y)); + return _lpython_return_variable; +} + +float _lfortran_caimag(std::complex x); + +double _lfortran_zaimag(std::complex x); + +void test_pow() +{ + int32_t a; + a = (int32_t)(__lpython_overloaded_0__pow(2, 2)); +} + +int32_t test_pow_1(int32_t a, int32_t b) +{ + int32_t _lpython_return_variable; + int32_t res; + res = (int32_t)(__lpython_overloaded_0__pow(a, b)); + _lpython_return_variable = res; + return _lpython_return_variable; +} + +void main0() +{ + int32_t c; + test_pow(); + c = test_pow_1(1, 2); +} + +void __main__global_stmts() +{ + main0(); +} + +namespace { + +void main2() { + __main__global_stmts(); +} + +} +int main(int argc, char* argv[]) +{ + Kokkos::initialize(argc, argv); + main2(); + Kokkos::finalize(); + return 0; +} diff --git a/tests/reference/cpp-expr8-704cece.json b/tests/reference/cpp-expr8-704cece.json index 5478fb2f70..1fac6d1530 100644 --- a/tests/reference/cpp-expr8-704cece.json +++ b/tests/reference/cpp-expr8-704cece.json @@ -5,9 +5,9 @@ "infile_hash": "6966e19cf343700cbc11ec1bf6a495e43c685c6fa065669875aa61ce", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "cpp-expr8-704cece.stderr", - "stderr_hash": "94db9a9e4af4eda9b774a82fb4f55aa3413db82da5be0160bde72352", - "returncode": 2 + "stdout": "cpp-expr8-704cece.stdout", + "stdout_hash": "7ac638e8146f048bd5444436ee2b2ac4f85ffa7a1d791cf526adacb4", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/cpp-expr8-704cece.stdout b/tests/reference/cpp-expr8-704cece.stdout new file mode 100644 index 0000000000..ea744708f9 --- /dev/null +++ b/tests/reference/cpp-expr8-704cece.stdout @@ -0,0 +1,37 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +template +Kokkos::View from_std_vector(const std::vector &v) +{ + Kokkos::View r("r", v.size()); + for (size_t i=0; i < v.size(); i++) { + r(i) = v[i]; + } + return r; +} + +// Forward declarations +namespace { +} + +// Implementations +namespace { + +void main2() { +} + +} +int main(int argc, char* argv[]) +{ + Kokkos::initialize(argc, argv); + main2(); + Kokkos::finalize(); + return 0; +} diff --git a/tests/reference/cpp-test_builtin_pow-56b3f92.json b/tests/reference/cpp-test_builtin_pow-56b3f92.json index 346ddf6b70..a18ad0aab9 100644 --- a/tests/reference/cpp-test_builtin_pow-56b3f92.json +++ b/tests/reference/cpp-test_builtin_pow-56b3f92.json @@ -5,9 +5,9 @@ "infile_hash": "b7d1d5e1592f5078961eb228c756e424d394f5f0383a1577f1cced1b", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, + "stdout": "cpp-test_builtin_pow-56b3f92.stdout", + "stdout_hash": "dec0af96e013cd38032672f4812f876e586bf697757278addd17b591", "stderr": "cpp-test_builtin_pow-56b3f92.stderr", - "stderr_hash": "6935bb3dd01caf67154e6dee0bb6480b2d3ecb270bc5038444391acc", - "returncode": 2 + "stderr_hash": "859ce76c74748f2d32c7eab92cfbba789a78d4cbf5818646b99806ea", + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/cpp-test_builtin_pow-56b3f92.stderr b/tests/reference/cpp-test_builtin_pow-56b3f92.stderr index e2d434b6f1..5dbb75ad24 100644 --- a/tests/reference/cpp-test_builtin_pow-56b3f92.stderr +++ b/tests/reference/cpp-test_builtin_pow-56b3f92.stderr @@ -1,11 +1,5 @@ -warning: The module 'lpython_builtin' located in $DIR/src/bin/../runtime/lpython_builtin.py cannot be loaded +style suggestion: Could have used '**' instead of 'pow' --> tests/../integration_tests/test_builtin_pow.py:11:16 | 11 | assert i32(pow(a, b)) == 32 - | ^^^^^^^^^ imported here - -semantic error: The symbol '_lpython_floordiv' not found in the module 'lpython_builtin' - --> $DIR/src/bin/../runtime/lpython_builtin.py:209:15 - | -209 | if (n_ - (n_ // 2)*2) == 0: - | ^^^^^^^ + | ^^^^^^^^^ '**' could be used instead diff --git a/tests/reference/cpp-test_builtin_pow-56b3f92.stdout b/tests/reference/cpp-test_builtin_pow-56b3f92.stdout new file mode 100644 index 0000000000..8c7a59f313 --- /dev/null +++ b/tests/reference/cpp-test_builtin_pow-56b3f92.stdout @@ -0,0 +1,269 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +Kokkos::View from_std_vector(const std::vector &v) +{ + Kokkos::View r("r", v.size()); + for (size_t i=0; i < v.size(); i++) { + r(i) = v[i]; + } + return r; +} + +// Forward declarations +void __main__global_stmts(); +void test_pow(); +double __lpython_overloaded_0__pow(int32_t x, int32_t y); +int32_t __lpython_overloaded_10__pow(int32_t x, int32_t y, int32_t z); +int64_t __lpython_overloaded_11__pow(int64_t x, int64_t y, int64_t z); +double __lpython_overloaded_1__pow(int64_t x, int64_t y); +int32_t __lpython_overloaded_2___mod(int32_t a, int32_t b); +float __lpython_overloaded_2__pow(float x, float y); +double __lpython_overloaded_3__pow(double x, double y); +float __lpython_overloaded_4__pow(int32_t x, float y); +float __lpython_overloaded_5__pow(float x, int32_t y); +double __lpython_overloaded_6__pow(int32_t x, double y); +double __lpython_overloaded_7__pow(double x, int32_t y); +int64_t __lpython_overloaded_8___mod(int64_t a, int64_t b); +int32_t __lpython_overloaded_8__pow(bool x, bool y); +std::complex __lpython_overloaded_9__complex(int32_t x, int32_t y); +std::complex __lpython_overloaded_9__pow(std::complex c, int32_t y); +float _lfortran_caimag(std::complex x); +double _lfortran_zaimag(std::complex x); +namespace { +} + +// Implementations +double __lpython_overloaded_0__pow(int32_t x, int32_t y) +{ + double _lpython_return_variable; + _lpython_return_variable = (double)(std::pow(x, y)); + return _lpython_return_variable; +} + +int32_t __lpython_overloaded_2___mod(int32_t a, int32_t b) +{ + int32_t _lpython_return_variable; + _lpython_return_variable = a - floordiv(a)*b; + return _lpython_return_variable; +} + +int32_t __lpython_overloaded_10__pow(int32_t x, int32_t y, int32_t z) +{ + int32_t _lpython_return_variable; + int32_t result; + if (y < 0) { + std::cerr << "ERROR STOP" << std::endl; + exit(1); + } + result = __lpython_overloaded_2___mod(std::pow(x, y), z); + _lpython_return_variable = result; + return _lpython_return_variable; +} + +int64_t __lpython_overloaded_8___mod(int64_t a, int64_t b) +{ + int64_t _lpython_return_variable; + _lpython_return_variable = a - floordiv(a)*b; + return _lpython_return_variable; +} + +int64_t __lpython_overloaded_11__pow(int64_t x, int64_t y, int64_t z) +{ + int64_t _lpython_return_variable; + int64_t result; + if (y < 0) { + std::cerr << "ERROR STOP" << std::endl; + exit(1); + } + result = __lpython_overloaded_8___mod(std::pow(x, y), z); + _lpython_return_variable = result; + return _lpython_return_variable; +} + +double __lpython_overloaded_1__pow(int64_t x, int64_t y) +{ + double _lpython_return_variable; + _lpython_return_variable = (double)(std::pow(x, y)); + return _lpython_return_variable; +} + +float __lpython_overloaded_2__pow(float x, float y) +{ + float _lpython_return_variable; + _lpython_return_variable = std::pow(x, y); + return _lpython_return_variable; +} + +double __lpython_overloaded_3__pow(double x, double y) +{ + double _lpython_return_variable; + _lpython_return_variable = std::pow(x, y); + return _lpython_return_variable; +} + +float __lpython_overloaded_4__pow(int32_t x, float y) +{ + float _lpython_return_variable; + _lpython_return_variable = std::pow((float)(x), y); + return _lpython_return_variable; +} + +float __lpython_overloaded_5__pow(float x, int32_t y) +{ + float _lpython_return_variable; + _lpython_return_variable = std::pow(x, (float)(y)); + return _lpython_return_variable; +} + +double __lpython_overloaded_6__pow(int32_t x, double y) +{ + double _lpython_return_variable; + _lpython_return_variable = std::pow((double)(x), y); + return _lpython_return_variable; +} + +double __lpython_overloaded_7__pow(double x, int32_t y) +{ + double _lpython_return_variable; + _lpython_return_variable = std::pow(x, (double)(y)); + return _lpython_return_variable; +} + +int32_t __lpython_overloaded_8__pow(bool x, bool y) +{ + int32_t _lpython_return_variable; + if (y && !x) { + _lpython_return_variable = 0; + return _lpython_return_variable; + } + _lpython_return_variable = 1; + return _lpython_return_variable; +} + +std::complex __lpython_overloaded_9__complex(int32_t x, int32_t y) +{ + std::complex _lpython_return_variable; + _lpython_return_variable = std::complex(x) + std::complex(y)*std::complex(0.000000, 1.000000); + return _lpython_return_variable; +} + +std::complex __lpython_overloaded_9__pow(std::complex c, int32_t y) +{ + std::complex _lpython_return_variable; + _lpython_return_variable = std::pow(c, std::complex(y)); + return _lpython_return_variable; +} + +float _lfortran_caimag(std::complex x); + +double _lfortran_zaimag(std::complex x); + +void test_pow() +{ + int32_t a; + double a1; + double a2; + int32_t b; + bool b1; + bool b2; + std::complex c1; + double eps; + float f1; + float f2; + int64_t i; + int64_t i1; + int64_t i2; + int64_t j; + int64_t k; + float p; + int32_t x; + double y; + eps = 9.99999999999999980e-13; + a = 2; + b = 5; + assert ((int32_t)(__lpython_overloaded_0__pow(a, b)) == 32); + a = 6; + b = 3; + assert ((int32_t)(__lpython_overloaded_0__pow(a, b)) == 216); + a = 2; + b = 0; + assert ((int32_t)(__lpython_overloaded_0__pow(a, b)) == 1); + a = 2; + b = -1; + a = 6; + b = -4; + i1 = 2; + i2 = 5; + assert ((int64_t)(__lpython_overloaded_1__pow(i1, i2)) == 32); + i1 = 6; + i2 = -3; + f1 = (double)(525346)/(double)(66456); + f2 = 3.00000000000000000e+00; + p = __lpython_overloaded_2__pow(f1, f2); + f1 = __lpython_overloaded_4__pow(a, f2); + f1 = __lpython_overloaded_5__pow(f2, a); + b1 = true; + b2 = false; + assert (__lpython_overloaded_8__pow(b1, b2) == 1); + assert (__lpython_overloaded_8__pow(b2, b1) == 0); + assert (__lpython_overloaded_8__pow(b1, b2) == 1); + assert (__lpython_overloaded_8__pow(false, false) == 1); + a1 = 4.50000000000000000e+00; + a2 = 2.29999999999999982e+00; + assert (abs(__lpython_overloaded_3__pow(a1, a2) - 3.17971929089206000e+01) < eps); + assert (abs(__lpython_overloaded_3__pow(a2, a1) - 4.24399889427765871e+01) < eps); + x = 3; + y = 2.29999999999999982e+00; + assert (abs(__lpython_overloaded_6__pow(x, y) - 1.25135025328431819e+01) < eps); + assert (abs(__lpython_overloaded_7__pow(y, x) - 1.21669999999999980e+01) < eps); + assert (abs(__lpython_overloaded_6__pow(x, 5.50000000000000000e+00) - 4.20888346239237194e+02) < eps); + assert (abs(__lpython_overloaded_1__pow(2, -1) - 5.00000000000000000e-01) < eps); + assert (abs(__lpython_overloaded_1__pow(6, -4) - 7.71604938271604895e-04) < eps); + assert (abs(__lpython_overloaded_1__pow(-3, -5) + 4.11522633744856002e-03) < eps); + assert (abs(__lpython_overloaded_1__pow(6, -4) - 7.71604938271604895e-04) < eps); + assert (abs(__lpython_overloaded_3__pow( 4.50000000000000000e+00, 2.29999999999999982e+00) - 3.17971929089206000e+01) < eps); + assert (abs(__lpython_overloaded_3__pow( 2.29999999999999982e+00, 0.00000000000000000e+00) - 1.00000000000000000e+00) < eps); + assert (abs(__lpython_overloaded_3__pow( 2.29999999999999982e+00, - 1.50000000000000000e+00) - 2.86687162345994395e-01) < eps); + assert (abs(__lpython_overloaded_6__pow(2, 3.39999999999999991e+00) - 1.05560632861831536e+01) < eps); + assert (abs(__lpython_overloaded_6__pow(2, - 3.39999999999999991e+00) - 9.47322854068998882e-02) < eps); + assert (abs(__lpython_overloaded_7__pow( 3.39999999999999991e+00, 9) - 6.07169927664639836e+04) < eps); + assert (abs(__lpython_overloaded_7__pow( 0.00000000000000000e+00, 53) - 0.00000000000000000e+00) < eps); + assert ((int32_t)(__lpython_overloaded_0__pow(4, 2)) == 16); + assert (abs(__lpython_overloaded_7__pow(- 4.23500000000000000e+03, 52) - 3.94800380598526379e+188) < eps); + i = 7; + j = 2; + k = 5; + assert (__lpython_overloaded_11__pow(i, j, k) == 4); + assert (__lpython_overloaded_10__pow(102, 3, 121) == 38); + c1 = __lpython_overloaded_9__complex(4, 5); + c1 = __lpython_overloaded_9__pow(c1, 4); +} + +void __main__global_stmts() +{ + test_pow(); +} + +namespace { + +void main2() { + __main__global_stmts(); +} + +} +int main(int argc, char* argv[]) +{ + Kokkos::initialize(argc, argv); + main2(); + Kokkos::finalize(); + return 0; +} diff --git a/tests/reference/pass_loop_vectorise-vec_01-be9985e.json b/tests/reference/pass_loop_vectorise-vec_01-be9985e.json index e023d7e0eb..c5e89043a1 100644 --- a/tests/reference/pass_loop_vectorise-vec_01-be9985e.json +++ b/tests/reference/pass_loop_vectorise-vec_01-be9985e.json @@ -5,9 +5,9 @@ "infile_hash": "f85ca108780c53c54878d119822d56fb834cf4b5121511cbaca2c2fe", "outfile": null, "outfile_hash": null, - "stdout": null, - "stdout_hash": null, - "stderr": "pass_loop_vectorise-vec_01-be9985e.stderr", - "stderr_hash": "67b435304368f453ffeda263b2c1c1a591ce3e9a4100d21fbf1ec7a5", - "returncode": 2 + "stdout": "pass_loop_vectorise-vec_01-be9985e.stdout", + "stdout_hash": "eaa2378bdc2d4a369ca7cce31084f626594f2e649116e7634df8f034", + "stderr": null, + "stderr_hash": null, + "returncode": 0 } \ No newline at end of file diff --git a/tests/reference/pass_loop_vectorise-vec_01-be9985e.stdout b/tests/reference/pass_loop_vectorise-vec_01-be9985e.stdout new file mode 100644 index 0000000000..26b99df62d --- /dev/null +++ b/tests/reference/pass_loop_vectorise-vec_01-be9985e.stdout @@ -0,0 +1,527 @@ +(TranslationUnit + (SymbolTable + 1 + { + __main__: + (Module + (SymbolTable + 2 + { + __main__global_stmts: + (Function + (SymbolTable + 207 + { + + }) + __main__global_stmts + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [loop_vec] + [] + [(SubroutineCall + 2 loop_vec + () + [] + () + )] + () + Public + .false. + .false. + () + ), + loop_vec: + (Function + (SymbolTable + 203 + { + a: + (Variable + 203 + a + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 9216 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + b: + (Variable + 203 + b + [] + Local + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 9216 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + i: + (Variable + 203 + i + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + vector_copy_f64[9216]f64[9216]i32@IntrinsicOptimization: + (Function + (SymbolTable + 209 + { + __1_k: + (Variable + 209 + __1_k + [] + Local + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + arg0: + (Variable + 209 + arg0 + [] + In + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 9216 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + arg1: + (Variable + 209 + arg1 + [] + In + () + () + Default + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 9216 (Integer 4)))] + FixedSizeArray + ) + () + Source + Public + Required + .false. + ), + arg2: + (Variable + 209 + arg2 + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + arg3: + (Variable + 209 + arg3 + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + arg4: + (Variable + 209 + arg4 + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ), + arg5: + (Variable + 209 + arg5 + [] + In + () + () + Default + (Integer 4) + () + Source + Public + Required + .false. + ) + }) + vector_copy_f64[9216]f64[9216]i32@IntrinsicOptimization + (FunctionType + [(Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 9216 (Integer 4)))] + FixedSizeArray + ) + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 9216 (Integer 4)))] + FixedSizeArray + ) + (Integer 4) + (Integer 4) + (Integer 4) + (Integer 4)] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [] + [(Var 209 arg0) + (Var 209 arg1) + (Var 209 arg2) + (Var 209 arg3) + (Var 209 arg4) + (Var 209 arg5)] + [(= + (Var 209 __1_k) + (IntegerBinOp + (Var 209 arg2) + Sub + (Var 209 arg4) + (Integer 4) + () + ) + () + ) + (WhileLoop + () + (IntegerCompare + (IntegerBinOp + (Var 209 __1_k) + Add + (Var 209 arg4) + (Integer 4) + () + ) + Lt + (Var 209 arg3) + (Logical 4) + () + ) + [(= + (Var 209 __1_k) + (IntegerBinOp + (Var 209 __1_k) + Add + (Var 209 arg4) + (Integer 4) + () + ) + () + ) + (= + (ArrayItem + (Var 209 arg0) + [(() + (Var 209 __1_k) + ())] + (Real 8) + RowMajor + () + ) + (ArrayItem + (Var 209 arg1) + [(() + (Var 209 __1_k) + ())] + (Real 8) + RowMajor + () + ) + () + )] + )] + () + Public + .false. + .false. + () + ) + }) + loop_vec + (FunctionType + [] + () + Source + Implementation + () + .false. + .false. + .false. + .false. + .false. + [] + .false. + ) + [vector_copy_f64[9216]f64[9216]i32@IntrinsicOptimization] + [] + [(= + (Var 203 a) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 9216 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (= + (Var 203 b) + (ArrayConstant + [] + (Array + (Real 8) + [((IntegerConstant 0 (Integer 4)) + (IntegerConstant 9216 (Integer 4)))] + FixedSizeArray + ) + RowMajor + ) + () + ) + (DoLoop + () + ((Var 203 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 9216 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 9215 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(= + (ArrayItem + (Var 203 b) + [(() + (Var 203 i) + ())] + (Real 8) + RowMajor + () + ) + (RealConstant + 5.000000 + (Real 8) + ) + () + )] + ) + (DoLoop + () + ((Var 203 i) + (IntegerConstant 0 (Integer 4)) + (IntegerConstant 1151 (Integer 4)) + (IntegerConstant 1 (Integer 4))) + [(SubroutineCall + 203 vector_copy_f64[9216]f64[9216]i32@IntrinsicOptimization + () + [((Var 203 a)) + ((Var 203 b)) + ((IntegerBinOp + (Var 203 i) + Mul + (IntegerConstant 8 (Integer 4)) + (Integer 4) + () + )) + ((IntegerBinOp + (IntegerBinOp + (Var 203 i) + Add + (IntegerConstant 1 (Integer 4)) + (Integer 4) + () + ) + Mul + (IntegerConstant 8 (Integer 4)) + (Integer 4) + () + )) + ((IntegerConstant 1 (Integer 4))) + ((IntegerConstant 8 (Integer 4)))] + () + )] + ) + (DoLoop + () + ((Var 203 i) + (IntegerConstant 0 (Integer 4)) + (IntegerBinOp + (IntegerConstant 9216 (Integer 4)) + Sub + (IntegerConstant 1 (Integer 4)) + (Integer 4) + (IntegerConstant 9215 (Integer 4)) + ) + (IntegerConstant 1 (Integer 4))) + [(Assert + (RealCompare + (ArrayItem + (Var 203 a) + [(() + (Var 203 i) + ())] + (Real 8) + RowMajor + () + ) + Eq + (RealConstant + 5.000000 + (Real 8) + ) + (Logical 4) + () + ) + () + )] + )] + () + Public + .false. + .false. + () + ) + }) + __main__ + [numpy] + .false. + .false. + ), + lpython_builtin: + (IntrinsicModule lpython_builtin), + main_program: + (Program + (SymbolTable + 208 + { + __main__global_stmts: + (ExternalSymbol + 208 + __main__global_stmts + 2 __main__global_stmts + __main__ + [] + __main__global_stmts + Public + ) + }) + main_program + [__main__] + [(SubroutineCall + 208 __main__global_stmts + 2 __main__global_stmts + [] + () + )] + ), + numpy: + (Module numpy) + }) + [] +)