Commit graph

175 commits

Author SHA1 Message Date
Ayaz Hafiz
e0bfe6c762
Make specialization symbols a two-layered VecMap 2022-05-06 11:58:02 -04:00
Ayaz Hafiz
674ec3beae
Verify layouts of extracted specialization symbols 2022-05-05 11:46:29 -04:00
Richard Feldman
85e7969c2d
Replace references to "global tag" with "tag" 2022-04-25 17:04:34 -04:00
Ayaz Hafiz
cf8409dfaa
Remove private tag variants 2022-04-25 11:38:54 -04:00
Derek Gustafson
ba6b225761
Hide RocDec implemntation details. 2022-03-07 15:34:02 -05:00
ayazhafiz
b9a29bdb16 Make exhaustive checking its own crate
Prepares for moving exhaustiveness checking to the closer typechecking
phase. Doing this one step at a time so that git preserves the rename.
2022-02-27 20:28:25 -05:00
ayazhafiz
4e27cdd21d Compile opaque patterns all the way, and add repl test 2022-02-27 00:11:10 -05:00
ayazhafiz
68d28349ed Exhaustiveness checking opaque patterns 2022-02-27 00:10:12 -05: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
ayazhafiz
097c5afc73 Check lower bounds for numeric literals, and permit 128-bit literals 2022-02-02 23:35:57 -05:00
Folkert
c4ec9aa898 working mono 2021-11-20 23:25:30 +01:00
Richard Feldman
28273b67da
Merge pull request #1970 from rtfeldman/shrink-call-type
Shrink call type
2021-11-15 19:56:21 -08:00
Folkert
d29265759b simplify edge counting 2021-11-14 19:49:02 +01:00
Folkert
cb55f66b5b pass slice instead of vector 2021-11-14 19:39:03 +01:00
Folkert
f8b4ce0317 shrink tag id sizes in layouts 2021-11-13 19:31:20 +01:00
Folkert
ada331567a respect int/float precision in pattern matchs 2021-09-18 22:55:34 +02:00
Richard Feldman
18231876be
Drop comment 2021-08-26 21:39:46 -04:00
Jared Ramirez
8594f2efbe Change how decimals are stored in mono 2021-08-26 11:18:26 -07:00
Jared Ramirez
d69b9173fc Also store f64 for things like pattern comparisons, etc 2021-08-18 17:18:13 -07:00
Folkert
e0648d348d new formatting 2021-07-30 17:13:50 +02:00
Folkert
899cbeabd7 fix extra ampersands 2021-07-29 17:32:08 +02:00
Folkert
da495244c5 remove layout field in decision_tree 2021-07-24 12:44:46 +02:00
Folkert
ed28b02b57 shift store_pattern over to decision_tree 2021-07-11 01:06:22 +02:00
Folkert
e32a06b088 assign guarded patterns at the last moment 2021-07-11 00:39:30 +02:00
Folkert
78309f2607 cleanup 2021-07-10 23:49:24 +02:00
Folkert
e05753afd8 working decision tree gen for all tests 2021-07-10 21:28:32 +02:00
Folkert
541a62b109 cleanup: we either have a guard or a test, not both 2021-07-10 14:01:18 +02:00
Folkert
a22d1e9e4c peal of guarded tests 2021-07-10 13:56:13 +02:00
Folkert
8755465ad6 hash tests as the same 2021-07-10 13:55:27 +02:00
Folkert
0fbf540d69 move Guard into the Branch 2021-07-07 21:21:50 +02:00
Folkert
60311fc7ce refactor: return option 2021-07-07 16:11:28 +02:00
Folkert
8bca6ebdfd make fewer things pub 2021-07-04 23:10:44 +02:00
Folkert
1126921a9e refactor 2021-07-04 23:05:04 +02:00
Folkert
b1a136bf2e clippy 2021-07-04 22:44:36 +02:00
Folkert
2c0aa8a5a1 handle guards in a first-class way 2021-07-04 22:35:00 +02:00
Folkert
8f0c13ecc1 remove old handling of guard 2021-07-04 21:19:39 +02:00
Folkert
e7c88cac98 refactor guards 2021-07-04 21:17:57 +02:00
Folkert
b99f710c49 refactor 2021-07-04 20:12:50 +02:00
Folkert
b2792af5f6 add helper function 2021-07-04 15:10:32 +02:00
Folkert
978cea4b8a passing tests 2021-06-28 22:28:47 +02:00
Folkert
1d1bcaea63 make ir use different tag id types 2021-06-28 20:16:39 +02:00
Folkert
99d0d9c732 WIP 2021-06-27 13:49:49 +02:00
Folkert
98b4930054 rename 2021-06-21 23:14:05 +02:00
Folkert
f3b23a6a54 get rid of Wrapped 2021-06-21 23:10:56 +02:00
Folkert
205b168f16 rename 2021-06-21 23:02:49 +02:00
Folkert
a94f597e1e single record update 2021-06-21 22:26:53 +02:00
Folkert
ee941c9f2e cleanup 2021-06-21 21:25:51 +02:00
Folkert
7a36c25848 simpify pattern match on non-indexable values 2021-06-21 21:24:46 +02:00
Folkert
cc93da006d emit less MultiTagUnion 2021-06-21 20:56:03 +02:00
Folkert
3a6ef8a53d use in decision_tree 2021-06-20 23:53:57 +02:00