Commit graph

6801 commits

Author SHA1 Message Date
Brendan Hansknecht
b76052c91e swap to using storage manager for some core functions 2022-02-16 23:33:26 -08:00
Brendan Hansknecht
835d3980d5 add float methods to storage manager 2022-02-16 23:13:56 -08:00
Brendan Hansknecht
0d70a4f9f8 add symbol storage into generic64 backend 2022-02-16 23:06:31 -08:00
Brendan Hansknecht
6e10e00534 add core stack methods 2022-02-16 22:56:27 -08:00
Brendan Hansknecht
9e51148628 Add assembler and pass buffer through functions 2022-02-16 22:25:43 -08:00
Brendan Hansknecht
6025880e73 Move references out of storage and into own map 2022-02-16 22:17:02 -08:00
Brendan Hansknecht
1926c3e198 Add base general reg helpers 2022-02-16 21:18:52 -08:00
Brendan Hansknecht
1153e0833b Make symbols store as RCs 2022-02-16 20:59:51 -08:00
Brendan Hansknecht
d1bcc8d55b start storage rewrite 2022-02-16 19:19:35 -08:00
hafiz
91483dbf55
Merge pull request #2471 from rtfeldman/fix_args_order
Swap arg order in `List` builtins to put the more-complex types first
2022-02-13 23:25:05 -05:00
ayazhafiz
886e4e07f6 Update alias analysis, implementation for List.mapWithIndex 2022-02-13 22:50:27 -05:00
Jan Van Bruggen
885bfcf817
Merge pull request #2488 from rtfeldman/i/2476
Specialize `Num.toFloat` for different target float types
2022-02-13 18:49:05 -07:00
ayazhafiz
6e5c1d5914 Specialize Num.toFloat for different target float types
Closes #2476
2022-02-13 20:20:25 -05:00
Jan Van Bruggen
f328ff5661
Remove leading newlines from code files 2022-02-13 14:55:34 -07:00
ayazhafiz
c831b99432 Add test for issue #1162
This was fixed some time ago; add a regression test.

Closes #1162
2022-02-13 14:02:39 -05:00
Richard Feldman
2136233b83
Merge pull request #2469 from rtfeldman/newtype-cycles-go-brrrr
Couple of fixes related to recursive type aliases (#2458)
2022-02-13 07:37:06 -05:00
ayazhafiz
ac680d0750 Aliases should not be public 2022-02-12 21:23:44 -05:00
ayazhafiz
67bb5b14f6 Examples as code block not doc 2022-02-12 21:08:23 -05:00
ayazhafiz
e946b972f7 Only recursive tag unions are relevant in illegal cycles 2022-02-12 20:41:19 -05:00
ayazhafiz
b8defcbc75 Use freshly-instantiated lambda variables 2022-02-12 20:03:39 -05:00
ayazhafiz
4dbdf3a58b Check that instantiated lambda set vars indeed only have vars 2022-02-12 11:32:32 -05:00
ayazhafiz
33148cb1a4 Functions are compound types 2022-02-12 10:54:57 -05:00
Richard Feldman
71f2444397
s/Int/Nat in a comment 2022-02-11 21:26:39 -05:00
Richard Feldman
e1cc4cbde6
Fix comment 2022-02-11 21:25:08 -05:00
Jan Van Bruggen
f47dbb5171
Swap List.mapWithIndex arg1 args order to put the element first 2022-02-11 16:10:29 -07:00
Jan Van Bruggen
92e0f8714f
Swap List.repeat args order to put the list first 2022-02-11 16:10:29 -07:00
ayazhafiz
55769caad6 Redundant clone 2022-02-11 08:52:37 -05:00
ayazhafiz
c71854d5a4 Remove opt_rec_var 2022-02-11 08:51:08 -05:00
ayazhafiz
8c0e39211d Instantiate recursive aliases to their smallest closures
Now, when we have two aliases like

```
T a : [ A, B (U a) ]
U a : [ C, D (T a) ]
```

during the first pass, we simply canonicalize them but add neither to
the scope. This means that `T` will not be instantiated in the
definition of `U`. Only in the second pass, during correction, do we
instantiate both aliases **independently**:

```
T a : [ A, B [ C, D (T a) ] ]
U a : [ C, D [ A, B (U a) ] ]
```

and now we can mark each recursive, individually:

```
T a : [ A, B [ C, D <rec1> ] ] as <rec1>
U a : [ C, D [ A, B <rec2> ] ] as <rec2>
```

This means that the surface types shown to users might be a bit larger,
but it has the benefit that everything needed to understand a layout of
a type in later passes is stored on the type directly, and we don't need
to keep alias mappings.

Since we sort by connected components, this should be complete.

Closes #2458
2022-02-11 08:43:33 -05:00
Jan Van Bruggen
fa466cd8d8
Fix a failing test
How did this pass CI testing?

Output from `cargo test --release`:
```
failures:

---- test_parse::comment_after_def stdout ----
The source code for this test did not successfully parse!

thread 'test_parse::comment_after_def' panicked at 'assertion failed: `(left == right)`

Diff < left / right > :
 [
<    |L 0-0, C 0-7| SpaceAfter(
>    @0-7 SpaceAfter(
         SpaceBefore(
             Body(
<                |L 0-0, C 0-3| Identifier(
>                @0-3 Identifier(
                     "foo",
                 ),
<                |L 0-0, C 6-7| Num(
>                @6-7 Num(
                     "1",
                 ),
             ),
             [],
         ),
         [
             LineComment(
                 " comment after",
             ),
         ],
     ),
 ]

', compiler/parse/tests/test_parse.rs:291:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    test_parse::comment_after_def

test result: FAILED. 164 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

error: test failed, to rerun pass '-p roc_parse --test test_parse'
```
2022-02-11 04:20:29 -07:00
ayazhafiz
c064c50036 Catch illegal alias cycles more strictly
Part of #2458
2022-02-10 22:12:33 -05:00
ayazhafiz
13552b11a6 Check self- and mutually-recursive aliases in the same pass 2022-02-10 08:15:48 -05:00
Anton-4
d6681f4e0a
Merge pull request #2160 from rtfeldman/editor-comments
support tld comments in docs and editor(reading only)
2022-02-10 11:49:10 +01:00
Brian Carroll
c61a18a200 Use custom macros for static assertions 2022-02-09 17:16:43 +00:00
Brian Carroll
d8b76b317b repl: replace [u8; 8] with u64 in static assertions 2022-02-09 16:34:11 +00:00
Brian Carroll
a0ccae2865 repl: Create dumy Wasm implementations of SystemTime and Duration 2022-02-09 16:34:11 +00:00
Brian Carroll
8e370a32b6 repl: update some static_asserts for 32-bit compiler build 2022-02-09 16:34:11 +00:00
Brian Carroll
858a3c3527 roc_load: Remove unused deadlock_detection feature of parking_lot crate, to enable Wasm REPL build 2022-02-08 11:03:48 +00:00
Brian Carroll
cff762afe5 Fix test_gen llvm 2022-02-08 11:03:48 +00:00
Brian Carroll
c21b2bd0da Formatting and Clippy 2022-02-08 11:03:48 +00:00
Brian Carroll
0af4361f2a repl: continue fleshing out the Wasm repl code. Generate wrapper function. 2022-02-08 11:03:48 +00:00
Brian Carroll
85b418ebdf wasm: get rid of Result from gen_wasm, rename a function, improve comments 2022-02-08 11:03:48 +00:00
Brian Carroll
2fd2a85887 wasm: delete redundant enum TestType 2022-02-08 11:03:48 +00:00
Brian Carroll
c5ccc99e20 repl: rename Wasm32TestResult -> Wasm32Result 2022-02-08 11:03:48 +00:00
Brian Carroll
1783fa8009 repl: rename FromWasm32Memory -> FromWasmerMemory 2022-02-08 11:03:48 +00:00
Brian Carroll
e9871947d3 repl: move wasm32_test_result to gen_wasm, and extract Wasm32Sized from FromWasm32Memory 2022-02-08 11:03:48 +00:00
Brian Carroll
aaa5fa04cd wasm: delete obsolete code 2022-02-08 11:03:48 +00:00
Folkert de Vries
ec1d2b5466
Merge pull request #2455 from rtfeldman/i/2413
Normalize c/Roc callconv parameters when C returns by pointer
2022-02-07 10:47:25 +01:00
ayazhafiz
1a1eaf7f68 Normalize c/Roc callconv parameters when C returns by pointer
Closes #2413
2022-02-06 21:57:14 -05:00
ayazhafiz
40196185a0 Specialize zero-argument thunks with the correct variable
Previously we would pass the annotation down as the
type-to-be-monomorphized for, but that would just mean the annotation
would unify with itself. We instead want to use the variable the thunk
is being used as to be the one unified with the thunk's annotation.

Closes #2445
Closes #2446
2022-02-06 20:58:13 -05:00