Commit graph

255 commits

Author SHA1 Message Date
Bryce Miller
17c733ec81
has -> implements in roc_problem::can::Problem 2023-05-20 21:12:26 -04:00
Bryce Miller
e04f09231c
has -> implements in error messages 2023-05-20 21:05:34 -04:00
Agustin Zubiaga
23db4a5e87
Update tests to new record builder syntax 2023-05-17 11:47:34 -03: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
f94004d137 Parse builders without backtracking from records 2023-05-13 20:05:42 -03:00
Agustin Zubiaga
c3bcb88c5b Special record builder error when applying opaque types 2023-05-11 20:20:35 -03:00
Agustin Zubiaga
71a2990e21 Tip replacing <- with : for static values 2023-05-09 23:37:24 -03:00
Agustin Zubiaga
d2a57112fd Unapplied record builder error 2023-05-08 20:16:38 -03:00
Agustin Zubiaga
6670fbb1ab Multiple record builder error 2023-05-08 19:26:47 -03: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
3b885ccf66
Improve error message when opaque wrapping a function is applied directly
Closes #5094
2023-04-12 10:06:27 -05:00
Brendan Hansknecht
e5b88366fe
add proper error messages for ingested files 2023-04-09 14:03:33 -07:00
Brendan Hansknecht
6302a8d4b5
switch from type annotation to type variable 2023-04-09 14:03:33 -07:00
Brendan Hansknecht
8f4945f286
make file loading errors that happen late in compilation still fatal 2023-04-09 14:03:33 -07:00
Brendan Hansknecht
7079361841
add ingested file category for error messages 2023-04-09 14:03:32 -07:00
Richard Feldman
d391982c33
Apply tag union diffs to recursive tag unions 2023-03-26 23:19:50 -04:00
Richard Feldman
389ec09451
Show ellipses for tag payload slots of same types 2023-03-26 21:43:13 -04:00
Richard Feldman
3013b9e113
Fix reporting edge case where both unions are open 2023-03-26 14:50:27 -04:00
Richard Feldman
21e14589b0
Update tests 2023-03-26 11:49:45 -04:00
Richard Feldman
ae906ca7b3
Improve tag union diffs 2023-03-26 10:01:05 -04:00
Ju Liu
dfeabc5933 Use 'by accident' instead of 'on accident' 2023-02-18 15:42:34 +00:00
Ayaz
9340a67e87
Merge pull request #4993 from joshuawarner32/tuple-gen-tuple-backend-experiment
Implement mono / code generation for tuples
2023-02-08 10:42:51 -05:00
Joshua Warner
3fee0d3e8f
Fix a bunch of bugs in parsing/formatting found by fuzzing 2023-02-07 20:25:56 -08:00
Joshua Warner
5a6be05ead
implement mono / lowering for tuples 2023-02-07 18:54:50 -08:00
Ayaz Hafiz
9d62fa96ef
Fix spacing 2023-01-27 17:18:36 -06:00
Ayaz Hafiz
572a666780
No Encode/Decode for Nat 2023-01-27 17:16:10 -06:00
Joshua Warner
de828416bf
Initial implementation of tuples in type checking
This leaves in place a bunch of TODOs and likely many bugs - notably, I haven't tested codegen/layout at all here.
2023-01-22 12:40:44 -08:00
Richard Feldman
8ac0d3b493
Fix unused var in release builds 2023-01-13 03:23:42 -05:00
Richard Feldman
eaf8ce6c08
Add a debug_assert! about tag union polarity 2023-01-12 16:22:35 -05:00
Richard Feldman
e291e0ee99
Combine some match branches 2023-01-12 16:21:33 -05:00
Richard Feldman
717350ef9e
FlexAbleVar sets should be equal if the vars are. 2023-01-12 16:20:36 -05:00
Richard Feldman
63161b5330
Remove a debug print 2023-01-12 16:16:50 -05:00
Richard Feldman
f959db588c
Show ellipses on single-field record diffs 2023-01-11 23:58:22 -05:00
Richard Feldman
863c39be54
Fix typo in variable name 2023-01-11 23:54:20 -05:00
Richard Feldman
f3a65e5799
Fix single-line record type formatting 2023-01-11 23:54:05 -05:00
Richard Feldman
d47a4e24d3
Initialize counter to 0, not 1 2023-01-11 23:53:27 -05:00
Richard Feldman
92f94a00b4
Render ellipses in a different color 2023-01-11 23:18:54 -05:00
Richard Feldman
d9a582e447
Render { … } types on the same line 2023-01-11 23:18:54 -05:00
Richard Feldman
dc8eb81bb2
Omit more unnecessary fields from record diffs 2023-01-11 23:18:53 -05:00
Richard Feldman
148119c6b4
Don't report how many fields were omitted. 2023-01-11 23:18:53 -05:00
Richard Feldman
1787d0c679
Report how many record fields were omitted 2023-01-11 23:18:53 -05:00
Richard Feldman
59208ffc40
Omit record fields from diff if they're identical 2023-01-11 23:18:53 -05:00
Richard Feldman
e7466c9485
Rename traverse to diff_args 2023-01-11 23:18:53 -05:00
Richard Feldman
bc14855c59
Report multi-field record types as multiline 2023-01-11 23:18:52 -05:00
Folkert de Vries
d8b2ff07f8
Merge pull request #4802 from roc-lang/valgrind-unit-tests
Valgrind unit tests
2023-01-11 19:45:28 +01:00
Joshua Warner
94070e8ba6
Improve parsing of scalar literals
* Unify parsing of string literals and scalar literals, to (e.g.) ensure escapes are handled uniformly. Notably, this makes unicode escapes valid in scalar literals.
* Add a variety of custom error messages about specific failure cases of parsing string/scalar literals. For example, if we're expecting a string (e.g. a package name in the header) and the user tried using single quotes, give a clear message about that.
* Fix formatting of unicode escapes (they previously used {}, now correctly use () to match roc strings)
2023-01-07 15:12:52 -08:00
Joshua Warner
0da50a612d
Be more lenient with required indentation in collections
... and also remove a bunch of now-dead errors that can't be triggered.
2023-01-01 17:49:51 -08:00
Folkert
32e3f01a28
refactor printing error counts 2022-12-30 14:30:08 +01:00
Folkert
439befcc38
run cargo fmt 2022-12-23 17:19:54 +01:00
Lunarmagpie
f932bb66a0
Add function binding to error message 2022-12-23 11:07:57 -05:00