Folkert
cb8e9acb92
special-case the closure tags
2021-11-24 21:14:58 +01: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
a15183a7d1
refactor
2021-11-03 14:09:04 +01:00
Folkert
72194b87df
fix typo
2021-09-24 21:58:25 +02:00
Folkert
23e8f6c687
only introduce rigid once!
2021-09-24 21:53:41 +02:00
Jared Ramirez
d69b9173fc
Also store f64 for things like pattern comparisons, etc
2021-08-18 17:18:13 -07:00
Folkert
24ddc4b1e8
further optimizations
2021-08-13 13:25:36 +02:00
Folkert
899cbeabd7
fix extra ampersands
2021-07-29 17:32:08 +02:00
Folkert
ab7f4a70a1
remove list_var
2021-06-13 16:56:59 +02:00
Anton-4
314503cf7f
fixed typos, added typos checking to CI
2021-06-05 20:02:54 +02:00
Folkert
e81087f913
Merge remote-tracking branch 'origin/trunk' into specialize-lowlevel
2021-05-24 15:17:28 +02:00
tarjei
0ee15f15ee
Unify FunctionOrTagUnion with regular tags and functions
2021-05-23 23:14:17 +02:00
Eric Henry
d34f984169
Starting to add no arg tag union
2021-05-17 17:07:19 -04:00
Folkert
a055fa3626
fix record accessors
2021-05-14 13:07:35 +02:00
Folkert
694a896d54
fix closure size inference
2021-05-09 16:07:52 +02:00
Folkert
b01377f868
save the stack
2021-04-23 11:49:32 +02:00
Folkert
903583f1d4
implement basic type error reporting
2021-04-23 09:41:49 +02:00
Folkert
4dd0ee6543
constrain expect
2021-04-23 09:36:12 +02:00
Folkert
112e97c4a2
improve circular definition error reporting
2021-04-10 21:39:20 +02:00
Jared Ramirez
48f964adf4
Add percision variable in fp/integer eq constraints
2020-12-28 16:22:34 -06:00
Folkert
b669202d86
fix wildcards not recognized as rigids
2020-12-11 01:49:54 +01:00
Folkert
197abd8553
change constraints gen to give better errors
2020-11-15 02:06:34 +01:00
Folkert
23fe8e5c07
fix another nasty rigid problem
2020-11-15 00:23:32 +01:00
Folkert
ec3868ed7e
small rigid fix
2020-11-14 02:45:05 +01:00
Folkert
815b942f29
cleanup
2020-11-13 01:59:09 +01:00
Folkert
78e0886eb1
clippy
2020-11-13 01:42:31 +01:00
Folkert
bde82c3bb6
add Store constraint that does not report errors
2020-11-12 15:47:56 +01:00
Folkert
75d18eb8ba
no more rigid mistakes?
2020-11-12 15:31:25 +01:00
Folkert
7a719172bc
more rigid fixes?
2020-11-12 14:55:46 +01:00
Folkert
eaf94f2cfc
uncomment more of rbtree
2020-11-12 00:45:47 +01:00
Folkert
22592eff80
fix issue with rigids
2020-11-11 22:51:28 +01:00
Folkert
0ba612ecdb
refactor
2020-11-11 21:56:25 +01:00
Folkert
62a82d1135
extract untyped args helper
2020-11-11 21:46:12 +01:00
Folkert
d6e7e8381c
make it clearer the variables come from the def's pattern
2020-11-11 20:49:04 +01:00
Folkert
984cf744e3
make Storage store where it came from
2020-11-11 01:16:30 +01:00
Folkert
c64a6da745
make Storage store where it came from
2020-11-11 01:14:15 +01:00
Folkert
3aa6455795
fix problem with recursive definition constraint gen
2020-11-10 19:40:35 +01:00
Folkert
3cd132dd51
introduce foreign call
2020-11-05 23:35:56 +01:00
Folkert
b075c2d394
clean up imports
2020-10-31 15:36:46 +01:00
Folkert
8b3b677439
remove aliases from Let and LetCon
2020-10-31 15:27:24 +01:00
Folkert
9e981c264e
fix clippy issues
2020-10-30 22:28:55 +01:00
Folkert
58467d6515
get tests back up an running
2020-10-30 16:58:53 +01:00
Folkert
8a50d48ce2
expand aliases used in constraint gen
2020-10-29 22:31:14 +01:00
Folkert
4db09b10aa
refactor ClosureLayout
2020-10-21 13:38:46 +02:00
Folkert
3408a31453
preparations for specializing closures
2020-10-20 00:33:10 +02:00
Folkert
6d866ff58d
so defs get different treatment...
2020-10-19 15:44:32 +02:00
Folkert
607799b96e
steps towards closures and Effects
2020-10-17 20:53:57 +02:00
Folkert
edfc96628e
WIP
2020-10-17 14:53:57 +02:00
Folkert
70a53bd544
cleanup
2020-10-17 00:56:40 +02:00
Folkert
d931c8994a
fix most type inference issues
2020-10-16 20:50:42 +02:00