Open
Description
repro: https://github.com/rebcabin/lpython/tree/brian-lasr/lasr/LP-pycharm/Issue2025
offending code lasr_parser.py
:
import lasr_lexer as ll
# from lasr_lexer import LasrLexer # workaround
from lpython import i32, dataclass
@dataclass
class Node:
lexer : ll.LasrLexer = ll.LasrLexer()
run (shows CPython passing:
(lp) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm/Issue2025)───────────────────────────────────────────────────────────────────────────────────────────────(brian@Golf37:s012)─┐
└─(10:52:57 on brian-lasr ✭)──> ~/CLionProjects/lpython/src/bin/lpython -I. lasr_parser.py ──(Sun,Jun25)─┘
semantic error: 'll' is not defined in the scope
--> lasr_parser.py:10:13
|
10 | lexer : ll.LasrLexer = ll.LasrLexer()
| ^^^^^^^^^^^^
Note: if any of the above error or warning messages are not clear or are lacking
context please report it to us (we consider that a bug that must be fixed).
(lp) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm/Issue2025)───────────────────────────────────────────────────────────────────────────────────────────────(brian@Golf37:s012)─┐
└─(10:55:13 on brian-lasr ✭)──> PYTHONPATH='../../../src/runtime/lpython' python lasr_parser.py 2 ↵ ──(Sun,Jun25)─┘
(lp) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm/Issue2025)───────────────────────────────────────────────────────────────────────────────────────────────(brian@Golf37:s012)─┐
└─(10:56:00 on brian-lasr ✭)──>
workaround (both LP and CP pass):
# import lasr_lexer as ll
from lasr_lexer import LasrLexer # workaround
from lpython import i32, dataclass
@dataclass
class Node:
lexer : LasrLexer = LasrLexer() ############ ATTENTION ############