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.
For the handling of "-- Imperative call in expression position: lift to an assignment."
I would expect it to do:
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
addProcCallerand see if that works. If it doesn't analyze why but don't fix.