Commit graph

1161 commits

Author SHA1 Message Date
Ayaz Hafiz
01dea13b49
Pretty print symbols 2022-12-03 22:33:45 -06:00
Ayaz Hafiz
b0300e4e90
Fix bug in resolving layout 2022-12-03 22:18:15 -06:00
Ayaz Hafiz
7b21936d4f
Add mono checker to tests 2022-12-03 22:10:37 -06:00
Ayaz Hafiz
6e72307736
Format problems reported by the IR checker 2022-12-03 21:35:01 -06:00
Ayaz Hafiz
a84aebf2d3
Implement a type checker for the mono IR 2022-12-03 18:24:03 -06:00
Ayaz
b5a195eaf0
Merge pull request #4650 from roc-lang/detect-reachable-by-recursion-only
Provide warning for defs that are used only in (mutual) recursion
2022-12-02 13:39:52 -06:00
Ayaz Hafiz
5cfbc49ebf
Remove needless hole translation 2022-12-02 12:21:44 -06:00
Ayaz Hafiz
52c858dc53
Remove aliases in partial procs
This is no longer needed
2022-12-02 12:19:13 -06:00
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
Ayaz Hafiz
42e8e409d4
Address lint 2022-12-01 15:59:01 -06:00
Ayaz Hafiz
9181ed8092
Correctly compile rvalue closures defined in nested defines to lvalues
Previously, a program like

```
main =
  f =
    n = 1
    \{} -[#lam]-> n  # suppose lambda set = #lam
  f {}
```

would be transformed to

```
main =
  n = 1
  f = \{} -[#lam]-> n
  f {}
```

However, the IR lowering procedure is such that we would then associate
`f` as definining the procedure given the lambda set `#lam`. This is not
correct, as `f` is really a function pointer in this circumstance,
rather than the definer of `#lam`.

Instead, the transformation we want to perform is

```
main =
  n = 1
  #lam = \{} -[#lam]-> n
  f = #lam
  f {}
```

Which is what this patch does

Closes #2403
2022-12-01 15:47:18 -06:00
Ayaz Hafiz
68e364d897
Do not attempt to handle aliasing of procs in variable assignments
Please see the comment in the diff to explain the rationale of this
change.

Closes #4636
2022-12-01 15:20:58 -06:00
Ayaz Hafiz
2dfe0276e4
Make sure to assign and update program holes correctly when specializing symbols
Previously this was a bit hacky, we worked around having to update
symbol substitutions by special-casing the rest of the program. There's
not need to do that.
2022-12-01 14:57:01 -06:00
Richard Feldman
58fad36f9d
Merge pull request #4460 from roc-lang/crash
Crash
2022-11-25 17:18:21 -05:00
Folkert
07b7a93b9f
fix not being able to dbg variable 2022-11-25 17:55:01 +01:00
Ayaz Hafiz
cb7de132e5
Update mono 2022-11-24 14:46:54 -06:00
Ayaz Hafiz
803d7e30e3
Eliminate Stmt::RuntimeError in favor of crash 2022-11-24 14:46:53 -06:00
Ayaz Hafiz
a2f2a18a76
Replace runtime error with crash 2022-11-24 14:46:53 -06:00
Ayaz Hafiz
7668d7d592
Not everything is equal, but this is I suppose 2022-11-24 14:46:53 -06:00
Ayaz Hafiz
d9a8cba821
Correct symbol capturing of crash 2022-11-24 14:46:51 -06:00
Ayaz Hafiz
c7ef1668d4
Implement mono of crash 2022-11-24 14:46:51 -06:00
Ayaz Hafiz
e2b30e5301
Constrain + solve crash 2022-11-24 14:46:50 -06:00
Ayaz Hafiz
9dc489c2b0
First pass constraining crash 2022-11-24 14:46:49 -06:00
Folkert
e44a8a9eed
print all the relevant info 2022-11-23 22:58:58 +01:00
Folkert
e7f3c6f281
inline dbg 2022-11-23 21:23:28 +01:00
Richard Feldman
58e672749c
Fix glue getter name synchronization 2022-11-16 17:06:21 -05:00
Ayaz Hafiz
af81ceae38
Add method to grab default compilation width of a number 2022-11-16 13:54:48 -06:00
Folkert
c9d1401738
generate correct glue mono IR procs for tag unions 2022-11-16 20:28:26 +01:00
Richard Feldman
53ab17d0e9
contains_functions -> has_varying_stack_size 2022-11-16 13:55:06 -05:00
Richard Feldman
70c949c50b
Handle field layouts for more than just structs 2022-11-16 11:22:00 -05:00
Richard Feldman
b44f76f500
Use from_iter_in 2022-11-16 11:21:50 -05:00
Richard Feldman
d3d21630e8
Merge remote-tracking branch 'origin/main' into glue-getters-rtfeldman 2022-11-15 12:16:19 -05:00
Richard Feldman
8e2bbee377
Simplify how glue_procs are handled 2022-11-13 23:10:23 -05:00
Richard Feldman
d35d268a6b
Move layout_contains_function to a method on Layout 2022-11-13 18:14:33 -05:00
Richard Feldman
f24275c28f
Make generate_glue_procs take a trait 2022-11-13 18:13:50 -05:00
Folkert
662bf1de99
more workspace dependencies 2022-11-13 16:10:02 +01:00
Richard Feldman
56f33c4e1c
Make is_recursive_tag_union a method on Layout 2022-11-12 20:57:04 -05:00
Richard Feldman
99420f65ed
Merge branch 'glue-exposed' into glue-getters 2022-11-11 17:02:27 -05:00
Anton-4
f20577d9fb
format 2022-11-09 20:48:18 +01:00
Anton-4
38ea090c3e
rust 1.64 + clippy 2022-11-09 19:35:09 +01:00
Folkert
14cd48fce7
Merge remote-tracking branch 'origin/main' into rust-1-62-1 2022-11-09 13:51:51 +01:00
Ayaz Hafiz
28c3709ddf
Miscellaneous cleanup 2022-11-08 14:11:26 -06:00
Ayaz Hafiz
281bc94b55
Remove FlatType::Erroneous 2022-11-08 14:11:25 -06:00
Folkert
19a8b95c42
codegen getters 2022-11-06 14:56:51 +01:00
Folkert
5ae4ccad5e
refactor 2022-11-06 13:36:58 +01:00
Luke Boswell
2c2a70b8e7 Merge remote-tracking branch 'upstream/main' into rust-docs 2022-11-06 09:15:57 +11:00
Folkert
f291e85ccb
revert size change 2022-11-04 00:07:11 +01:00
Folkert
5c33369d6b
formatting 2022-11-03 23:48:39 +01:00
Folkert
134de80150
various updates 2022-11-03 17:18:27 +01:00
Folkert
66a1ba00eb
1.65 clippy fixes 2022-11-03 16:20:37 +01:00