Repository navigation
Open
Labels
bugSomething isn't working
Description
Should perhaps produce a NotImplemented error message:
(lp) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm)─────────────────────────────────────────────────────────────────────────────────────────────────────────(brian@Golf37:s012)─┐
└─(15:35:42 on brian-lasr ✹ ✭)──> cat > expr45.py ──(Thu,Jun22)─┘
def foo():
def bar():
pass
pass
(lp) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm)─────────────────────────────────────────────────────────────────────────────────────────────────────────(brian@Golf37:s012)─┐
└─(15:36:41 on brian-lasr ✹ ✭)──> PYTHONPATH='../../src/runtime/lpython' python expr45.py ──(Thu,Jun22)─┘
(lp) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm)─────────────────────────────────────────────────────────────────────────────────────────────────────────(brian@Golf37:s012)─┐
└─(15:36:50 on brian-lasr ✹ ✭)──> ../../src/bin/lpython -I. ./expr45.py ──(Thu,Jun22)─┘
Traceback (most recent call last):
File "/Users/brian/CLionProjects/lpython/src/bin/lpython.cpp", line 1844
err = compile_python_to_object_file(arg_file, tmp_o, runtime_library_dir,
File "/Users/brian/CLionProjects/lpython/src/bin/lpython.cpp", line 783
r1 = LCompilers::LPython::python_ast_to_asr(al, lm, *ast, diagnostics, compiler_options,
File "/Users/brian/CLionProjects/lpython/src/lpython/semantics/python_ast_to_asr.cpp", line 7532
auto res2 = body_visitor(al, lm, *ast_m, diagnostics, unit, main_module,
File "/Users/brian/CLionProjects/lpython/src/lpython/semantics/python_ast_to_asr.cpp", line 7485
b.visit_Module(ast);
File "/Users/brian/CLionProjects/lpython/src/lpython/semantics/python_ast_to_asr.cpp", line 4620
visit_stmt(*x.m_body[i]);
File "/Users/brian/CLionProjects/lpython/src/lpython/python_ast.h", line 1883
void visit_stmt(const stmt_t &b) { visit_stmt_t(b, self()); }
File "/Users/brian/CLionProjects/lpython/src/lpython/python_ast.h", line 1751
case stmtType::FunctionDef: { v.visit_FunctionDef((const FunctionDef_t &)x); return; }
File "/Users/brian/CLionProjects/lpython/src/lpython/semantics/python_ast_to_asr.cpp", line 4727
handle_fn(x, *f);
File "/Users/brian/CLionProjects/lpython/src/lpython/semantics/python_ast_to_asr.cpp", line 4709
transform_stmts(body, x.n_body, x.m_body);
File "/Users/brian/CLionProjects/lpython/src/lpython/semantics/python_ast_to_asr.cpp", line 4580
this->visit_stmt(*m_body[i]);
File "/Users/brian/CLionProjects/lpython/src/lpython/python_ast.h", line 1883
void visit_stmt(const stmt_t &b) { visit_stmt_t(b, self()); }
File "/Users/brian/CLionProjects/lpython/src/lpython/python_ast.h", line 1751
case stmtType::FunctionDef: { v.visit_FunctionDef((const FunctionDef_t &)x); return; }
File "/Users/brian/CLionProjects/lpython/src/lpython/semantics/python_ast_to_asr.cpp", line 4723
ASR::symbol_t *t = current_scope->get_symbol(x.m_name);
Binary file "/usr/lib/system/libsystem_platform.dylib", local address: 0x18042ea23
Segfault: Signal SIGSEGV (segmentation fault) receivedMetadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
certik commentedon Jun 22, 2023
We support this in LFortran, so it shouldn't be hard to get working, at least basic cases.
certik commentedon Jul 7, 2023
@arteevraina here is how to visit the nested functions:
The following now works:
Relevant part of the ASR:
main0: (Function (SymbolTable 2 { bar: (Function (SymbolTable 3 { foo: (Function (SymbolTable 4 { }) foo (FunctionType []This also works:
But some other combinations don't work yet.