From 31ad011daf24ed4bd32a1ea349042596b22b956a Mon Sep 17 00:00:00 2001 From: arty Date: Thu, 14 Sep 2023 11:29:04 -0700 Subject: [PATCH] Fix rename error which caused clvm ops and callables to be renamed --- src/compiler/rename.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/rename.rs b/src/compiler/rename.rs index 833706754..ca47292e5 100644 --- a/src/compiler/rename.rs +++ b/src/compiler/rename.rs @@ -234,12 +234,18 @@ fn rename_in_bodyform( }, BodyForm::Call(l, vs, tail) => { - let new_vs = map_m( + let mut new_vs = map_m( &|x: &Rc| -> Result, CompileErr> { Ok(Rc::new(rename_in_bodyform(namemap, x.clone())?)) }, vs, )?; + // Ensure that we haven't renamed the 0th element of a call + // They exist in a separate (global) namespace of callables + // and aren't in the variable scope stack. + if !vs.is_empty() { + new_vs[0] = vs[0].clone(); + } let new_tail = if let Some(t) = tail.as_ref() { Some(Rc::new(rename_in_bodyform(namemap, t.clone())?)) } else {