Skip to content

Fix bug in LiftImperativeExpression #39

@keyboardDrummer

Description

@keyboardDrummer

For the handling of "-- Imperative call in expression position: lift to an assignment."

I would expect it to do:

      let previousPrependedStmts := takePrepends
      let outputs := match model.get callee with
        | .staticProcedure proc => proc.outputs
        | .instanceProcedure _ proc => proc.outputs
        | _ => []
      let callResultVar ← freshCondVar
      let callResultType ← match outputs with
        | [single] => pure single.type
        | _ => computeType expr
      let liftedCall := [
        ⟨.Var (.Declare ⟨callResultVar, callResultType⟩), source⟩,
        ⟨.Assign [⟨.Local callResultVar, source⟩] seqCall, source⟩
      ]
      modify fun s => { s with prependedStmts := s.prependedStmts ++ liftedCall ++ previousPrependedStmts}
      return bare (.Var (.Local callResultVar))

See if this breaks any of the existing test and if it does, instead of experimenting with fixes, try to analyze why it does not work and let me know why.

If it does work, uncomment the commented out test-case in addProcCaller and see if that works. If it doesn't analyze why but don't fix.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions