Commit Graph

4034 Commits

Author SHA1 Message Date
Folkert
4b9e64fd7d
Merge branch 'expect-dbg-atomics' into expect-print-values 2022-12-08 23:43:11 +01:00
Folkert
13d0b75bc1
Merge remote-tracking branch 'origin/main' into expect-print-values 2022-12-08 23:42:03 +01:00
Folkert
95fe9cbccd
pass the pointer to shared memory around, instead of using a global 2022-12-08 23:22:26 +01:00
Richard Feldman
97332e4af1
Move ModuleNameEnum into HeaderType 2022-12-08 15:31:43 -05:00
Richard Feldman
e2137cc310
Use a pattern match over an inline let 2022-12-08 15:31:42 -05:00
Richard Feldman
e857a91b1b
Drop obsolete constant 2022-12-08 15:31:42 -05:00
Richard Feldman
8b463686bc
Propagate multiple entrypoints to alias analysis 2022-12-08 15:31:42 -05:00
Richard Feldman
236cebacc1
Refactor out PlatformHeaderInfo 2022-12-08 15:31:42 -05:00
Richard Feldman
2a38edf784
Inline send_header_two 2022-12-08 15:31:42 -05:00
Richard Feldman
87c8702c89
Rename HeaderFor to HeaderType 2022-12-08 15:31:42 -05:00
Richard Feldman
12a7b51eb4
Move some logic into HeaderFor 2022-12-08 15:31:42 -05:00
Richard Feldman
24f2fcc28a
Remove an unnecessary qualifier 2022-12-08 15:31:41 -05:00
Richard Feldman
8307a194e1
fix typo 2022-12-08 06:37:00 -05:00
Richard Feldman
5958f50728
Drop obsolete mentions of roc_send_signal 2022-12-08 06:36:12 -05:00
Folkert
c9adafa04b
remove internal use of roc_send_signal 2022-12-08 12:20:55 +01:00
Richard Feldman
5cfa6d8e12
Expand List.range docs 2022-12-08 05:56:53 -05:00
Richard Feldman
da5d0bd815
Merge pull request #4686 from roc-lang/list-range
Switch to more expressive list.range
2022-12-08 02:51:42 -05:00
Brendan Hansknecht
759130952d
fix glue generation for Dict and Set 2022-12-07 20:53:50 -08:00
Folkert
3bae4145d9
do expect/dbg with atomics 2022-12-08 00:41:20 +01:00
Ayaz Hafiz
b66813d2db
Check in test for #4705 2022-12-07 10:59:05 -06:00
Ayaz Hafiz
c5dd688e3e
Correct sorting of generated procs for mono test 2022-12-07 10:58:50 -06:00
Ayaz Hafiz
42fe19541e
Define inline expects defs in their definition order
When we transform a top-level expect into an inline expect, we collect
all intermediate defs before the expect condition, then layer the defs
back on. Because the layering procedure builds an expression bottom-up,
we must layer on defs in reverse definition order.

Closes #4705
2022-12-07 10:54:16 -06:00
Ayaz Hafiz
935255d06b
Support compiling programs with test mode in test_mono 2022-12-07 10:48:41 -06:00
Folkert de Vries
2ec473ba11
Merge pull request #4702 from roc-lang/wasm_interp_zig_tests
Wasm interp - more fixes
2022-12-07 00:32:33 +01:00
Ayaz
36eaed31e3
Merge pull request #4701 from roc-lang/i4697
Fix concat of non-unique list with unique list
2022-12-06 15:08:54 -06:00
Brian Carroll
2abae1b5e1
wasm_interp: Don't panic while pushing a stack frame 2022-12-06 20:31:50 +00:00
Brian Carroll
4cf5d19ace
wasm_interp: Fix bug where all arguments were being set as I32 2022-12-06 20:23:34 +00:00
Brian Carroll
1b126d3b58
wasm_interp: Don't panic when setting a local variable 2022-12-06 20:22:05 +00:00
Brian Carroll
9d912a6cc7
wasm_interp: don't panic when unwrapping Value 2022-12-06 20:19:25 +00:00
Folkert de Vries
4ab58dafbc
Merge pull request #4699 from roc-lang/wasm_interp_fixes
Wasm interp: WASI and stack trace
2022-12-06 21:12:15 +01:00
Ayaz Hafiz
dd364dbdfa
Add gen test for concat unique lists bug 2022-12-06 12:59:55 -06:00
Ayaz Hafiz
4df83d67ea
use copyBackwards when copying overlapping items in non-unique.unique concat
`mem.copy` requires that `dest` has start index `<= src`, but in our
case, `dest` has start index `>= src`. For this, `copyBackwards` should
be used.

See https://github.com/ziglang/zig/blob/master/lib/std/mem.zig#L195-L222.

Closes #4697
2022-12-06 12:58:04 -06:00
Brian Carroll
d49ae6701a
Merge branch 'main' of github.com:roc-lang/roc into wasm_interp_fixes 2022-12-06 18:57:56 +00:00
Ayaz Hafiz
a549176886
Add reproduction of failing unique concat bug 2022-12-06 12:57:32 -06:00
Brian Carroll
c7a75bf770
wasm_interp: comment to clarify the two CLI systems 2022-12-06 09:38:08 +00:00
Brian Carroll
df5baf4211
clippy 2022-12-06 09:02:59 +00:00
Brian Carroll
2dac57c2bb
wasm_interp: self-review fixes 2022-12-06 08:59:17 +00:00
Brian Carroll
dfbee7b916
wasm_interp: ensure WASI argv[0] is the .wasm executable 2022-12-06 08:59:17 +00:00
Brian Carroll
aa76634751
wasm_interp: implement WASI proc_exit 2022-12-06 08:59:17 +00:00
Brian Carroll
6820278672
wasm_interp: fix memory instructions (immediate arg for memory index) 2022-12-06 08:59:17 +00:00
Brian Carroll
b938e546b2
wasm_interp: In stack trace, last frame shouldn't show previous CALL address 2022-12-06 08:59:17 +00:00
Brian Carroll
0f5b7be945
wasm_interp: dump stack trace on unreachable instruction 2022-12-06 08:59:17 +00:00
Brian Carroll
513a346fe1
wasm_interp: end all function blocks on RETURN op 2022-12-06 08:59:08 +00:00
Brian Carroll
ad2973cd8d
wasm_interp: fix call_indirect immediates order 2022-12-06 08:59:08 +00:00
Brian Carroll
6d43763ab7
wasm_interp: dump a stack trace on error 2022-12-06 08:59:08 +00:00
Brian Carroll
5bdd1b5628
wasm_interp: use Result instead of panic. Focus debug info on *Wasm app*, not interp. 2022-12-06 08:59:08 +00:00
Folkert de Vries
c8a335cd0b
Merge pull request #4695 from roc-lang/mono-checker-updates
Add debug flag to check IR after specialization
2022-12-06 09:31:01 +01:00
Ayaz
8ae8857125
Merge pull request #4696 from roc-lang/hash-nat
add the ability to hash Nats
2022-12-05 20:15:21 -06:00
Brendan Hansknecht
b07e4e8170
fix mono 2022-12-05 16:11:10 -08:00
Brendan Hansknecht
6dd51039f0
add simple test that nat keys compile 2022-12-05 16:09:17 -08:00
Ayaz Hafiz
a2b506ab1b
Add debug flag to check IR after specialization 2022-12-05 18:05:35 -06:00
Brendan Hansknecht
6aec9cf058
add the ability to hash Nats 2022-12-05 16:00:56 -08:00
Ayaz
b6c9c7c145
Merge pull request #4689 from roc-lang/i4685
Spread list tests can never touch exact-sized bounds tests
2022-12-05 16:32:10 -06:00
Folkert de Vries
66ce640fe5
Merge pull request #4688 from roc-lang/i4671
Correct generalization of imported specializations
2022-12-05 23:22:58 +01:00
Brian Carroll
284dc6fa51
wasm_interp: support WASI argc/argv, and writing to stdout/stderr 2022-12-05 22:16:27 +00:00
Brian Carroll
736630b53f
wasm_interp: don't require -- before app arguments 2022-12-05 22:16:27 +00:00
Brian Carroll
0970595238
wasm_module: fix bug in DataSection::load_into (for roc_wasm_interp) 2022-12-05 22:16:27 +00:00
Brian Carroll
735085b8df
wasm_interp: add a description to Cargo.toml 2022-12-05 22:16:27 +00:00
Ayaz Hafiz
aab509c5c1
Make sure to escape formatting of char literals
Closes #4682
2022-12-05 14:09:28 -06:00
Ayaz Hafiz
759127660d
Spread list tests can never touch exact-sized bounds tests
When compiling a pattern match like

```
[] -> ..
[_] -> ..
[_, ..] -> ..
```

to a decision tree, we must make sure that the last test (len >= 1)
does not touch the branch reached by the second test (len == 1). It is
enough to ban (len >=) tests from ever touching exact-sized list
patterns, because a spread test (len >=) can never reach an exact-sized
test.

On the other hand, an exact-sized test can reach a spread pattern,
because in

```
[_, _] -> ..
[..] -> ..
```

the last branch generates tests for patterns `[]` and `[_]`, and we would
like those patterns to be covered by the spread test (len >= 0)!

Closes #4685
2022-12-05 13:45:35 -06:00
Ayaz Hafiz
b6a96ebb85
Reproduce miscompilation in #4685 2022-12-05 13:14:32 -06:00
Ayaz Hafiz
1cd7f8baf1
Fix test_derive 2022-12-05 13:10:29 -06:00
Ayaz Hafiz
836240f158
Clippy 2022-12-05 13:07:53 -06:00
Ayaz Hafiz
fe1cfe01b9
Allow too many arguments 2022-12-05 13:06:35 -06:00
Ayaz Hafiz
8ca9e6b443
Be more explicit about imported flex and rigid vars 2022-12-05 13:04:15 -06:00
Ayaz Hafiz
0bb31558e6
Disable gen and set tests on debug for now
Due to #3898
2022-12-05 12:50:24 -06:00
Ayaz Hafiz
8317c4d038
Add gen test for #4671 2022-12-05 12:08:55 -06:00
Ayaz Hafiz
09353733fa
Make sure to register imported variables when importing specializations
Closes #4671
2022-12-05 11:44:28 -06:00
Folkert
98560c63e6
fix bad merge 2022-12-05 12:54:57 +01:00
Brendan Hansknecht
415cac5179
update mono tests 2022-12-04 21:49:28 -08:00
Brendan Hansknecht
d81be27be0
update call to List.range in reporting test 2022-12-04 20:19:02 -08:00
Brendan Hansknecht
2ff8dad1c9
remove old List.range tests in favor of expect 2022-12-04 20:18:39 -08:00
Brendan Hansknecht
a5cb441d73
fix builtin formatting 2022-12-04 16:13:38 -08:00
Brendan Hansknecht
a5efc1f179
switch to more expressive list.range 2022-12-04 16:04:17 -08:00
Folkert
ae8b0b4a1b
use some custom types in cli_run to clarify code 2022-12-04 23:22:36 +01:00
Folkert de Vries
c1d3580b0f
Merge pull request #4674 from roc-lang/ircheck
Type-check mono IR
2022-12-04 20:56:54 +01:00
Ayaz Hafiz
d660016b53
Clippy 2022-12-03 23:43:47 -06:00
Ayaz Hafiz
e296d35bcd
Skip testing two mono tests for now 2022-12-03 22:43:19 -06:00
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
Brendan Hansknecht
8e710cb80e
disable wasm tests that are broken 2022-12-03 13:17:36 -08:00
Brendan Hansknecht
1dd0738eba
update mono test for dict again 2022-12-03 13:17:36 -08:00
Brendan Hansknecht
04bd5d6ab0
disable wasm dictionary small string test 2022-12-03 13:17:36 -08:00
Brendan Hansknecht
ab6c652360
manually do 128 bit multiplication to avoid bitshift and fix wasm tests 2022-12-03 13:17:36 -08:00
Brendan Hansknecht
436bfc41ed
disable glue test and update mono test 2022-12-03 13:17:36 -08:00
Brendan Hansknecht
ae58623f70
use crash to clearify unreachable state 2022-12-03 13:17:36 -08:00
Brendan Hansknecht
b4b18cda5a
fix formatting 2022-12-03 13:17:35 -08:00
Brendan Hansknecht
ac2380f6c8
swap based on dataIndex not raw hash map index 2022-12-03 13:17:35 -08:00
Brendan Hansknecht
8a30615a20
fix swap remove ordering 2022-12-03 13:17:35 -08:00
Ayaz Hafiz
24a136095c
Add Set.toList from empty test 2022-12-03 13:17:35 -08:00
Ayaz Hafiz
6adcaa2cbd
Extend ability symbol slice when merging in subs 2022-12-03 13:17:35 -08:00
Brendan Hansknecht
4befccc6b4
expand Set test cases 2022-12-03 13:17:35 -08:00
Brendan Hansknecht
cad7d8b4e9
add walkUntil and use it to implement set equality 2022-12-03 13:17:35 -08:00
Ayaz Hafiz
4159b83214
Fix imports 2022-12-03 13:17:35 -08:00
Ayaz Hafiz
2e56405c1e
Fix obligation checking for rigid able vars 2022-12-03 13:17:34 -08:00
Brendan Hansknecht
a321e36a36
update mono test for dict 2022-12-03 13:17:34 -08:00
Brendan Hansknecht
28835d5bf3
some bug fixes 2022-12-03 13:17:34 -08:00
Brendan Hansknecht
4fc0dd9dd9
add a some tests and bug fixes 2022-12-03 13:17:34 -08:00
Brendan Hansknecht
02824e92fe
add Set implementation 2022-12-03 13:17:34 -08:00
Brendan Hansknecht
cb08dca6f1
Add an indexmap like dict to roc 2022-12-03 13:17:34 -08: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
Folkert de Vries
24e4048cb5
Merge pull request #4660 from roc-lang/linux-stub-lib
Linux stub lib
2022-12-03 10:50:12 +01: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
Folkert
23274fbb8d
fix incorrect path used 2022-12-02 21:39:08 +01:00
Ayaz Hafiz
705ce10085
New problem dropped 2022-12-02 14:14:18 -06:00
Ayaz Hafiz
66419e8f29
The yeah yeah yeahs 2022-12-02 14:11:58 -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
845a2f8c75
Report warnings in roc test 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
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 Hafiz
3685ad2ed2
Ensure that llvm gen_ wrappers account different recursive pointers
Closes #2551
2022-12-02 13:38:32 -06:00
Folkert
7c6cc97cd4
Merge remote-tracking branch 'origin/main' into expect-print-values 2022-12-02 20:28:04 +01: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
Folkert
bc4473132d
ignore some cache files 2022-12-02 18:52:22 +01: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
Folkert
f55ca53088
move the test files to prevent race condition on platform 2022-12-02 15:43:49 +01:00
Folkert
fdd72c8ce3
add test for roc dev and roc test 2022-12-02 15:43:49 +01:00
Folkert
dba23c5889
be explicit about valgrind usage 2022-12-02 15:43:49 +01:00
Folkert
9bee0a6fa5
add test for inline expect 2022-12-02 15:43:48 +01:00
Folkert
1e41aac0f2
lookup symbols when coming from Defs 2022-12-02 15:43:48 +01:00
Folkert
db09d49cd7
implement two todo!'s 2022-12-02 15:43:48 +01:00
Folkert
ac1fce1a17
put in more section headers and make sure the .dynamic section is in the right segments 2022-12-02 15:19:15 +01:00
Folkert
2d8ba79034
turns out the symtab/strtab are important 2022-12-02 15:19:15 +01: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