from numpy import empty, int16
from lpython import i16, i32, Const
def spot_print_lpython_array(a: i16[:]) -> None:
print(a)
def main() -> i32:
n : Const[i32] = 15
m : Const[i32] = 3
Anm: i16[n, m] = empty((n,m), dtype=int16)
i: i32; j: i32
for i in range(n):
for j in range(m):
Anm[i,j] = i16(5)
spot_print_lpython_array(Anm)
return 0
if __name__ == "__main__":
main()
This gives:
$ lpython array_06.py
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
File "/Users/ondrej/repos/lpython/src/bin/lpython.cpp", line 1872
err = compile_python_to_object_file(arg_file, tmp_o, runtime_library_dir,
File "/Users/ondrej/repos/lpython/src/bin/lpython.cpp", line 824
res = fe.get_llvm3(*asr, pass_manager, diagnostics, infile);
File "/Users/ondrej/repos/lpython/src/lpython/python_evaluator.cpp", line 71
run_fn, infile);
File "/Users/ondrej/repos/lpython/src/libasr/codegen/asr_to_llvm.cpp", line 9276
pass_manager.apply_passes(al, &asr, co.po, diagnostics);
File "/Users/ondrej/repos/lpython/src/libasr/pass/pass_manager.h", line 299
apply_passes(al, asr, _passes, pass_options, diagnostics);
File "/Users/ondrej/repos/lpython/src/libasr/pass/pass_manager.h", line 160
_passes_db[passes[i]](al, *asr, pass_options);
File "/Users/ondrej/repos/lpython/src/libasr/pass/pass_array_by_data.cpp", line 651
u.visit_TranslationUnit(unit);
File "../libasr/asr.h", line 39627
File "../libasr/asr.h", line 5060
File "../libasr/asr.h", line 4774
File "../libasr/asr.h", line 39645
File "../libasr/asr.h", line 5060
File "../libasr/asr.h", line 4775
File "../libasr/asr.h", line 39661
File "../libasr/asr.h", line 39621
File "../libasr/asr.h", line 5077
File "../libasr/asr.h", line 4825
File "/Users/ondrej/repos/lpython/src/libasr/pass/pass_array_by_data.cpp", line 573
visit_Call(x);
File "/Users/ondrej/repos/lpython/src/libasr/pass/pass_array_by_data.cpp", line 540
throw LCompilersException("Number of arguments in the new "
LCompilersException: Number of arguments in the new function call doesn't satisfy min_args <= new_args.size() <= max_args, 3 <= 5 <= 3
Rather, the error should already happen in AST->ASR, and it should say that the parameter type a: i16[:] is incompatible with the argument Anm: i16[n, m].
Example:
This gives:
Rather, the error should already happen in AST->ASR, and it should say that the parameter type
a: i16[:]
is incompatible with the argumentAnm: i16[n, m]
.