lcompilers / lpython

Python compiler
https://lpython.org/
Other
1.5k stars 158 forks source link

Assert failed: unclassified head `IntrinsicModule` here #1498

Open rebcabin opened 1 year ago

rebcabin commented 1 year ago

I don't see IntrinsicModule in ASR.asdl, so my semiautomatic ASR processors can't pick it up ! I'll hack a special case for now. Comes from tests/expr7.py

certik commented 1 year ago

Just run LPython with --with-intrinsic-mods, then it will fully expand all intrinsic modules.

rebcabin commented 1 year ago

That removes the problem, but doesn't solve the problem. I still need to know what kind of thing IntrinsicModule is ... is it a symbol like Module or Function? It must eventually live somewhere in ASR.asdl, otherwise it's another loose, unspecified entity like SymbolTable and identifier. We don't want to accumulate too many of those.

For the time-being, I'll assume it's a symbol as if it were specified as a symbol in ASR.asdl.

rebcabin commented 1 year ago

See Issues #1505 and #1420 to see why I cannot progress with --with-intrinsic-mods until the keyword-patching problem (foobar: to :foobar) is fixed. I can progress by treating InstrinsicModule as an ASR symbol via a special case, not from ASR.asdl

      (let [head (first node)]

        (cond

          (or (= head 'SymbolTable) (= head 'ForTest))
          ((eval-symbol node) penv) ; SymbolTable is an unspec'ced symbol

          ;; TODO: Issues #1505, #1420, #1498
          ;; https://github.com/lcompilers/lpython/issues/1498
          (= head 'IntrinsicModule)
          ((eval-symbol node penv))

          (composite? head)
          (eval-composite head node penv)

          (symconst? head)
          (assert false (f-str "Shouldn't have the symconst {head} here."))

          (tuple? head)
          ((eval-tuple node) penv)

          :else
          (assert false (f-str "unclassified head {head} here"))
          ))