Commit Graph

4079 Commits

Author SHA1 Message Date
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 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
a42c7c00a6
Turn on roc dev test for env.roc again 2022-12-01 09:10:26 -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
Brian Carroll
b10ac827f1
wasm_interp: simplified ImportDispatcher
We don't really need a trait for the 'import module' concept.
2022-12-01 08:47:32 +00:00
Brian Carroll
ec8950816a
wasm_interp: expose both call_export_from_cli and call_export (for library usage) 2022-11-30 23:20:58 +00: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
Brian Carroll
7ddff49691
wasm_interp: possible design for imports, using enum dispatch 2022-11-30 07:25:38 +00:00
Joshua Warner
1e47de3c65
Merge pull request #4630 from roc-lang/more-parser-refactoring
Introduce `record!` combinator
2022-11-29 17:50:11 -08:00
Brendan Hansknecht
3d4dbd916a
Merge pull request #4632 from roc-lang/fix-stub-lib-path
fix stub lib path
2022-11-29 23:11:44 +00:00
Brian Carroll
d0b2f9c6e1
Merge pull request #4631 from roc-lang/wasm_interp_final_ops
Wasm interp final ops
2022-11-29 18:18:46 +00:00
Brendan Hansknecht
4329b08fae
fix stub lib path
platform-path is relative to the execution folder, not the input path
2022-11-29 10:03:27 -08:00
Folkert de Vries
24ddb1bf0a
Merge pull request #4628 from roc-lang/platform-cargo-test
Platform cargo test with elf
2022-11-29 18:23:48 +01:00
Anton-4
0b98609a22
check the exit status of the link cmd 2022-11-29 16:53:04 +01:00
Brian Carroll
378cad7748
clippy 2022-11-29 11:28:30 +00:00
Brian Carroll
d29ea7fedf
wasm_interp: last few instructions! 2022-11-29 08:59:37 +00:00
Brian Carroll
17810d5134
wasm_interp: float rounding ops 2022-11-29 08:43:56 +00:00
Brian Carroll
714586fac1
wasm_interp: f32 convert instructions 2022-11-29 08:06:18 +00:00
Brian Carroll
029f0d00c1
wasm_interp: truncate instructions 2022-11-29 08:06:18 +00:00
Brian Carroll
6ac46a150f
wasm_interp: fix tests for promote and demote ops 2022-11-29 08:05:46 +00:00
Folkert
a9bd01be87
simplify to only the required changes 2022-11-29 09:03:42 +01:00
Folkert
5a62eaa662
commit test version with elfcopy object example 2022-11-29 09:03:42 +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
Brian Carroll
afa57a027b
wasm_interp: implement some number conversion ops 2022-11-28 23:28:08 +00:00
Brian Carroll
94ca352ed7
wasm_interp: 'reinterpret' instructions 2022-11-28 23:28:08 +00:00
Brian Carroll
46737b4a41
wasm_interp: rename test_opcodes -> test_basics, and split out test_convert 2022-11-28 23:28:08 +00:00
Brian Carroll
f798f47edd
wasm_interp: move load and store tests to test_mem 2022-11-28 23:28:08 +00:00
Brian Carroll
a97aba7cec
wasm_interp: delete older duplicate test 2022-11-28 23:28:08 +00:00
Brian Carroll
1e114d6eef
wasm_interp: implement float neg and abs 2022-11-28 23:28:08 +00:00
Brian Carroll
284eeb5537
wasm_interp: Implement float ops that have int equivalents 2022-11-28 23:28:08 +00:00
Brian Carroll
fc10c520b1
wasm_interp: fix return type for i64 comparison ops 2022-11-28 23:28:08 +00:00
Brian Carroll
c2bf7d68fc
wasm_interp: rename ExecutionState -> Instance to match standard Wasm terminology 2022-11-28 23:28:08 +00:00
Folkert
c2a28df6d8
fix merge conflict that made it to main 2022-11-28 23:27:41 +00:00
Folkert
c9ba57f15a
fix merge conflict that made it to main 2022-11-29 00:20:03 +01:00
Brian Carroll
2aaa73460a
Merge branch 'main' of github.com:roc-lang/roc into wasm_interp_i32ops 2022-11-28 22:26:52 +00:00
Anton-4
f91523baa9
update tutorial, cleanup 2022-11-28 20:13:39 +01:00
Anton-4
963eb9f2c1
Merge pull request #4620 from roc-lang/metadata_fix
change matadata filename based on target
2022-11-28 19:19:40 +01:00
Brian Carroll
9ea2176db8
wasm_module, wasm_interp: fix SLEB-128 encoding for i64 2022-11-28 17:39:13 +00:00
Brian Carroll
0dc3441301
wasm_interp: even more copy-and-pasting 2022-11-28 17:35:51 +00:00
Brian Carroll
ea9b53aff3
wasm_interp: more copy-and-pasting of i64 from i32 2022-11-28 17:17:25 +00:00
Brian Carroll
31a4ad62a7
wasm_interp: implement modulo for rotr and rotl 2022-11-28 17:15:56 +00:00
Brian Carroll
3881296fb4
wasm_interp: Implement lots of i64 ops by copy-pasting from i32 2022-11-28 17:10:28 +00:00
Brian Carroll
56ddd1f29b
wasm_interp: Add a comment and tests for modulo in shift ops 2022-11-28 17:04:45 +00:00
Richard Feldman
c1a75a57f1
Merge pull request #4592 from roc-lang/collections_refactor
Refactor collection_trailing_sep_e
2022-11-28 11:14:30 -05:00
Ayaz
113c8cd7d7
Merge pull request #4613 from roc-lang/migrate_reporting_tests
Allow migrating reporting tests to failing parse tests
2022-11-28 09:59:01 -06:00
Anton-4
91266a03c6
change matadata filename based on target 2022-11-28 15:18:15 +01:00
Brian Carroll
b707f6fdff
wasm_interp: tests for i32 bitwise rotate ops 2022-11-28 09:01:25 +00:00
Brian Carroll
77f5635d89
wasm_interp: tests for shift right ops 2022-11-28 08:58:45 +00:00
Brian Carroll
2e0dd18b82
wasm_interp: make test_op_example generate a valid wasm file and dump it 2022-11-28 08:58:09 +00:00
Brian Carroll
6e8904baa8
wasm_module: fix parsing of negative i32's! 2022-11-28 08:25:32 +00:00
Brian Carroll
d5cc4b19f8
wasm_module: add a deb_hex! macro 2022-11-28 08:24:34 +00:00
Brian Carroll
5fc874057c
wasm_interp: tests for i32 ops 2022-11-27 23:00:22 +00:00
Brian Carroll
eeca876421
wasm_interp: create a test_utils module 2022-11-27 22:10:12 +00:00
Brian Carroll
e3df393a22
wasm_interp: use wrapping arithmetic 2022-11-27 22:07:31 +00:00
Brian Carroll
8e15d49720
wasm_interp: use Value::from in more places 2022-11-27 21:00:52 +00:00
Brian Carroll
78fbc75249
wasm_interp: neater creation of Value from unsigned integers 2022-11-27 20:53:12 +00:00
Brian Carroll
f7dcd8f421
wasm_interp: implement remaining i32 ops 2022-11-27 20:47:21 +00:00
Brian Carroll
ae2e561945
wasm_interp: implement select instruction 2022-11-27 20:39:28 +00:00
Brian Carroll
9e7a92574d
wasm_interp: don't give Signature the Clone trait just for a test! 2022-11-27 20:34:03 +00:00
Brian Carroll
8ff843261a
clippy 2022-11-27 19:40:09 +00:00
Brian Carroll
c2fb626c17
wasm_interp: implement indirect_call 2022-11-27 18:56:09 +00:00
Joshua Warner
a3071a8aea
Allow migrating reporting tests to failing parse tests 2022-11-26 17:34:50 -08:00
Richard Feldman
d949a918e4
Use false interpreter in type mismatch test 2022-11-26 19:04:35 -05:00
Richard Feldman
bb89344eaa
Merge pull request #4562 from roc-lang/https-packages
URL-based packages
2022-11-26 15:50:09 -05:00
Joshua Warner
451b2c0ded
Refactor collections 2022-11-26 09:55:54 -08:00
Brian Carroll
acb871abeb
wasm_interp: fix implicit return for calls inside blocks 2022-11-26 16:23:48 +00:00
Brian Carroll
82aa126353
gen_wasm: improve a code comment 2022-11-26 15:38:48 +00:00
Richard Feldman
32d9c6d875
Fix a comment 2022-11-26 09:08:24 -05:00
Richard Feldman
2409399ff3
Don't even compile https stuff in wasm! 2022-11-26 08:53:31 -05:00
Richard Feldman
b9074f0cfa
Avoid unused import warning on wasm tests 2022-11-26 08:47:21 -05:00
Richard Feldman
10e043c748
Fix an unused warning on wasm tests 2022-11-26 08:36:45 -05:00
Brian Carroll
df972a4567
wasm_interp: remove unnecessary and confusing ELSE check 2022-11-26 12:01:37 +00:00
Brian Carroll
0009e65d93
clippy 2022-11-26 11:01:12 +00:00
Brian Carroll
c7de45a316
Merge branch 'main' of github.com:roc-lang/roc into wasm_interp_blocks 2022-11-26 10:59:48 +00:00
Brian Carroll
3346ef9c9c
wasm_interp: Don't need to store block depth in CallStack any more 2022-11-26 10:58:16 +00:00
Brian Carroll
0bd1bced68
wasm_interp: implement loop 2022-11-26 10:47:16 +00:00
Brian Carroll
c55cedd279
wasm_interp: implement i32.lt_s 2022-11-26 10:12:47 +00:00
Brian Carroll
82e8c89045
wasm_interp: test for if/else 2022-11-26 09:36:49 +00:00
Brian Carroll
a09fd95fd7
wasm_interp: pass arguments from CLI 2022-11-26 09:10:35 +00:00
Brian Carroll
fa1e0a8614
wasm_interp: implement if/else statements 2022-11-26 07:33:17 +00:00
Richard Feldman
ca06a200e6
Use PathBuf::from over PathBuf::new 2022-11-25 21:27:00 -05:00
Brian Carroll
131a9925d0
wasm_interp: test br_table 2022-11-26 00:56:51 +00:00
Richard Feldman
b2beeb770e
Merge remote-tracking branch 'origin/main' into https-packages 2022-11-25 19:50:06 -05:00
Richard Feldman
0ecebe57b5
WASI doesn't have a home directory 2022-11-25 19:49:28 -05:00
Richard Feldman
791025d3ed
Merge pull request #4579 from roc-lang/underivable-rigid-better-error
Suggest binding type variables to an ability when they're unsatisfied
2022-11-25 19:46:11 -05:00
Brian Carroll
578b74ee77
wasm_interp: test for br_if 2022-11-26 00:43:49 +00:00
Brian Carroll
5035ad0a2b
wasm_interp: test br 2022-11-26 00:39:46 +00:00
Brian Carroll
d9fe907684
wasm_module: create const ValueType::VOID to use as block type 2022-11-26 00:38:41 +00:00
Ayaz Hafiz
8bb015bb0f
End the string 2022-11-25 16:43:09 -06:00
Ayaz
8c0ff4c839
Merge pull request #4558 from roc-lang/specialization-sets-for-impl-opaques
Support custom abilities for opaques with immaterial lambda sets
2022-11-25 16:42:32 -06:00
Ayaz
15e372373a
Merge branch 'main' into underivable-rigid-better-error
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2022-11-25 16:33:57 -06:00
Richard Feldman
58fad36f9d
Merge pull request #4460 from roc-lang/crash
Crash
2022-11-25 17:18:21 -05:00
Richard Feldman
4cf71020cf
Merge pull request #4604 from roc-lang/linker-print-path-on-error
print the path that the linker writes on error
2022-11-25 17:16:54 -05:00
Richard Feldman
e0030bac6c
Try to fix wasm URL-based downloads again 2022-11-25 16:54:10 -05:00
Richard Feldman
2eb9531817
Fix regression on printing "Rebuilding platform…" 2022-11-25 16:41:54 -05:00
Brian Carroll
b69be0e12d
wasm_interp: implement br_if and br_table 2022-11-25 21:41:35 +00:00
Richard Feldman
695bb7e353
Merge pull request #4603 from roc-lang/dbg-fixes
Dbg fixes
2022-11-25 15:10:22 -05:00
Brian Carroll
808dd85946
Merge pull request #4602 from roc-lang/wasm_interp_memory
Wasm interp memory
2022-11-25 20:04:04 +00:00
Brian Carroll
b96f1ffc33
wasm_interp: implement block and br 2022-11-25 19:42:10 +00:00
Brian Carroll
a593d19b2d
wasm_interp: use copy_from_slice instead of write_all 2022-11-25 19:41:19 +00:00
Folkert
f2ad4848db
print the path that the linker writes on error 2022-11-25 19:57:39 +01:00
Richard Feldman
84b8c69799
Merge pull request #4520 from roc-lang/str-docs
Str docs improvements
2022-11-25 13:06:11 -05:00
Folkert
bc3414e913
spelling 2022-11-25 18:30:04 +01:00
Brian Carroll
54305dd182
Merge branch 'main' of github.com:roc-lang/roc into wasm_interp_memory 2022-11-25 17:10:45 +00:00
Brian Carroll
5f5a535aaf
clippy 2022-11-25 16:56:25 +00:00
Folkert
165db8c885
make line and column numbers the same as editor (i.e. 1-based) 2022-11-25 17:55:27 +01:00
Folkert
07b7a93b9f
fix not being able to dbg variable 2022-11-25 17:55:01 +01:00
Brian Carroll
2bd67a3292
wasm_interp: tests for memory allocation instructions 2022-11-25 16:51:36 +00:00
Brian Carroll
06f3726e35
wasm_interp: tests for store instructions 2022-11-25 16:29:37 +00:00
Brian Carroll
65fc079393
clippy 2022-11-25 15:46:02 +00:00
Brian Carroll
e8f78a9618
wasm_interp: disable some debug code 2022-11-25 15:44:00 +00:00
Brian Carroll
e08b09538e
wasm_interp: implement memory size instructions 2022-11-25 15:41:11 +00:00
Brian Carroll
598e62275d
wasm_interp: implement store instructions 2022-11-25 15:41:11 +00:00
Brian Carroll
d9a8c6f64c
wasm_interp: Fix parse error hex formatting 2022-11-25 14:51:40 +00:00
Brian Carroll
73ede61cb1
wasm_interp: tests for load instructions 2022-11-25 14:50:55 +00:00
Brian Carroll
74e1bc412f
Merge pull request #4593 from roc-lang/wasm_interp_cli
Wasm interp CLI
2022-11-25 13:01:09 +00:00
Brian Carroll
c6bf34dd78
wasm_interp: Imeplement load instructions 2022-11-25 10:13:13 +00:00
Brian Carroll
85d5f3d109
wasm_interp: add a --hex CLI flag 2022-11-25 10:12:39 +00:00
Richard Feldman
39792bf144
Drop extraneous cwd.join
This actually caused a bug! To reproduce:

cargo run -- build --prebuilt-platform=false examples/cli/file.roc
2022-11-25 04:47:36 -05:00
Brian Carroll
96bff3e304
wasm_module: Create DataSection::load_into 2022-11-25 09:19:35 +00:00
Richard Feldman
a63f1378ef
Merge remote-tracking branch 'origin/main' into str-docs 2022-11-25 04:12:42 -05:00
Richard Feldman
bef59299a2
Merge remote-tracking branch 'origin/main' into https-packages 2022-11-25 04:07:37 -05:00
Richard Feldman
59e13d5bec
Don't try to import reqwest::blocking on wasm 2022-11-25 03:32:15 -05:00
Richard Feldman
6b805b721b
Merge pull request #4596 from roc-lang/dbg-color
Print `dbg` output in blue
2022-11-25 03:23:15 -05:00
Richard Feldman
f52ad5cbba
Merge pull request #4591 from roc-lang/tuple-accessor
Tuple accessors after tuples/records
2022-11-24 22:34:27 -05:00
Richard Feldman
5d4fa4eff1
clippy 2022-11-24 21:34:02 -05:00
Richard Feldman
08764787f5
Merge remote-tracking branch 'origin/main' into https-packages 2022-11-24 21:14:43 -05:00
Richard Feldman
253f903ae6
Drop openssl dependency 2022-11-24 21:14:26 -05:00
Richard Feldman
54da1b1e3b
Print a newline at the end of dbg output 2022-11-24 20:39:04 -05:00
Richard Feldman
c63baa2ede
Print dbg output in blue in terminal 2022-11-24 20:38:52 -05:00
Brian Carroll
a0fe01dd5f
wasm_interp: Use an Option instead of separate bool and String 2022-11-25 01:28:31 +00:00
Brian Carroll
77ebaba4ff
wasm_interp: include immediates in --debug output 2022-11-25 01:13:32 +00:00
Richard Feldman
40bf022e02
Merge pull request #4586 from roc-lang/wasm-debug-tips
gen_wasm: Add debugging tips to readme
2022-11-24 19:41:31 -05:00
Brian Carroll
dd93e2e46f
wasm_interp: Print out return value(s), if any 2022-11-25 00:14:44 +00:00
Brian Carroll
9d77c474d9
wasm_interp: Add --debug flag 2022-11-25 00:14:44 +00:00
Brian Carroll
3d756a8fff
wasm_interp: Fixes to get CLI mode working 2022-11-25 00:14:44 +00:00
Brian Carroll
9d437fe3fd
wasm_interp: report todo! panics with file offset of the missing instruction 2022-11-25 00:14:44 +00:00
Brian Carroll
f103801457
wasm_module: accept simpler modules with missing sections 2022-11-25 00:14:44 +00:00
Brian Carroll
60a671362f
wasm_interp: Create a CLI to run .wasm files 2022-11-25 00:14:44 +00:00
Brian Carroll
6d84c85078
wasm_interp: Fix PR feedback 2022-11-25 00:14:43 +00:00
Richard Feldman
7874db0b5f
Fix a cfg 2022-11-24 19:14:34 -05:00
Richard Feldman
99f55d6ed6
Merge remote-tracking branch 'origin/main' into https-packages 2022-11-24 19:14:31 -05:00
Joshua Warner
56470c838d
Implement tuple accessors after records/tuples 2022-11-24 15:32:39 -08:00
Richard Feldman
2050f0ac2f
Merge pull request #4582 from roc-lang/simplify-cli-platform
Drop Program and third type param from Task from CLI platform
2022-11-24 17:57:07 -05:00
Richard Feldman
917eb898fc
Merge pull request #4589 from roc-lang/fix-test
Fix test
2022-11-24 17:56:45 -05:00
Joshua Warner
a1432d1a14
Fix TypeAnnotation::Tuple comment 2022-11-24 14:29:50 -08:00
Ayaz Hafiz
7fdaf0f1bf
Make sure to ignore type errors in test 2022-11-24 14:58:35 -06:00
Ayaz Hafiz
41659ec394
Remove unneeded roc_panic extern in tests
We stub roc_panic to SJ/LJ-style exceptions in llvm tests, so this is
not needed.
2022-11-24 14:56:44 -06:00
Ayaz Hafiz
0cb41b7a07
Indent tests more 2022-11-24 14:55:11 -06:00
Ayaz Hafiz
cbdb535580
Remove unused macro 2022-11-24 14:54:51 -06:00
Ayaz Hafiz
ebc2b29199
Remove use of expect_runtime_error_panic 2022-11-24 14:54:11 -06:00
Ayaz Hafiz
e6cd64f161
Swap out expect_runtime_error_panic for assert_evals_to 2022-11-24 14:53:21 -06:00
Ayaz Hafiz
eef51c9d87
Correct crash refs 2022-11-24 14:50:39 -06:00
Ayaz Hafiz
26d8f0ce08
Fix kw list 2022-11-24 14:48:39 -06:00
Richard Feldman
47374609e3
Re-add dbg to KEYWORDS 2022-11-24 14:46:54 -06:00
Richard Feldman
7f8eae5a24
Give some tests more accurate names 2022-11-24 14:46:54 -06:00
Richard Feldman
de8da82ace
Fix a test that had a duplicate body with another 2022-11-24 14:46:54 -06:00
Ayaz Hafiz
cb7de132e5
Update mono 2022-11-24 14:46:54 -06:00
Ayaz Hafiz
f9de522004
Add crash fmt test 2022-11-24 14:46:54 -06:00
Ayaz Hafiz
ea386bf0af
Dont remove stmt_error 2022-11-24 14:46:54 -06:00
Ayaz Hafiz
ce5636d94f
Get rid of stmt_runtime_error in gen-wasm 2022-11-24 14:46:54 -06:00
Ayaz Hafiz
7e975b9111
Update mono tests 2022-11-24 14:46:53 -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
1922a144f2
bye ffi 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
f3a03ef6eb
Pass roc_panic msg by ref on 32 bit plats 2022-11-24 14:46:53 -06:00
Ayaz Hafiz
291615072b
Fix usages of panic 2022-11-24 14:46:53 -06:00
Ayaz Hafiz
12d013c062
Remove unneeded param 2022-11-24 14:46:53 -06:00
Ayaz Hafiz
36ff2e577b
Ignore test on wasm for now 2022-11-24 14:46:52 -06:00
Ayaz Hafiz
4202352b19
Update panic tags of builtins 2022-11-24 14:46:52 -06:00
Ayaz Hafiz
32400e37e1
Implement crash in gen-wasm 2022-11-24 14:46:52 -06:00
Ayaz Hafiz
a8122662c2
Return panic tag from roc_panic to test platform 2022-11-24 14:46:52 -06:00
Ayaz Hafiz
9201cf0b32
Add tests for user crash 2022-11-24 14:46:52 -06:00
Ayaz Hafiz
c8accc90e8
Implement user crash in llvm backend 2022-11-24 14:46:52 -06:00
Ayaz Hafiz
d9a8cba821
Correct symbol capturing of crash 2022-11-24 14:46:51 -06:00
Ayaz Hafiz
220c8a8e64
Add a crash test to mono 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
72ff0cc800
rename default panic tag to roc panic tag 2022-11-24 14:46:51 -06:00
Ayaz Hafiz
6d851ec5e2
men i trust, lints i dont need 2022-11-24 14:46:51 -06:00
Ayaz Hafiz
d33985db92
RocStr roc_panic for wasm gen 2022-11-24 14:46:51 -06:00
Ayaz Hafiz
2b49aee3d2
Pull out string literal creation 2022-11-24 14:46:51 -06:00
Ayaz Hafiz
d7db10d7b5
Check in panic_utils.zig 2022-11-24 14:46:50 -06:00
Ayaz Hafiz
4709f9a0de
roc_panic is passed a RocStr 2022-11-24 14:46:50 -06:00
Ayaz Hafiz
a9f8c2ddec
Factor out build_string_literal 2022-11-24 14:46:50 -06:00
Ayaz Hafiz
f29b85e244
Update builtins to use RocStr as panic type 2022-11-24 14:46:50 -06:00
Ayaz Hafiz
25693f8ffe
Fix constraining 2022-11-24 14:46:50 -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
Ayaz Hafiz
ee5eacc3e4
Support crash in derive tests 2022-11-24 14:46:49 -06:00
Ayaz Hafiz
dd05d813a9
Canonicalize crash 2022-11-24 14:46:49 -06:00
Ayaz Hafiz
1011ce9fba
Format crash 2022-11-24 14:46:49 -06:00
Ayaz Hafiz
fee01166c7
Add crash as a keyword 2022-11-24 14:46:49 -06:00
Ayaz
848c18f996
Merge pull request #4567 from joshuawarner32/tuple-type-annotation
Implement tuple type parsing
2022-11-24 14:42:11 -06:00
Richard Feldman
d1c14df067
Merge branch 'fix-test' into https-packages 2022-11-24 15:39:43 -05:00
Richard Feldman
1a1bc3a7cf
Merge branch 'fix-test' into simplify-cli-platform 2022-11-24 15:39:31 -05:00
Richard Feldman
c8723ccedd
Give some tests more accurate names 2022-11-24 15:36:49 -05:00
Richard Feldman
2cdb4fa10c
Fix a test that had a duplicate body with another 2022-11-24 15:35:42 -05:00
Richard Feldman
8db6cde08d
Fix some test helpers 2022-11-24 15:31:11 -05:00
Brian Carroll
e9ee62b2c2
Merge pull request #4581 from roc-lang/wasm_interp_part2
Wasm interp function calls
2022-11-24 18:45:12 +00:00
Richard Feldman
b9b03d432a
Merge remote-tracking branch 'origin/main' into https-packages 2022-11-24 13:14:36 -05:00
Richard Feldman
ac2d50aea9
Merge pull request #4542 from roc-lang/precompiled-legacy
Precompiled legacy linking
2022-11-24 13:13:48 -05:00
Brian Carroll
4c6f868e24
wasm_interp: refactor a test for readability 2022-11-24 16:55:22 +00:00
Richard Feldman
ed0c64ca7c
Fix reporting tests 2022-11-24 11:54:51 -05:00
Brian Carroll
f10262a41d
clippy 2022-11-24 16:43:43 +00:00
Brian Carroll
6523b38847
wasm_interp: implement calls with arguments 2022-11-24 16:43:31 +00:00
Brian Carroll
3aeab0dbd7
wasm_interp: initial version of ExecutionState::for_module 2022-11-24 16:43:31 +00:00
Brian Carroll
235c238e36
Move Value from wasm_interp to wasm_module & create GlobalSection::initial_values 2022-11-24 16:43:31 +00:00
Brian Carroll
0a2f2739b2
wasm_interp: implement function call (no arguments yet!) 2022-11-24 16:43:31 +00:00
Brian Carroll
972d9dbb19
wasm_interp: implement call and return instructions 2022-11-24 16:43:31 +00:00
Brian Carroll
57aa3aafd8
wasm_interp: test helper for default ExecutionState 2022-11-24 16:43:31 +00:00
Brian Carroll
335497c99f
wasm_interp: implement globals 2022-11-24 16:43:31 +00:00
Brian Carroll
ff63831fd1
wasm_interp: implement local.get, local.set, and local.tee 2022-11-24 16:43:31 +00:00
Brian Carroll
b17996f6f7
gen_wasm: Add debugging tips to readme 2022-11-24 16:39:16 +00:00
Joshua Warner
c6b5273144
Implement tuple type parsing
Also change some tests with newly relaxed indentation requirements, and remove an irrelevant test (since unindented close parens are now perfectly valid, the test is no longer useful).
2022-11-24 07:36:59 -08:00
Joshua Warner
a6a90178ce
Refactor record_type to use combinators 2022-11-24 07:36:44 -08:00
Ayaz Hafiz
2ed2d88881
Do not run occurs checks when printing type variables
This is a hack. Let's find and correct these problems earlier in the
compiler.
2022-11-24 10:05:28 -05:00
Ayaz Hafiz
be047f4b4a
Debug Work 2022-11-24 10:05:28 -05:00
Ayaz Hafiz
b4216a26a5
Force occurs check for introduced types after checking annotated bodies
The current type inference scheme is such that we first introduce the
types for annotation functions, then check their bodies without
additional re-generalization. As part of generalization, we also perform
occurs checks to fix-up recursive tag unions.

However, type annotations can contain type inference variables that are
neither part of the generalization scheme, nor are re-generalized later
on, and in fact end up forming a closure of a recursive type. If we do
not catch and break such closures into recursive types, things go bad
soon after in later stages of the compiler.

To deal with this, re-introduce the values of recursive values after we
check their definitions, forcing an occurs check. This introduction is
benign because we already generalized appropriate type variables anyway.
Though, the introduction is somewhat unnecessary, and I have ideas on
how to make all of this simpler and more performant. That will come in
the future.
2022-11-24 10:05:28 -05:00
Richard Feldman
4958647663
Fix a missing to_str() on Windows 2022-11-24 10:05:28 -05:00
Richard Feldman
96d3ab99e5
Fix a regression in a macOS workaround 2022-11-24 10:05:28 -05:00
Richard Feldman
f1021ffd45
Fix a missing .to_str() 2022-11-24 10:05:28 -05:00
Richard Feldman
a38532ea4b
Update error message 2022-11-24 10:05:27 -05:00
Richard Feldman
69a7c3ea15
Centralize host tempfile builder logic 2022-11-24 10:05:27 -05:00
Richard Feldman
4b64f8c9e9
Make sure tempfiles don't get dropped too early 2022-11-24 10:05:27 -05:00
Richard Feldman
8ce3069a74
Avoid an unused variable warning 2022-11-24 10:05:27 -05:00
Richard Feldman
30d72d0bc7
Give tempfiles the file extensions Zig expects 2022-11-24 10:05:27 -05:00
Richard Feldman
806e3e2ac7
Missed a couple of .to_str().unwrap()s 2022-11-24 10:05:27 -05:00
Richard Feldman
3d6b383a4e
Only reference native host binaries (for now) 2022-11-24 10:05:26 -05:00
Richard Feldman
b7b5de76ed
Use tempfile::NamedTempFile in more places 2022-11-24 10:05:26 -05:00
Richard Feldman
4ae7b391d5
Drop obsolete .gitignore entries 2022-11-24 10:05:26 -05:00
Richard Feldman
1679c62a0a
Use include_bytes! so builtin hosts live in binary 2022-11-24 10:05:26 -05:00
Ayaz Hafiz
7865075f76
Mark mono test 2022-11-24 10:05:26 -05:00
Ayaz Hafiz
9dbc2224fb
Fix imports 2022-11-24 10:05:25 -05:00
Ayaz Hafiz
5efdecafc9
Constrain flex inference variables without re-generalization
When constraining a recursive function like

```
f : _ -> {}
f : \_ -> f {}
```

our first step is to solve the value type of `f` relative to its
annotation. We have to be careful that the inference variable in the
signature of `f` is not generalized until after the body of `f` is
solved. Otherwise, we end up admitting polymorphic recursion.
2022-11-24 10:05:25 -05:00
Ayaz Hafiz
f8d51473d8
Report builtins type errors during load building as appropriate 2022-11-24 10:05:25 -05:00
Brian Carroll
bcb423dae8
wasm_interp: remove unsafe code 2022-11-24 10:05:25 -05:00
Brian Carroll
f5976d57df
clippy + comments 2022-11-24 10:05:25 -05:00
Brian Carroll
219de53ccb
wasm_interp: Tests for ExecutionState 2022-11-24 10:05:24 -05:00
Brian Carroll
35275299e3
wasm_module: create WasmModule::new for testing 2022-11-24 10:05:24 -05:00
Brian Carroll
45556b95bd
wasm_interp: create execute module 2022-11-24 10:05:24 -05:00
Brian Carroll
ae4131d3ac
wasm_interp: tests for ValueStack 2022-11-24 10:05:24 -05:00
Brian Carroll
ee7e439602
wasm_interp: tests for call_stack 2022-11-24 10:05:24 -05:00
Brian Carroll
43af215417
wasm_interp: create call_stack module 2022-11-24 10:05:24 -05:00
Brian Carroll
fb13992ccd
wasm_interp: new crate, with a value_stack module 2022-11-24 10:05:23 -05:00
Brian Carroll
8ddc575600
Use workspace versioning for wasm_module Cargo.toml 2022-11-24 10:05:23 -05:00
Folkert
5cb47939e2
don't try to run dbg with roc run 2022-11-24 11:19:41 +01:00
Richard Feldman
85a5905ef7
Fix typos in comments 2022-11-24 04:40:42 -05:00
Richard Feldman
d00f421946
Fix test 2022-11-24 04:38:55 -05:00
Richard Feldman
f5cb2d73a1
Merge branch 'precompiled-legacy' into https-packages 2022-11-24 04:29:56 -05:00
Richard Feldman
c86e3f4677
Revert "Drop unused parameter"
This reverts commit d925e43465.
2022-11-24 04:20:17 -05:00
Richard Feldman
adddc1ff70
Fix dbg parse test 2022-11-24 03:31:19 -05:00
Richard Feldman
3ec21109d7
Fix race condition in copying preprocessedhost 2022-11-24 03:29:51 -05:00
Richard Feldman
8bbc3ad925
Drop Program and third type param from Task 2022-11-24 03:21:14 -05:00
Richard Feldman
28bccb792f
Merge remote-tracking branch 'origin/main' into precompiled-legacy 2022-11-24 02:20:50 -05:00
Richard Feldman
d925e43465
Drop unused parameter 2022-11-24 02:15:40 -05:00
Richard Feldman
e8f5c13cf9
Consider linking type in preprocessed_host_path 2022-11-24 02:14:46 -05:00
Richard Feldman
9627946144
Drop redundant file copy 2022-11-24 02:10:09 -05:00
Ayaz
3059fd31c9
Merge branch 'main' into specialization-sets-for-impl-opaques
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2022-11-23 17:12:04 -06:00
Ayaz Hafiz
7c3a0807c2
Suggest binding type variables to an ability when they're unsatisfied 2022-11-23 16:37:50 -06:00
Folkert
51c018b03c
fix compile error in tests 2022-11-23 23:24:53 +01:00
Folkert
1875176319
improve formatting 2022-11-23 23:16:37 +01: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
Folkert
dcb530d3af
Revert "toplevel debug"
This reverts commit 5ea8d96f3e.
2022-11-23 20:29:55 +01:00
Folkert
5ea8d96f3e
toplevel debug 2022-11-23 20:29:45 +01:00
Folkert de Vries
df7f57e4a3
Merge pull request #4563 from roc-lang/fix-recursion-checks-of-inferred-vars
Force occurs check for introduced types after checking annotated bodies
2022-11-23 13:02:50 +01:00
Folkert de Vries
099ab4938f
Merge pull request #4565 from roc-lang/more-standalone
Use include_bytes! so builtin hosts live in binary
2022-11-23 13:01:39 +01:00
Richard Feldman
e1959d0a84
Fix wasm host_input_path generation 2022-11-23 00:38:54 -05:00
Richard Feldman
04e3ac37f4
Fix wasm host_dest name generation 2022-11-23 00:06:43 -05:00
Richard Feldman
c0b065b51a
Fix a couple of preprocessed host bugs 2022-11-22 23:38:07 -05:00
Richard Feldman
d9f3e11634
Add wasm32 support to preprocessed_host_filename 2022-11-22 23:02:12 -05:00
Richard Feldman
bcf53e58fe
Fix a missing to_str() on Windows 2022-11-22 22:44:42 -05:00
Richard Feldman
928495072c
Add dbg to sort_can_defs 2022-11-22 21:37:39 -05:00
Richard Feldman
73a591743b
Add parser tests for dbg 2022-11-22 21:27:10 -05:00
Richard Feldman
dcb7ab97c2
Fix a regression in a macOS workaround 2022-11-22 21:12:40 -05:00
Richard Feldman
49f8768271
Parse and format dbg 2022-11-22 21:08:26 -05:00
Richard Feldman
4e50d3fe2e
Fix a missing .to_str() 2022-11-22 20:58:17 -05:00
Richard Feldman
18fdc54022
Update error message 2022-11-22 20:55:05 -05:00
Richard Feldman
a8b6fa051a
Centralize host tempfile builder logic 2022-11-22 20:52:44 -05:00
Richard Feldman
0b73ea69af
Make sure tempfiles don't get dropped too early 2022-11-22 20:22:08 -05:00
Richard Feldman
6b446fe592
Avoid an unused variable warning 2022-11-22 19:25:15 -05:00
Richard Feldman
9c1291d57d
Give tempfiles the file extensions Zig expects 2022-11-22 19:19:54 -05:00
Richard Feldman
16fd39c4f7
Missed a couple of .to_str().unwrap()s 2022-11-22 18:51:01 -05:00
Richard Feldman
2d83c95d23
Only reference native host binaries (for now) 2022-11-22 18:40:08 -05:00
Richard Feldman
4a601ffd4c
Use tempfile::NamedTempFile in more places 2022-11-22 18:40:06 -05:00
Richard Feldman
2d066469ee
Drop obsolete .gitignore entries 2022-11-22 18:00:51 -05:00
Richard Feldman
e97a5fe7f6
Use include_bytes! so builtin hosts live in binary 2022-11-22 17:57:32 -05:00
Richard Feldman
2dba97d6a2
Simplify legacy_host_filename_ext 2022-11-22 17:19:36 -05:00
Richard Feldman
87ad2cdf82
Fix linux surgical linker tests 2022-11-22 14:27:53 -05:00
Ayaz Hafiz
faa804d54d
Do not run occurs checks when printing type variables
This is a hack. Let's find and correct these problems earlier in the
compiler.
2022-11-22 13:04:32 -06:00
Ayaz Hafiz
c70b23ac9c
Debug Work 2022-11-22 13:04:27 -06:00
Ayaz Hafiz
dce4d6c4c7
Force occurs check for introduced types after checking annotated bodies
The current type inference scheme is such that we first introduce the
types for annotation functions, then check their bodies without
additional re-generalization. As part of generalization, we also perform
occurs checks to fix-up recursive tag unions.

However, type annotations can contain type inference variables that are
neither part of the generalization scheme, nor are re-generalized later
on, and in fact end up forming a closure of a recursive type. If we do
not catch and break such closures into recursive types, things go bad
soon after in later stages of the compiler.

To deal with this, re-introduce the values of recursive values after we
check their definitions, forcing an occurs check. This introduction is
benign because we already generalized appropriate type variables anyway.
Though, the introduction is somewhat unnecessary, and I have ideas on
how to make all of this simpler and more performant. That will come in
the future.
2022-11-22 12:58:51 -06:00
Ayaz Hafiz
40da261dfd
Mark mono test 2022-11-22 12:57:32 -06:00
Richard Feldman
c3fa64afbd
Add /packages to ~/.cache/roc over ROC_VERSION 2022-11-22 12:10:45 -05:00
Richard Feldman
207160e22c
Print downloading message when downloading package 2022-11-22 12:05:19 -05:00
Richard Feldman
822f059e6e
Always include ROC_VERSION in cache dir 2022-11-22 12:05:03 -05:00
Ayaz Hafiz
91ceebc065
Fix imports 2022-11-22 11:00:14 -06:00
Richard Feldman
f60ed0059a
Turns out this was used by the repl 2022-11-22 11:55:46 -05:00
Ayaz Hafiz
414a320358
Constrain flex inference variables without re-generalization
When constraining a recursive function like

```
f : _ -> {}
f : \_ -> f {}
```

our first step is to solve the value type of `f` relative to its
annotation. We have to be careful that the inference variable in the
signature of `f` is not generalized until after the body of `f` is
solved. Otherwise, we end up admitting polymorphic recursion.
2022-11-22 10:43:59 -06:00
Ayaz Hafiz
03e6d6d7e0
Report builtins type errors during load building as appropriate 2022-11-22 10:36:41 -06:00
Richard Feldman
7356809fc3
clippy 2022-11-22 10:59:17 -05:00
Richard Feldman
52b71cd85f
Using a HTTPS URL platform implies it's prebuilt 2022-11-22 10:45:22 -05:00
Richard Feldman
f39eaff217
Don't match on the same thing twice 2022-11-22 10:34:04 -05:00
Richard Feldman
b7726c87bb
Drop unused field 2022-11-22 08:49:31 -05:00
Richard Feldman
13caa0bc17
Fix doc comment 2022-11-22 08:38:59 -05:00
Richard Feldman
c7f9ecccf1
Fix compression inference 2022-11-22 08:38:02 -05:00
Richard Feldman
092d21a663
Properly resolve shorthands to HTTPS URL packages 2022-11-22 08:28:54 -05:00
Richard Feldman
d16b247523
Rename some variables 2022-11-22 07:20:35 -05:00
Brian Carroll
a90d9d465d
Merge pull request #4555 from roc-lang/wasm_interp
Wasm interp
2022-11-22 10:45:18 +00:00
Richard Feldman
7b7f64e6c0
Streaming downloading and hash verification works 2022-11-21 19:24:25 -05:00
Brian Carroll
92039547b6
wasm_interp: remove unsafe code 2022-11-22 00:09:38 +00:00
Ayaz Hafiz
e36618b9e9
Support custom abilities for opaques with immaterial lambda sets
If a specialization of an ability member has a lambda set that is not
reflected in the unspecialized lambda sets of the member's prototype
signature, then the specialization lambda set is deemed to be immaterial
to the specialization lambda set mapping, and we don't need to associate
it with a particular region from the prototype signature.

This can happen when an opaque contains functions that are some specific
than the generalized prototype signature; for example, when we are
defining a custom impl for an opaque with functions.

Addresses a bug found in 8c3158c3e0
2022-11-21 18:03:56 -06:00
Ayaz
ef5d83a42d
Merge pull request #4556 from roc-lang/fix-fixpoint-fixing
Correct when fixpoint-fixed type variables can be reunified
2022-11-21 17:44:06 -06:00
Brian Carroll
ce10199bb4
clippy + comments 2022-11-21 23:04:22 +00:00
Ayaz Hafiz
e1afd964c7
Correct when fixpoint-fixed type variables can be reunified
With fixpoint-fixing, we don't want to re-unify type variables that were
just fixed, because doing so may change their shapes in ways that we
explicitly just set them up not to be changed (as fixpoint-fixing
clobbers type variable contents).

However, this restriction need only apply when we re-unify two type
variables that were both involved in the same fixpoint-fixing cycle. If
we have a type variable T that was involved in fixpoint-fixing, and we
unify it with U that wasn't, we know that the $U \notin \bar{T}$, where
$\bar{T}$ is the recursive closure of T. In these cases, we do want to
permit the usual in-band unification of $T \sim U$.
2022-11-21 15:57:36 -06:00
Richard Feldman
ea8bb8820b
Switch from ureq to reqwest::blocking 2022-11-21 15:01:43 -05:00
Brian Carroll
3d7fb380a5
wasm_interp: Tests for ExecutionState 2022-11-21 19:54:48 +00:00
Brian Carroll
26cce05bbe
wasm_module: create WasmModule::new for testing 2022-11-21 19:54:48 +00:00
Brian Carroll
2ca74e5070
wasm_interp: create execute module 2022-11-21 19:54:48 +00:00
Brian Carroll
d038094a51
wasm_interp: tests for ValueStack 2022-11-21 19:54:48 +00:00
Brian Carroll
3b0a024a56
wasm_interp: tests for call_stack 2022-11-21 19:54:48 +00:00
Brian Carroll
08e9fb65a6
wasm_interp: create call_stack module 2022-11-21 19:54:48 +00:00
Brian Carroll
b0e89dd386
wasm_interp: new crate, with a value_stack module 2022-11-21 19:54:48 +00:00
Brian Carroll
2f709580cd
Use workspace versioning for wasm_module Cargo.toml 2022-11-21 19:54:48 +00:00
Brian Carroll
9353c25826
formatting 2022-11-21 19:51:21 +00:00
Brian Carroll
880ef2704c
Merge branch 'main' of github.com:rtfeldman/roc into wasm_module_crate 2022-11-21 19:49:00 +00:00
Brian Carroll
a35e912c0a
Fix wasm repl tests 2022-11-21 19:48:38 +00:00
Brian Carroll
a3cfdd478d
rename called_preload_fns to called_fns 2022-11-21 19:48:02 +00:00
Richard Feldman
52783558a5
If Content-Encoding is missing, try to infer it 2022-11-21 04:24:50 -05:00
Richard Feldman
06e8ca2bd1
Be explicit about certain Brotli encoder params 2022-11-21 03:59:53 -05:00
Richard Feldman
d0a1fa3d57
Bundle tarballs with compression after all 2022-11-21 03:57:05 -05:00
Anton-4
f32e329798
Merge pull request #4549 from roc-lang/editor_design_docs
improve/expand design docs for editor and plugins
2022-11-21 09:13:58 +01:00
Richard Feldman
a38380ec76
Remove references to obsolete .rp1 format 2022-11-21 02:58:18 -05:00