mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-11-05 04:51:40 +03:00
Fix wrong main skip in pre reduce
This commit is contained in:
parent
1909eb26a6
commit
e2d52fb8a9
@ -17,7 +17,7 @@ pub fn pre_reduce_book(book: &mut BTreeMap<String, hvmc::ast::Net>, cross_refs:
|
||||
let mut rt_book = hvmc::ast::book_to_runtime(book);
|
||||
for (nam, net) in book.iter() {
|
||||
// Skip unnecessary work
|
||||
if net.rdex.is_empty() || nam == DefNames::ENTRY_POINT {
|
||||
if net.rdex.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let heap = Heap::init(1 << 18);
|
||||
@ -26,7 +26,8 @@ pub fn pre_reduce_book(book: &mut BTreeMap<String, hvmc::ast::Net>, cross_refs:
|
||||
rt.boot(fid);
|
||||
rt.expand(&rt_book);
|
||||
|
||||
let iters = if cross_refs {
|
||||
let fully_reduce = cross_refs && nam != DefNames::ENTRY_POINT;
|
||||
let iters = if fully_reduce {
|
||||
let mut iters = 0;
|
||||
// TODO: If I just call `rt.normal` some terms expand infinitely, so I put this workaround.
|
||||
// But I don't think this is the right way (even if it works).
|
||||
|
@ -2,7 +2,5 @@
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/addition.hvm
|
||||
---
|
||||
@main = a
|
||||
& (b c) ~ (#8 a)
|
||||
& #1 ~ <+ #1 <+ b c>>
|
||||
@main = #10
|
||||
|
||||
|
@ -2,6 +2,5 @@
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/exp.hvm
|
||||
---
|
||||
@main = a
|
||||
& ({3 (b c) (c d)} (b d)) ~ (({5 (e f) (f g)} (e g)) a)
|
||||
@main = ({5 ({5 a b} c) (c {5 b d})} (a d))
|
||||
|
||||
|
@ -2,6 +2,5 @@
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/spacing.hvm
|
||||
---
|
||||
@main = ({3 a b} c)
|
||||
& (d d) ~ (b (a c))
|
||||
@main = ({3 a (a b)} b)
|
||||
|
||||
|
@ -2,6 +2,5 @@
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/spacing2.hvm
|
||||
---
|
||||
@main = a
|
||||
& (b b) ~ ((c c) a)
|
||||
@main = (a a)
|
||||
|
||||
|
@ -2,8 +2,5 @@
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/tagged_dup.hvm
|
||||
---
|
||||
@main = a
|
||||
& (b b) ~ {3 (c (d (e (f (g a))))) c}
|
||||
& (h h) ~ {3 f g}
|
||||
& (i i) ~ {3 d e}
|
||||
@main = (a a)
|
||||
|
||||
|
@ -2,6 +2,5 @@
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/tagged_lam.hvm
|
||||
---
|
||||
@main = a
|
||||
& [{2 <+ #1 b> b} {2 {3 c <* c d>} d}] ~ {2 #2 a}
|
||||
@main = [#3 #4]
|
||||
|
||||
|
@ -8,6 +8,5 @@ input_file: tests/golden_tests/compile_file/weekday.hvm
|
||||
@M = {2 * @L}
|
||||
@N = {2 * @M}
|
||||
@Saturday = {2 * @N}
|
||||
@main = a
|
||||
& (b b) ~ (@Saturday a)
|
||||
@main = @Saturday
|
||||
|
||||
|
@ -2,6 +2,5 @@
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o0/addition_const.hvm
|
||||
---
|
||||
@main = a
|
||||
& #1 ~ <+ #2 a>
|
||||
@main = #3
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user