mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-09-11 11:56:54 +03:00
Merge pull request #659 from HigherOrderCO/hvm-net-readback-var-conflict
Fix readback when hvm net has `a{n}` or `x{n}` vars
This commit is contained in:
commit
b4a20f148d
@ -14,6 +14,7 @@ and this project does not currently adhere to a particular versioning scheme.
|
||||
- Fix local definitions not being desugared properly. ([#623][gh-623])
|
||||
- Expand references to functions generated by the `float_combinators` pass inside the main function. ([#642][gh-642])
|
||||
- Expand references inside constructors in the main function. ([#643][gh-643])
|
||||
- Fix readback when hvm net has `a{n}` or `x{n}` vars. ([#659][gh-659])
|
||||
|
||||
### Added
|
||||
|
||||
@ -416,4 +417,5 @@ and this project does not currently adhere to a particular versioning scheme.
|
||||
[gh-642]: https://github.com/HigherOrderCO/Bend/issues/642
|
||||
[gh-643]: https://github.com/HigherOrderCO/Bend/issues/643
|
||||
[gh-648]: https://github.com/HigherOrderCO/Bend/issues/648
|
||||
[gh-659]: https://github.com/HigherOrderCO/Bend/pull/659
|
||||
[Unreleased]: https://github.com/HigherOrderCO/Bend/compare/0.2.36...HEAD
|
||||
|
@ -23,7 +23,8 @@ fn hvm_to_inodes(net: &Net) -> INodes {
|
||||
|
||||
// Convert all the trees forming active pairs.
|
||||
for (i, (_, tree1, tree2)) in net.rbag.iter().enumerate() {
|
||||
let tree_root = format!("a{i}");
|
||||
// This name cannot appear anywhere in the original net
|
||||
let tree_root = format!("%a{i}");
|
||||
let mut tree1 = tree_to_inodes(tree1, tree_root.clone(), net_root, &mut n_vars);
|
||||
inodes.append(&mut tree1);
|
||||
let mut tree2 = tree_to_inodes(tree2, tree_root, net_root, &mut n_vars);
|
||||
@ -33,7 +34,8 @@ fn hvm_to_inodes(net: &Net) -> INodes {
|
||||
}
|
||||
|
||||
fn new_var(n_vars: &mut NodeId) -> String {
|
||||
let new_var = format!("x{n_vars}");
|
||||
// This name cannot appear anywhere in the original net
|
||||
let new_var = format!("%x{n_vars}");
|
||||
*n_vars += 1;
|
||||
new_var
|
||||
}
|
||||
@ -46,7 +48,6 @@ fn tree_to_inodes(tree: &Tree, tree_root: String, net_root: &str, n_vars: &mut N
|
||||
n_vars: &mut NodeId,
|
||||
) -> String {
|
||||
if let Tree::Var { nam } = subtree {
|
||||
//
|
||||
if nam == net_root {
|
||||
"_".to_string()
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user