ohua-dev / ohua-core

Core Haskell library for the compiler
https://ohua-dev.github.io
Eclipse Public License 1.0
5 stars 0 forks source link

Recursive function calls remain unchecked #38

Open Feliix42 opened 5 years ago

Feliix42 commented 5 years ago

The following algorithm contains the obvious error that the recursive function call has too few arguments, yet the compiler does not report this error, provoking the generation of incorrect code in the backend that does not compile for no apparent reason.

fn transact(maze: Maze, to_map: Vec<(Point, Point)>, frequency: usize, stats: (u32, u32)) -> (Maze, (u32, u32)) {
    /* ... */

    if (is_not_empty(to_remap)) {
        transact(new_maze, to_remap, ct)
    } else {
        ret
    }
}

To improve this I suggest a check of arguments for recursive function calls.