roc/crates/compiler/can
Ayaz Hafiz 0a807dc43e
Provide warning for defs that are used only in (mutual) recursion
This patch provides errors for defs that are used only in
possibly-mutual recursion, and are not reachable outside of their
recursive closures. For example:

```
test_report!(
    mutual_recursion_not_reached_nested,
    indoc!(
        r#"
        app "test" provides [main] to "./platform"

        main =
            f = \{} -> if Bool.true then "" else g {}
            g = \{} -> if Bool.true then "" else f {}
            ""
        "#
    ),
@r###"
── DEFINITIONs ONLY USED IN RECURSION ──────────────────── /code/proj/Main.roc ─

These 2 definitions are only used in mutual recursion with themselves:

4│>      f = \{} -> if Bool.true then "" else g {}
5│>      g = \{} -> if Bool.true then "" else f {}

If you don't intend to use or export any of them, they should all be
removed!
"###
);
```
2022-12-02 11:50:12 -06:00
..
src Provide warning for defs that are used only in (mutual) recursion 2022-12-02 11:50:12 -06:00
tests Support OIOP for type aliases 2022-10-31 09:38:21 -05:00
Cargo.toml more workspace dependencies 2022-11-13 16:10:02 +01:00