Commit graph

287 commits

Author SHA1 Message Date
Folkert de Vries
6944c900c2
Merge pull request #2065 from rtfeldman/alias-remove-lowercases
Alias remove lowercases
2021-11-23 10:21:05 +01:00
hafiz
682043c16c
Merge pull request #2063 from rtfeldman/type-to-var-prealloc
preallocate variables to prevent extra vector allocations
2021-11-22 20:05:16 -06:00
Folkert
178eabf4dd make non-pub a function 2021-11-22 22:13:06 +01:00
Folkert
b2aa33f839 Merge remote-tracking branch 'origin/trunk' into alias-remove-lowercases 2021-11-22 21:19:27 +01:00
Folkert
2c1005fdf0 remove lowercases from Content 2021-11-22 21:15:58 +01:00
Folkert
e4ffe804ec remove lowercases from errortype alias 2021-11-22 20:26:50 +01:00
Folkert
2506875970 preallocate variables to prevent extra vector allocations 2021-11-22 20:17:03 +01:00
hafiz
b3ecc16b16
Merge pull request #2050 from rtfeldman/empty-tags-and-unions
Canonicalize to empty tags and unions
2021-11-22 08:00:07 -06:00
Folkert
69ad83a0d4 mark some Subs functions as alwaysinline 2021-11-21 23:49:51 +01:00
Folkert
8afdf282cb assert that no tag union or record with no fields/tags makes it into Subs 2021-11-21 22:25:03 +01:00
Folkert
3ab09322e0 don't copy variables that are the same in every subs 2021-11-20 02:15:26 +01:00
Folkert
594e754e1e manually track visited varibles in deep_copy_var_to 2021-11-20 01:39:57 +01:00
Folkert
d0abab1876 fix the updater; it did not really work?! 2021-11-20 01:24:17 +01:00
Folkert
497bc2db02 make instantiate_rigids_help use a loop/stack 2021-11-20 00:24:46 +01:00
Folkert
eb9bb12725 bumpalo type_to_var 2021-11-19 19:48:51 +01:00
Folkert
22fb31198a use bumpalo to reduce allocations in deep_copy_var_to 2021-11-19 19:21:26 +01:00
Folkert
2fe8537177 clean up deep_copy_var_help 2021-11-19 19:01:27 +01:00
Folkert
0f029f58c9 Merge remote-tracking branch 'origin/trunk' into storage-subs 2021-11-19 17:51:18 +01:00
Folkert
206c8889df Use StorageSubs for pending specializations 2021-11-19 13:22:17 +01:00
ayazhafiz
8b7217847d Rename additional stale roc_module::operator refs and format 2021-11-18 20:20:33 -05:00
ayazhafiz
8a60162a1e Rename roc_module::operator -> roc_module::called_via
A bit of a nit, but this file is now more general than just keeping
track of operator methods.
2021-11-18 20:20:33 -05:00
ayazhafiz
30955a1eb8 Take syntactic sugar into account when reporting errors
Previously, a program like

```roc
word = "word"

if True then 1 else "\(word) is a word"
```

would report an error like

```
── TYPE MISMATCH ───────────────────────────────────────────────────────────────

This `if` has an `else` branch with a different type from its `then` branch:

3│  if True then 1 else "\(word) is a word"
                        ^^^^^^^^^^^^^^^^^^

This concat all produces:

    Str

but the `then` branch has the type:

    Num a

I need all branches in an `if` to have the same type!
```

but this is a little bit confusing, since the user shouldn't have to
know (or care) that string interpolations are equivalent to
concatenations under the current implementation.

Indeed we should make this fully transparent. We now word the error
message by taking into account the way calls are made. To support the
case shown above, we introduce the `CalledVia::Sugar` variant to
represent the fact that some calls may be the result of desugaring the
surface syntax.

This commit also demonstrates the usage of `CalledVia` to produce better
error messages where we use binary comparison operators like `<`. There
are more improvements we can make here for all `CalledVia` variants, but
this is a good starting point to demonstrate the usage of the new
procedure.

Closes #1714
2021-11-18 20:20:33 -05:00
Folkert
9126169fcb StorageSubs 2021-11-18 23:02:47 +01:00
Folkert
e030cd3da5 optimize restore 2021-11-17 16:33:32 +01:00
Folkert
237d8d1c0b fix the Default instance for subs
we later rely on some variables always existing (numbers, empty record, empty tag union)
but the default instance did not insert those
2021-11-17 16:29:16 +01:00
Folkert
ede5967ced Merge remote-tracking branch 'origin/trunk' into deep-copy-var-to 2021-11-16 23:56:11 +01:00
Folkert
849510c42c WIP 2021-11-16 23:55:11 +01:00
Folkert
db081cd84b WIP 2021-11-15 20:12:48 +01:00
Folkert
2c0aac2a6a remove solved type hash instance 2021-11-14 22:20:06 +01:00
Brendan Hansknecht
d49ac68bcc Update dep with major version changes 2021-11-05 19:19:37 -07:00
Brendan Hansknecht
bddc08c977 Remove unused dependencies 2021-11-05 16:58:11 -07:00
Anton-4
a3fc724df3 removed unused maplit 2021-11-03 10:50:25 +01:00
Folkert
30e7f7b335 make solved type hash use an explicit stack (no recursion) 2021-10-29 21:24:40 +02:00
Folkert
55f8a7f3a4 implement print of FunctionOrTagUnion 2021-10-13 14:50:21 +02:00
Folkert
6a43be26d3 fix usize vs. u32/u64 conflict 2021-08-25 20:58:42 +02:00
Folkert
aa042f3357 better debug info for a mismatch 2021-08-20 22:41:43 +02:00
Richard Feldman
0bebb64bae
Merge branch 'trunk' into NumBytesTo 2021-08-19 01:37:39 -04:00
Folkert
6284a90785 a working version 2021-08-18 17:36:27 +02:00
Folkert
4e728c7222 add records to subs debug format 2021-08-18 14:48:30 +02:00
Joshua Hoeflich
1b04ad0535 Merge branch 'trunk' into NumBytesTo 2021-08-14 20:41:33 -05:00
Joshua Hoeflich
5115a004ed Type shenanigans work 2021-08-14 18:50:55 -05:00
Richard Feldman
bb7726b0e0
Merge branch 'trunk' into store-bool-closure-as-unit 2021-08-14 16:47:42 -04:00
Folkert
db877c7395 debug impl for the new Subs 2021-08-14 15:54:37 +02:00
Folkert
4cbb1c9b25 optimize initial tag union creation 2021-08-13 23:53:27 +02:00
Folkert
26da66d73f remove from_mutmap 2021-08-13 15:42:43 +02:00
Richard Feldman
0f42da7b7b
Merge pull request #1510 from rtfeldman/alias-nominal-equality
Alias nominal equality
2021-08-13 08:50:38 -04:00
Folkert
24ddc4b1e8 further optimizations 2021-08-13 13:25:36 +02:00
Folkert de Vries
3ac646f2a6
Merge branch 'trunk' into soa-alias 2021-08-13 13:13:42 +02:00
Folkert
df83bf0d48 Merge remote-tracking branch 'origin/soa-alias' into alias-nominal-equality 2021-08-13 12:11:36 +02:00
Folkert
c9040c012e make things work 2021-08-13 11:04:31 +02:00