Commit graph

250 commits

Author SHA1 Message Date
Richard Feldman
204cee7d60
Clean up more unused Nat stuff 2024-01-26 16:23:21 -05:00
Richard Feldman
c4497f2c1c
Remove Nat from Num 2024-01-26 16:19:51 -05:00
Ayaz
aaba3f4d82
Merge branch 'main' into clippy-1.74 2023-12-02 20:09:06 -06:00
Brendan Hansknecht
c49046291a
misc cleanup suggestions 2023-11-28 16:40:43 -08:00
Brendan Hansknecht
82cda1965c
use INSPECT_INSPECT_ABILITY instead of INSPECT_INSPECT 2023-11-28 16:40:41 -08:00
Richard Feldman
443f6593c5
Add Inspect.Inspect to subs and auto-derive 2023-11-28 16:40:40 -08:00
Folkert
cf951ece59
use deref for clone 2023-11-18 22:48:11 +01:00
Folkert
49c2b1dbb7
redundant closure call 2023-11-18 22:46:40 +01:00
jecaro
c858031f74
Show the right fct name in type error messages 2023-11-16 16:44:55 +01:00
Folkert
94ca207772
formatting 2023-10-07 19:11:37 +02:00
Folkert
6ab54c02e2
drop into_iter in some places 2023-10-07 19:11:36 +02:00
Folkert
e6a154765c
silence some redundant closure call warnings caused by macros 2023-10-07 19:11:36 +02:00
Richard Feldman
dc7e8b43bd
Rename Float to Frac in more places 2023-09-11 08:50:13 -04:00
Richard Feldman
2da41be29f
Merge remote-tracking branch 'origin/main' into abilities-syntax 2023-08-10 20:36:01 -04:00
Folkert
5d3c7a9363
remove HostExposedAlias 2023-08-09 14:06:07 +02:00
Ayaz Hafiz
93513cffae
pub is_signed 2023-07-17 09:47:57 -05:00
Ayaz Hafiz
a21e016032
Make public 2023-07-17 09:47:57 -05:00
Ayaz Hafiz
879719b166
s/width/min_width 2023-07-17 09:47:57 -05:00
Ayaz Hafiz
535eb80dfb
Clippy 2023-07-12 14:43:25 -05:00
Ayaz Hafiz
6e5a308557
Content variant ErasedLambda 2023-07-12 13:57:17 -05:00
Ayaz Hafiz
16ebcba053
Use index 2023-07-12 13:53:51 -05:00
Ayaz Hafiz
1d6f0d3d3f
Instantiate erased lambdas 2023-07-12 13:53:51 -05:00
Folkert
ef39bad7c6
auto clippy fixes 2023-07-10 18:27:08 +02:00
Ayaz Hafiz
e27a06849d
Unwrap rec pointers when getting lambda set 2023-06-29 14:51:29 -05:00
Bryce Miller
cb08225bf0
| -> where 2023-06-05 20:19:00 -04:00
Bryce Miller
ffa622e065
Merge branch 'main' into abilities-syntax
Signed-off-by: Bryce Miller <sandprickle@users.noreply.github.com>
2023-05-29 13:42:36 +02:00
Bryce Miller
e514d0cb83
Define and use IMPLEMENTS const in roc_parse::keyword 2023-05-29 07:21:27 -04:00
Bryce Miller
d2503bb9f2
has -> implements 2023-05-26 22:59:29 -04:00
Bryce Miller
d3f6277ea3
has -> implements in comments 2023-05-26 22:59:11 -04:00
Bryce Miller
dbc0204532
abilities syntax has -> implements 2023-05-24 21:30:16 -04:00
Ayaz Hafiz
9f45c2ff47
Correctly copy non-generalized imports as non-generalized
Importing a rigid variable in a non-generalized context should not keep
the variable as rigid. That's because rigid variables are only necessary
for enforcing invariants during typechecking of a generalizable
definition, but at all use sites (which are not generalized), they are
demoted to possibly-unbound type variable.
2023-05-24 14:12:24 -05:00
Ayaz Hafiz
d3120e500e
Drop translations key 2023-05-24 14:06:39 -05:00
Richard Feldman
922a10db52
Merge pull request #5389 from agu-z/agu-z/record-builder-syntax
Record Builder Syntax
2023-05-13 22:47:03 -04:00
Agustin Zubiaga
71a2990e21 Tip replacing <- with : for static values 2023-05-09 23:37:24 -03:00
Folkert de Vries
ec21f19826
Merge pull request #5374 from GabrielDertoni/remove-needless-string-alloc
refactor: remove needless string allocation in pretty printer
2023-05-06 00:34:48 +02:00
Gabriel Dertoni
7d0027f428
refactor: remove needles string allocation in pretty printer
Many times, in order to create a `ven_pretty::Doc` containing a text
node, the pattern `alloc.text(format!(...))` would be used. This code
then creates a fresh string that is then used in the `Doc`. However,
many times only a small string is necessary and so the allocation could
be optimized. The `ven_pretty` crate supports this through a `SmallString`
type. Allocating a fresh string with `format!` also moves control away
from the `DocAllocator` which isn't ideal, since it could also handle
the string allocations. So, instead of creating a fresh string, one can
simply call `alloc.as_string(format_args!(...))` and delegate the
allocation to the `DocAllocator` without any loss in expressivity. So,
in order to encorage this pattern, this commit also introduces the
`text!` macro.

In order to find all instances of the code pattern, the following
tree-sitter query was used:

```scm
(call_expression
    function: (field_expression
        field: (field_identifier) @field.name
               (#eq? @field.name "text"))
    arguments: (arguments
        (macro_invocation
            macro: (identifier) @macro.name
            (#eq? @macro.name "format")))) @reference.call
```
2023-05-03 21:28:36 -03:00
Ayaz Hafiz
df3bd79d4a
Simplify occurs check for aliases 2023-05-02 17:00:58 -05:00
Ayaz Hafiz
8ca1e6c866
Correct occurs cycle under alias argument but not alias real var
At times we can have alias arguments that are recursive in their
position, but whose recursiveness is not immediately visible in the real
var.

Closes #5330
2023-05-02 17:00:58 -05:00
Ayaz Hafiz
d13e221678
Print variables if asked to 2023-05-02 13:08:58 -05:00
Ayaz Hafiz
5ec2715820
Correctly introduce new recursion variables at the correct rank 2023-05-01 13:14:59 -05:00
Ayaz Hafiz
7beee4e1f3
Add a way to print ranks in uitest 2023-05-01 13:14:59 -05:00
Folkert
4cd8f0a056 clippy --fix fixes 2023-04-21 12:05:51 +02:00
Ayaz Hafiz
d3ab9ab926
Freshly instantiate nested recursion variables under an opaque type 2023-04-12 14:31:19 -05:00
Ayaz Hafiz
40fc920b5e
Drop recursion var instantiation in the wrong spot 2023-04-12 14:12:36 -05:00
Ayaz Hafiz
f33651bf6a
Correctly instantiate recursion variables under nested aliases
Like we instantiate nested lambda set variables and nested OIOP
variables for aliases, we need to do the same for recursion variables.
2023-04-12 13:59:24 -05:00
Ayaz Hafiz
73e5a9ed46
Remove unused branch in alias instantiation 2023-04-12 13:17:42 -05:00
Ayaz Hafiz
8e093abaf5
Reduce loop to while 2023-04-10 16:36:18 -05:00
Ayaz Hafiz
b9ab93fd98
Introduce annotation in first step of recursive solving independently
The algorithm for solving recursive definitions proceeds in several
steps. There are three main phases: introduction of what's known,
solving what's not known, and then checking our work of what was
inferred against what the programmer claimed. Concretely:

1. All explicitly-annotated signatures in the mutually recursive set are
   introduced and let-generalized.
2. Then, inference type variables (`_`) and unannotated def signatures are
   introduced to the cycle, without generalization. The bodies of these
   defs, that are either unannotated or have inference variables, are
   solved.
3. The defs from step (2) are now let-generalized, since we now know
   that their types are consistent. At this point, all the defs in the
   cycle have their types introduced and let-generalized, but we still
   haven't checked the bodies of the defs froom step (1).
4. Check the bodies of explicitly-annotated defs in recursive set. This
   might materially affect the actual types in the signature, for
   example do to fixpoint-fixing or alias expansion.
5. As a result of (4) possibly changing the structure of the annotated
   type, and because the previous annotated types in (1) were introduced
   at a lower rank, we now re-introduce and re-generalize the solved def
   types, in the same we did in step (3).
5. The rest of the program is solved.

Now, a very important thing here is that the annotation signature
introduced for (1) consists of different type variables than the
annotation signature introduced in (5). The reason is that they live at
different ranks. Prior to this patch we were not explicilty doing so;
this commit ensures that we do.
2023-04-10 16:31:00 -05:00
Brendan Hansknecht
c440b2ca05
Switch to PathBuf to avoid Path turning into a fat pointer. Avoids growing Constraints 2023-04-09 21:14:05 -07:00
Brendan Hansknecht
6302a8d4b5
switch from type annotation to type variable 2023-04-09 14:03:33 -07:00