Commit graph

2570 commits

Author SHA1 Message Date
Richard Feldman
f20c7db029
Load all packages, not just the platform 2022-12-04 06:31:49 -05:00
Richard Feldman
0d2692f776
Use ..Default::default() 2022-12-04 06:31:49 -05:00
Richard Feldman
71478c297d
Fix some indentation 2022-12-04 06:26:45 -05:00
Richard Feldman
26f77ecffd
Add some more logging to file.rs 2022-12-04 06:26:44 -05:00
Richard Feldman
bee24fcd37
Add parse tests for package header 2022-12-04 06:26:44 -05:00
Richard Feldman
8a5ddaab2f
Drop imports from package header
That doesn't actually make sense!
2022-12-04 06:26:44 -05:00
Richard Feldman
da595a86b0
Parse package module header 2022-12-04 06:26:44 -05:00
Ayaz
c61c42bff7
Merge pull request #4661 from roc-lang/roc-test-dev
`test` has `dev` behavior, and `dev` does not exit if there are warnings
2022-12-03 12:26:00 -06:00
Ayaz
012810d7e8
Merge pull request #4664 from roc-lang/i2551
Ensure that llvm gen_ wrappers account different recursive pointers
2022-12-02 17:39:26 -06:00
Ayaz Hafiz
7562525e96
Bugfix match 2022-12-02 16:31:47 -06:00
Ayaz Hafiz
304b88cdb2
Fix bug in expect test 2022-12-02 16:20:56 -06:00
Ayaz Hafiz
705ce10085
New problem dropped 2022-12-02 14:14:18 -06:00
Ayaz Hafiz
8e2c2e1809
It's an error to expose values that aren't defined 2022-12-02 14:11:58 -06:00
Ayaz Hafiz
37c689841a
dev/test don't exit early for warnings 2022-12-02 14:11:58 -06:00
Ayaz Hafiz
39f89e3d65
Get severity from type problem variants 2022-12-02 14:11:58 -06:00
Ayaz Hafiz
5414b4b60f
Fix imports 2022-12-02 14:11:58 -06:00
Ayaz Hafiz
e438fbf37c
Enumerate severity on problem variants 2022-12-02 14:11:57 -06:00
Ayaz Hafiz
0a4ec1958b
roc test stops if there are type errors 2022-12-02 14:11:57 -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
3685ad2ed2
Ensure that llvm gen_ wrappers account different recursive pointers
Closes #2551
2022-12-02 13:38:32 -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
0f6f34983f
Remove stale comment 2022-12-02 11:50:12 -06:00
Ayaz Hafiz
947808bbb3
Checking if a connected component has a bridge needs to look at all edges
With a graph

A -> B

if we visit the order B, A to collect SCCs, we won't see that B has
pre-order edges until we look at A.
2022-12-02 11:50:12 -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
34328ddf0c
Unused import 2022-12-02 08:50:04 -06:00
Ayaz Hafiz
078f0147ee
Do not bind accessors in toplevel thunks to their thunks' names
In #3352 an optimization to transform `ra = .field` into

```
ra = \#rcd -[ra]-> #rcd.field
```

rather than

```
__ra1 = \#rcd -[__ra1] -> #rcd.field

ra = LambdaSet { __ra1 }
```

was introduced. However, this optimization is not correct when `ra =
.field` is defined as a toplevel thunk, for in such situations we
indeed want the thunk `ra` to return the lambda set it resolves to,
rather than repointing at itself.

Besides reverting this change, another option would be to convert
accessors into closures before translation of Can to IR. However, this
complicates the translation algorithm more than it already is, and I'd
like to avoid additional special-cases.

Closes #4606
2022-12-02 08:50:03 -06:00
Ayaz Hafiz
22a84c8b21
Add comment for is_function 2022-12-02 08:49:14 -06:00
Anton-4
2bf58a5bc3
fix take examples 2022-12-02 10:10:40 +01:00
Ayaz
0d80e741c2
Merge pull request #4648 from roc-lang/i4636 2022-12-01 18:36:43 -06:00
Ayaz
9b4552608f
Merge pull request #4644 from roc-lang/i4594
Unify ranged numbers with flex able, modulo obligation checking
2022-12-01 16:52:32 -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
Ayaz Hafiz
34236654af
Revert "Fix gen_compare::record test"
This reverts commit e8492f279e.
2022-12-01 11:42:27 -06:00
Ayaz Hafiz
3605008fce
Update tests to check eq unbound float is resolved to dec 2022-12-01 11:41:42 -06:00
Ayaz Hafiz
ed7d4f8f63
Obligation checking of floating point for Eq succeeds only with Dec 2022-12-01 11:31:41 -06:00
Ayaz Hafiz
e8492f279e
Fix gen_compare::record test
Unbound floating point numbers cannot be compared for Eq as of
obligation checking - this test is a correction to enforce that!
2022-12-01 11:12:50 -06:00
Ayaz Hafiz
590535a42b
Obligation checking Eq for floating point types may never succeed 2022-12-01 10:02:37 -06:00
Ayaz Hafiz
0bae0aafb6
Unify ranged numbers with flex able, modulo obligation checking
Closes #4594
2022-12-01 09:50:29 -06:00
Ayaz Hafiz
1ab41bf6b5
Do not mark whether a module has specialization deps incrementally
Whether a module has a dependency on another module for specialization
is already accounted for when the build graph was initially populated,
and should not be modified again.

Closes #4622
2022-12-01 09:08:53 -06:00
Richard Feldman
2a27d3c05f
Merge pull request #4642 from roc-lang/dbg-parsing-problem
stop parsing dbg as a value def
2022-12-01 06:55:23 -05:00
Richard Feldman
a0bc105ca8
Merge pull request #4616 from roc-lang/fix-pattern-equivalent
Fix missing cases in Pattern::equivalent
2022-11-30 12:10:09 -05:00
Richard Feldman
da158bca19
Merge pull request #4637 from roc-lang/check-link-exit-status
check the exit status of the link cmd
2022-11-30 12:09:14 -05:00
Folkert
b6622b71ec
stop parsing dbg as a value def 2022-11-30 14:18:48 +01:00
Anton-4
0b98609a22
check the exit status of the link cmd 2022-11-29 16:53:04 +01:00
Joshua Warner
2b91af02df
Introduce record! combinator
... and refactor header parser to fully use combinators, in support of future combinator-based superpowers
2022-11-28 20:25:55 -08:00
Joshua Warner
8de153efb9
Fix missing cases in Pattern::equivalent 2022-11-28 19:47:53 -08:00
Folkert
c9ba57f15a
fix merge conflict that made it to main 2022-11-29 00:20:03 +01:00