Skip to content

"pass" in dataclass asserts #1988

@rebcabin

Description

@rebcabin

repro: https://github.com/rebcabin/lpython/tree/brian-lasr/lasr/LP-pycharm/Issue1988

the offending code. Remove the pass and everything is ok.

@dataclass
class Pattern:
    _foo : str
    pass

CPython:

(lp) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm/Issue1988)───────────────────────────────────────────────────────────────────────────────────────────────(brian@Golf37:s014)─┐
└─(12:12:04 on brian-lasr ✭)──> PYTHONPATH='../../../src/runtime/lpython' python lasr_lexer.py                                                            ──(Wed,Jun21)─┘
STRINGIO TEST
READ-SEEK-TELL-TEST
LEXER TEST

LPython:

└─(12:10:20 on brian-lasr ✖ ✹ ✭)──> ~/CLionProjects/lpython/src/bin/lpython -I. lasr_lexer.py                                                             ──(Wed,Jun21)─┘
Internal Compiler Error: Unhandled exception
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 7495
    auto res = symbol_table_visitor(al, lm, *ast_m, diagnostics, main_module,
  File "/Users/brian/CLionProjects/lpython/src/lpython/semantics/python_ast_to_asr.cpp", line 4524
    v.visit_Module(ast);
  File "/Users/brian/CLionProjects/lpython/src/lpython/semantics/python_ast_to_asr.cpp", line 3847
    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 1752
    case stmtType::AsyncFunctionDef: { v.visit_AsyncFunctionDef((const AsyncFunctionDef_t &)x); return; }
  File "/Users/brian/CLionProjects/lpython/src/lpython/semantics/python_ast_to_asr.cpp", line 3078
    visit_ClassMembers(x, member_names, struct_dependencies, false, class_abi);
  File "/Users/brian/CLionProjects/lpython/src/lpython/semantics/python_ast_to_asr.cpp", line 2872
    LCOMPILERS_ASSERT(AST::is_a<AST::AnnAssign_t>(*x.m_body[i]));
AssertFailed: AST::is_a<AST::AnnAssign_t>(*x.m_body[i])

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions