Commit graph

506 commits

Author SHA1 Message Date
Folkert
19d7f7ce09
make vars-by-symbol a vector 2022-03-01 21:51:25 +01:00
Folkert
8b457a56c5
reduce cloning of Env 2022-03-01 00:08:56 +01:00
Folkert
9d82f795b7
make it abstract 2022-02-28 23:43:58 +01:00
Folkert
751ae125a5
remove aliases from solve Env 2022-02-28 23:41:07 +01:00
Folkert
c18befeccf
short-circuit aliases 2022-02-28 23:37:33 +01:00
ayazhafiz
e52d427ac8 Hash record field name order in generated layouts
Closes #2535

See the referenced issue for longer discussion - here's the synopsis.
Consider this program

```
app "test" provides [ nums ] to "./platform"

alpha = { a: 1, b: 2 }

nums : List U8
nums =
    [
        alpha.a,
        alpha.b,
    ]
```

Here's its IR:

```
procedure : `#UserApp.alpha` {I64, U8}
procedure = `#UserApp.alpha` ():
    let `#UserApp.5` : Builtin(Int(I64)) = 1i64;
    let `#UserApp.6` : Builtin(Int(U8)) = 2i64;
    let `#UserApp.4` : Struct([Builtin(Int(I64)), Builtin(Int(U8))]) = Struct {`#UserApp.5`, `#UserApp.6`};
    ret `#UserApp.4`;

procedure : `#UserApp.nums` List U8
procedure = `#UserApp.nums` ():
    let `#UserApp.7` : Struct([Builtin(Int(I64)), Builtin(Int(U8))]) = CallByName `#UserApp.alpha`;
    let `#UserApp.1` : Builtin(Int(U8)) = StructAtIndex 1 `#UserApp.7`;
    let `#UserApp.3` : Struct([Builtin(Int(I64)), Builtin(Int(U8))]) = CallByName `#UserApp.alpha`;
    let `#UserApp.2` : Builtin(Int(U8)) = StructAtIndex 1 `#UserApp.3`;
    let `#UserApp.0` : Builtin(List(Builtin(Int(U8)))) = Array [`#UserApp.1`, `#UserApp.2`];
    ret `#UserApp.0`;
```

What's happening is that we need to specialize `alpha` twice - once for the
type of a narrowed to a U8, another time for the type of b narrowed to a U8.

We do the specialization for alpha.b first - record fields are sorted by
layout, so we generate a record of type {i64, u8}. But then we go to
specialize alpha.a, but this has the same layout - {i64, u8} - so we reuse
the existing one! So (at least for records), we need to include record field
order associated with the sorted layout fields, so that we don't reuse
monomorphizations like this incorrectly!
2022-02-21 14:10:45 -05:00
Folkert
ae998e2504 Revert "DEBUG HACKS, DO NOT MERGE"
This reverts commit e95d32e821.
2022-02-16 15:08:10 +01:00
Folkert
95bfc3b342 cleanup 2022-02-16 15:01:43 +01:00
Folkert
ff26069295 use single-threaded stepper in multithreaded file.rs 2022-02-16 14:49:00 +01:00
Folkert
400598a013 cleanup 2022-02-16 14:35:07 +01:00
Folkert
599a0e5dc7 move things out of thread scope 2022-02-16 14:18:28 +01:00
Folkert
45217b8074 pick the single-threaded load when target-family=wasm 2022-02-16 14:18:14 +01:00
Brian Carroll
e95d32e821 DEBUG HACKS, DO NOT MERGE 2022-02-14 22:24:51 +00:00
Brian Carroll
3e511acbcc Fix Wasm compile errors 2022-02-14 21:10:45 +00:00
Folkert
e56a5695ba initial PoC 2022-02-14 21:50:09 +01:00
Folkert
04adbe75ca fix test compilation 2022-02-14 21:09:51 +01:00
Folkert
957140df64 remove builtin lookup function being passed around 2022-02-14 20:32:31 +01:00
Folkert
154d55985b move depencency tracking out of file.rs 2022-02-14 18:16:35 +01: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
a0ccae2865 repl: Create dumy Wasm implementations of SystemTime and Duration 2022-02-09 16:34:11 +00:00
Richard Feldman
dba03374db
Fix indentation in macro 2022-02-06 08:05:26 -05:00
Richard Feldman
7f5fc37612
Fix panic on parse error in Package-Config.roc
This previously led to the following panic if there was a parse error in Package-Config.roc: 'There were still outstanding Arc references to module_ids', /Users/rtfeldman/code/roc/compiler/load/src/file.rs:1530:33
2022-02-06 08:04:38 -05:00
Folkert
885500712c remove old Effect module things 2022-02-03 23:55:02 +01:00
Folkert
16a2b660c3 bookkeeping 2022-02-02 23:11:52 +01:00
Folkert
3829c629f1 thread hosted info through 2022-02-02 22:57:24 +01:00
Folkert
14c0caa275 generate the Effect type and after/map/etc methods in a hosted module 2022-02-02 16:49:56 +01:00
Folkert
1fb746757c pipe module name into canonicalization of modules 2022-02-02 16:01:31 +01:00
Folkert de Vries
00617ebf2a
Merge pull request #2418 from rtfeldman/i/1822
Error when platform package config cannot be found
2022-01-31 12:51:54 +01:00
ayazhafiz
2fa55269f1 Sate clippy 2022-01-30 21:42:41 -05:00
ayazhafiz
f28ca65ac5 Error when platform package config cannot be found
This avoid compiler hangs that occurred before

Closes #1822
2022-01-30 21:42:41 -05:00
Richard Feldman
484ce2fbc9
Parse hosted modules 2022-01-30 20:40:49 -05:00
Folkert
c663a35e16 final phase 2022-01-26 15:44:24 +01:00
Folkert
74932a4cab phase 2 2022-01-26 14:30:37 +01:00
Folkert
73bc50c952 make the surgical linker aware of custom exported closure names 2022-01-25 00:13:22 +01:00
Folkert
69bcec71eb mark provided types as exposed, so we don't get warnings they are unused 2022-01-23 18:44:50 +01:00
Folkert
6545968c34 import UserApp's provided types into the Package-Config module 2022-01-23 18:33:50 +01:00
Folkert de Vries
e1d990896a
Merge branch 'trunk' into mono-display 2022-01-14 13:55:52 +01:00
Joshua Warner
6e67b77fa1 Remove awkward split between header_sources and defs sources 2022-01-13 19:34:17 -08:00
ayazhafiz
8d372edda1 Add config variables for printing IR during mono stages 2022-01-13 16:33:26 -05:00
ayazhafiz
e655ab7d3b Module comments for reset-reuse
Figuring out what this module was doing, and why, took me a bit less
than half an hour. We should document what's happening for others in the
future so they don't need to follow up on Zulip necessarily.
2022-01-13 16:33:23 -05:00
Joshua Warner
f22f96843e Refactor ParseProblem
* Remove the `pos` field, which was always being assigned Position::default()
* Remove one use of this `pos`, by removing the never-used SyntaxError::ConditionFailed variant
* Adjust the other use to do what was probably intended - which is to say, pointing to the beginning of the def with the error
* Rename to FileError, reuse `SourceError` as an inner field, to avoid duplicating the `bytes`
2022-01-03 20:10:50 -08:00
Joshua Warner
8092f31a29 fmt 2022-01-01 18:20:05 -08:00
Joshua Warner
5c1084c453 Introduce SourceError to represent an error + original source 2022-01-01 18:20:05 -08:00
Joshua Warner
cb8cf44596 fmt 2022-01-01 18:20:05 -08:00
Joshua Warner
82d2be0635 Introduce LineColumnRegion and force conversion 2022-01-01 18:20:05 -08:00
Anton-4
f941e30b86 Merge branch 'trunk' of github.com:rtfeldman/roc into editor-comments 2022-01-01 11:10:54 +01:00
Joshua Warner
8b58d5cbc7 Switch to always encoding package names / paths as strings
This will simplify parsing and make it possible to have a uniform lexer for the language. Previously unquoted package names were allowed to include '-'s, which aren't valid identifiers.

In the future, we'll distinguish local paths from packages in the package-manager by looking for a ".roc" suffix, which should only be present in local paths.
2021-12-23 20:11:14 -08:00
Joshua Warner
f19220473a Rename Located -> Loc 2021-12-22 19:18:22 -08:00
Joshua Warner
49818343dd extract state 2021-12-16 17:13:53 -08:00
Joshua Warner
63056eeeac Remove spaces from header 'Info' structs 2021-12-14 19:53:23 -08:00