Commit graph

166 commits

Author SHA1 Message Date
Folkert
b92c28b237
make calls private 2022-04-20 17:43:18 +02:00
Folkert
ab8ac2edad
make bound_symbols private 2022-04-20 17:39:19 +02:00
Folkert
c531191e49
make value_lookups private 2022-04-20 17:34:08 +02:00
Folkert
e740bbe529
make some of References' fields private 2022-04-20 17:25:22 +02:00
Folkert
8b144c446d
remove PartialEq for a bunch of types that we should not compare 2022-04-20 16:58:30 +02:00
Folkert
b59d33a1d5
refactor roc_collections 2022-04-19 23:00:05 +02:00
Folkert
9f453a7ba2
use vecset for non_closures 2022-04-17 20:30:32 +02:00
Folkert
dda4f46e67
use VecSet in References 2022-04-17 19:37:10 +02:00
Ayaz Hafiz
15a040ec87
Basic type inference and solving for abilities
Note that is still pretty limited. We only permit opaque types to
implement abilities, abilities cannot have type arguments, and also no
other functions may depend on abilities
2022-04-12 16:18:07 -04:00
Richard Feldman
b777b88e1c
Drop unused arguments field from ZeroArgumentTag 2022-04-08 11:53:16 -04:00
Ayaz Hafiz
9fbc525d02
Make sure float suffixes are parsed out after can
Before we hit mono, we need to make sure the suffixes of numeric
literals are parsed out from the literal string, so that we don't try to
parse something whose type we already know but has the extraneous
suffix.

Co'ed with @tagraves
2022-04-05 11:32:34 -04:00
Richard Feldman
cce590dee5
Merge pull request #2761 from rtfeldman/simplify-unused-defs
Remove unneeded work in canonicalization
2022-03-23 10:10:05 -04:00
Folkert
f25afe4629
skip registering of debug symbols in hot loop 2022-03-22 18:51:56 +01:00
Folkert
7029717cd0
fix missing import 2022-03-21 23:46:25 +01:00
Folkert
725eb217d8
more vecs, less sets 2022-03-21 23:20:57 +01:00
Folkert
14b53c0ccf
simplify local_successors 2022-03-21 23:16:07 +01:00
Folkert
cee1a787c9
and remove everything because it has no effect 2022-03-21 23:07:27 +01:00
Folkert
1b1a7b0385
more cleaned up 2022-03-21 22:54:24 +01:00
Folkert
a170f461e0
cleanup 2022-03-21 22:44:14 +01:00
Folkert
cc9873eb6d
exploration 2022-03-21 22:41:32 +01:00
Folkert
ce4f47d2e9
remove clones in IntroducedVariables clone 2022-03-19 00:03:30 +01:00
Folkert
8bc31e82c3
try to keep type and value symbols separate 2022-03-13 16:50:32 +01:00
ayazhafiz
0692caf7ba Consolidate Accessor data 2022-03-06 11:07:31 -05:00
ayazhafiz
3bff99b0a2 Register accessor closures when they are bound
Previously we only registered record accessor closures in anonymous
contexts, where we assume they must already be specialized based on the
surrounding contexts. This is not true in general since one might bind
an accessor to a name.

Closes #2567
2022-03-06 10:53:12 -05:00
ayazhafiz
34900c1f55 Address @rtfeldman review 2022-02-27 00:11:11 -05:00
ayazhafiz
059c324268 Error reporting for type mismatches involving opaques 2022-02-27 00:10:12 -05:00
ayazhafiz
822e38d026 Fix opaque reporting tests 2022-02-27 00:10:12 -05:00
ayazhafiz
ccd4963e0f Fix clippy warnings 2022-02-27 00:10:12 -05:00
ayazhafiz
86aa0df661 Add constraint generation for opaque types 2022-02-27 00:10:11 -05:00
Brendan Hansknecht
f7c0e2ef19 Merge remote-tracking branch 'origin/trunk' into single-quote-literal 2022-02-24 10:13:39 -08:00
ayazhafiz
90de82e295 Validation of opaques during canonicalization 2022-02-21 18:25:19 -05:00
ayazhafiz
6b53692aac Canonicalize opaque types 2022-02-20 13:47:01 -05:00
ayazhafiz
6104a27b45 Parse opaque references 2022-02-19 21:30:42 -05:00
ayazhafiz
5e0d90ac53 First pass 2022-02-06 15:04:12 -05:00
ayazhafiz
097c5afc73 Check lower bounds for numeric literals, and permit 128-bit literals 2022-02-02 23:35:57 -05:00
ayazhafiz
e7dcc2daa5 Move NumWidth to roc_can 2022-02-02 00:23:43 -05:00
ayazhafiz
a6f7579c07 Parse and expand numeric bounds in canonicalization pass 2022-02-01 22:50:46 -05:00
ayazhafiz
e03592930f Typecheck numeric literals with suffixes in expressions
Part of #2350
2022-02-01 22:49:50 -05:00
ayazhafiz
320827167f Parse number literal width suffixes
Supports [u,i][8,16,32,64,128] and [nat,dec]

Part of #2350
2022-02-01 22:48:48 -05:00
Joshua Warner
70156b0a90 Simplify advancing 2022-01-01 18:20:05 -08:00
Joshua Warner
bd7b1e5013 Make Loc::new take Positions 2022-01-01 18:20:05 -08:00
Joshua Warner
4d7070ce3b Always combine line,column into Position 2021-12-22 20:32:46 -08:00
Joshua Warner
f19220473a Rename Located -> Loc 2021-12-22 19:18:22 -08:00
Chelsea Troy
b65a69f07e Appeasing the clippy 2021-12-01 18:56:15 -06:00
Chelsea Troy
f680ee3c24 Fix a spelling mistake; how was this ever passing? 2021-12-01 18:41:37 -06:00
Chelsea Troy
6cf755ad8d Resolve a bunnnch of merge conflicts 2021-11-29 23:14:29 -06:00
ayazhafiz
5bfc52cd3b Remove Sugar enum and inline single variant into CalledVia 2021-11-18 21:23:41 -05: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