Skip to content

Commit

Permalink
Readd oall eta tests
Browse files Browse the repository at this point in the history
  • Loading branch information
imaqtkatt committed Apr 1, 2024
1 parent b8a9632 commit 3126eba
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ pub fn compile_book(
if opts.pre_reduce {
core_book.pre_reduce(&|x| x == book.hvmc_entrypoint(), None, 100_000);
}
if opts.eta {
core_book.values_mut().for_each(Net::eta_reduce);
}
if opts.prune {
prune_defs(&mut core_book, book.hvmc_entrypoint().to_string());
}
Expand Down
2 changes: 2 additions & 0 deletions src/term/transform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ pub mod definition_pruning;
pub mod desugar_match_defs;
pub mod encode_adts;
pub mod encode_match_terms;
pub mod fix_match_defs;
pub mod fix_match_terms;
pub mod float_combinators;
pub mod inline;
pub mod linearize_matches;
Expand Down
5 changes: 5 additions & 0 deletions tests/golden_tests/compile_file_o_all/eta_chain.hvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Baz a b c = (+ a (+ b c))
Bar a b = (Baz a b)
Foo a = (Bar a)

main = λa (Foo a)
2 changes: 2 additions & 0 deletions tests/golden_tests/compile_file_o_all/unapplied_eta.hvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Id = λa a
main = λa (Id a)
9 changes: 8 additions & 1 deletion tests/snapshots/compile_file_o_all__eta_chain.hvm.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@
source: tests/golden_tests.rs
input_file: tests/golden_tests/compile_file_o_all/eta_chain.hvm
---
@main = (<+ a b> (<+ c a> (c b)))
@Bar = @Baz

@Baz = (<+ a b> (<+ c a> (c b)))

@Foo = @Bar

@main = a
& @Foo ~ a
3 changes: 2 additions & 1 deletion tests/snapshots/compile_file_o_all__unapplied_eta.hvm.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
source: tests/golden_tests.rs
input_file: tests/golden_tests/compile_file_o_all/unapplied_eta.hvm
---
@main = (a a)
@main = a
& (c c) ~ a

0 comments on commit 3126eba

Please sign in to comment.