Skip to content

Commit

Permalink
Remove generated functions from error message
Browse files Browse the repository at this point in the history
  • Loading branch information
imaqtkatt committed Mar 22, 2024
1 parent ad4f1bb commit a8dc4ac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/hvmc_net/mutual_recursion.message
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ You have 2 options:

1. Easy Fix: use lazy-mode.

Just append the `-L` option to `HVM-Lang`, and it will run in lazy-mode. It has the advantage of not doing wasteful work, having an improved complexity class, and being compatible with unrestricted recursion! It has a small overhead though, and isn't compatible with GPU.
Just append the `-L` option to `HVM-Lang`, and it will run in lazy-mode. It has the advantage of not doing wasteful work, having an improved complexity class, and being compatible with unrestricted recursion. It has a small overhead though, and isn't compatible with GPU.

2. Hard Fix: refactor the program to use lazy references.

Expand Down
8 changes: 7 additions & 1 deletion src/hvmc_net/mutual_recursion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ fn show_cycles(cycles: &[Vec<Ref>]) -> String {
.iter()
.take(5)
.map(|cycle| {
let cycle_str = cycle.iter().chain(cycle.first()).cloned().collect::<Vec<_>>().join(" -> ");
let cycle_str = cycle
.iter()
.filter(|nam| !nam.contains("$"))
.chain(cycle.first())
.cloned()
.collect::<Vec<_>>()
.join(" -> ");
format!("{:ERR_INDENT_SIZE$}* {}", "", cycle_str)
})
.collect::<Vec<String>>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ input_file: tests/golden_tests/compile_file_o_all/repeated_name_trucation.hvm
Warnings:
Seems like you're trying to run some recursive function(s) on strict-mode.
The following recursive cycles are not compatible with strict-mode the way these functions were written:
* long_name_that_truncates -> long_name_that_truncates$C0 -> long_name_that_truncates
* long_name_that_truncates -> long_name_that_truncates

Due to the ultra-greedy nature of strict-mode, that might result in infinite loops.
If the float-combinators optimization is not on, we recommend activating it.
Expand Down

0 comments on commit a8dc4ac

Please sign in to comment.