Commit Graph

21906 Commits

Author SHA1 Message Date
Ayaz Hafiz
37c689841a
dev/test don't exit early for warnings 2022-12-02 14:11:58 -06:00
Ayaz Hafiz
c351be3230
Import in test reporting 2022-12-02 14:11:58 -06:00
Ayaz Hafiz
7e512077e7
Fix imports for repl 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
0a31f30e92
Merge pull request #4662 from roc-lang/mono-cleanup
Cleanup unneeded IR lowering code after #4648
2022-12-02 13:20:05 -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
1beb00f490
Merge pull request #4645 from roc-lang/i4606
Do not bind accessors in toplevel thunks to their thunks' names
2022-12-02 11:46:00 -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
Richard Feldman
0e74cc14cc
Merge pull request #4653 from roc-lang/fix-mv
Fallback to deep copy if `rename` fails when unpacking package tarball
2022-12-02 07:19:57 -05:00
Folkert de Vries
b67ffde678
Merge pull request #4657 from roc-lang/take_examples_fix
fix take examples
2022-12-02 12:46:26 +01:00
Folkert de Vries
0cb26bf50c
Merge pull request #4656 from roc-lang/wasm_interp_test_reorg
Wasm interp test reorg
2022-12-02 11:08:31 +01:00
Folkert de Vries
e1f7dfb3e6
Merge pull request #4649 from roc-lang/wasm_interp_imports
Wasm interp imports
2022-12-02 11:08:23 +01:00
Anton-4
2bf58a5bc3
fix take examples 2022-12-02 10:10:40 +01:00
Brian Carroll
c6e446da8d
wasm_interp: don't expose internal types 2022-12-02 08:02:27 +00:00
Brian Carroll
4714b4599a
wasm_interp: move test_utils into tests/mod.rs 2022-12-02 08:02:23 +00:00
Brian Carroll
ffd35f5884
wasm_interp: move tests inside the crate 2022-12-02 07:54:13 +00:00
Brian Carroll
42a15d07b3
wasm_interp: Just don't support non-function imports! I've never seen them anyway. 2022-12-02 07:47:49 +00:00
Brian Carroll
c38164ce8a
wasm_interp: cache import indices instead of signatures 2022-12-02 07:47:49 +00:00
Richard Feldman
2d8b8678d5
If renaming tmpdir for package fails, deep copy it 2022-12-01 22:39:40 -05:00
Richard Feldman
84eb82b815
Make fs_extra a workspace dependency 2022-12-01 22:33:04 -05: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
Brian Carroll
0cf2f4f9e4
clippy 2022-12-01 21:56:59 +00: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
Brian Carroll
04d493c49e
Merge branch 'main' of github.com:rtfeldman/roc into wasm_interp_imports 2022-12-01 21:33:31 +00:00
Brian Carroll
c0f840542a
wasm_interp: test import calls 2022-12-01 21:31:46 +00: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
Brian Carroll
c866ce6b09
wasm_interp: Handle calls to imports 2022-12-01 20:41:38 +00:00
Ayaz Hafiz
f49b0cd207
Update repl expect test to work around Dec copy bug 2022-12-01 13:26:08 -06:00
Ayaz
9f12de38c1
Merge pull request #4643 from roc-lang/i4622
Do not mark whether a module has specialization deps incrementally
2022-12-01 11:49:27 -06:00
Ayaz Hafiz
3d34e158e3
Merge branch 'i4594' of https://github.com/roc-lang/roc into i4594 2022-12-01 11:43:03 -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
a79e90af6c
Update lockfile 2022-12-01 10:14:03 -06:00
Ayaz Hafiz
d51db4c3ec
Bump wasm3 to avoid blacklist 2022-12-01 10:14:00 -06:00
Ayaz Hafiz
06d133c866
Update lockfile 2022-12-01 10:06:17 -06:00