feat(machine): fix Value::Constr fields order
cc @MicroProofs
This commit is contained in:
parent
028528899c
commit
20917bbd5b
|
@ -163,8 +163,10 @@ impl Machine {
|
|||
Term::Constr { tag, mut fields } => {
|
||||
self.step_and_maybe_spend(StepKind::Constr)?;
|
||||
|
||||
fields.reverse();
|
||||
|
||||
if !fields.is_empty() {
|
||||
let popped_field = fields.remove(0);
|
||||
let popped_field = fields.pop().unwrap();
|
||||
|
||||
Ok(MachineState::Compute(
|
||||
Context::FrameConstr(env.clone(), tag, fields, vec![], context.into()),
|
||||
|
@ -213,10 +215,10 @@ impl Machine {
|
|||
Context::FrameAwaitArg(fun, ctx) => self.apply_evaluate(*ctx, fun, value),
|
||||
Context::FrameAwaitFunValue(arg, ctx) => self.apply_evaluate(*ctx, value, arg),
|
||||
Context::FrameConstr(env, tag, mut fields, mut resolved_fields, ctx) => {
|
||||
resolved_fields.insert(0, value);
|
||||
resolved_fields.push(value);
|
||||
|
||||
if !fields.is_empty() {
|
||||
let popped_field = fields.remove(0);
|
||||
let popped_field = fields.pop().unwrap();
|
||||
|
||||
Ok(MachineState::Compute(
|
||||
Context::FrameConstr(env.clone(), tag, fields, resolved_fields, ctx),
|
||||
|
@ -376,7 +378,7 @@ fn transfer_arg_stack(mut args: Vec<Value>, ctx: Context) -> Context {
|
|||
if args.is_empty() {
|
||||
ctx
|
||||
} else {
|
||||
let popped_field = args.remove(0);
|
||||
let popped_field = args.pop().unwrap();
|
||||
|
||||
transfer_arg_stack(args, Context::FrameAwaitFunValue(popped_field, ctx.into()))
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
-- constr can have arbitrary terms in it
|
||||
(program 1.1.0
|
||||
(constr 1 (con integer 1) (lam x x) (constr 0 (con integer 1)))
|
||||
)
|
|
@ -0,0 +1,2 @@
|
|||
({cpu: 115100
|
||||
| mem: 600})
|
|
@ -0,0 +1 @@
|
|||
(program 1.1.0 (constr 1 (con integer 1) (lam x x) (constr 0 (con integer 1))))
|
Loading…
Reference in New Issue