Commit graph

166 commits

Author SHA1 Message Date
Kiryl Dziamura
1bb3c3d1dd
Make has have 4 identation spaces 2023-07-04 11:24:40 +02:00
Ajai Nelson
2e5fef5231
Improve error messages involving ignored variables
Fix #3987
2023-06-06 19:46:15 -04:00
Agustin Zubiaga
4cd2c957ca
Format multiline reecord builder fields nicely 2023-05-17 12:48:37 -03:00
Agustin Zubiaga
5edcb31f32
Outdentable record builders 2023-05-17 12:21:39 -03:00
Agustin Zubiaga
b92c50c7be
Remove unnecessary format_record_builder_field_help argument 2023-05-17 12:17:31 -03:00
Agustin Zubiaga
d1feb00170
Track spaces between : and <- in record builders 2023-05-17 11:49:06 -03:00
Agustin Zubiaga
731cd4257d
Record Builder colon arrow syntax 2023-05-16 22:44:55 -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
Agustin Zubiaga
c2e50a22b6 Record Builder formatting 2023-05-07 15:51:08 -03:00
Anton-4
9748e4a4dc
many clippy fixes 2023-04-24 16:21:46 +02:00
Anton-4
937722c462
Merge branch 'main' of github.com:roc-lang/roc into rust_version_upgrade 2023-04-22 17:14:01 +02:00
Anton-4
e784baccce
rust update, nix update, clippy fixes 2023-04-22 14:51:01 +02:00
Folkert
394495d307 Revert "update size asserts"
This reverts commit 9973d4b8d2.
2023-04-21 13:22:23 +02:00
Folkert
4cd8f0a056 clippy --fix fixes 2023-04-21 12:05:51 +02:00
Brendan Hansknecht
56ed985cc9
pass through correct path and type for ingested file 2023-04-09 14:03:32 -07:00
Brendan Hansknecht
f4411afbbc
get basic wiring of a value through the compiler 2023-04-09 14:03:31 -07:00
Brendan Hansknecht
8f238046be
get basic parsing and formatting working 2023-04-09 14:03:31 -07:00
Brendan Hansknecht
99547086ee
add very rough framework of how the parse might need to change 2023-04-09 14:03:31 -07:00
Brendan Hansknecht
f42f61e271
run a toml formatter and then clean it up a bit 2023-03-06 19:47:57 -08:00
Brendan Hansknecht
4a89bee0a5
centralize package versions except for vendor and excluded 2023-03-06 19:29:09 -08:00
Brendan Hansknecht
5485c8a5b0
update to using workspace package spec 2023-03-06 16:36:18 -08:00
Joshua Warner
b5f284cd78
Fix several fmt+parse bugs found by fuzzing 2023-02-19 12:37:33 -08:00
Joshua Warner
2541a09273
Fix formatting of initial newlines in collections
Fixes #5015
2023-02-17 09:08:50 -08:00
Luca Cervello
a4410fe052
fix: add spaces around ? in optional record field 2023-02-08 18:41:22 +01: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
Joshua Warner
d876abb04b
Fix formatting of backpassing in a nested def with no newline
Fixes #4338
2023-01-16 09:31:08 -08:00
Joshua Warner
0b8e68f70d
Fix approximately a bajillion fmt and parsing bugs
(discovered by fuzzing)

There's more to come, but this seems like a good batch for now.
2023-01-13 18:20:44 -08: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
07ebc81cba
Be more lenient with indentation in record parsing
... and extract a shared helper with collection_trailing_sep_e, thereby resolving some inconsistencies with normal collection parsing.

... and delete some dead code while I'm at it
2023-01-02 18:53:15 -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
06cfdd71cc
formatting 2022-12-30 23:27:06 +01:00
Folkert
8305d078a0
add as for list rest patterns 2022-12-30 23:17:29 +01:00
Folkert
aff70bb6bd
refactor PatternAs 2022-12-30 18:22:10 +01:00
Folkert
e9196f3c0b
parse and format pattern as 2022-12-30 17:50:17 +01:00
Joshua Warner
bfeddc470a
Move syntax tests to a dedicated crate
* test_fmt moves out of fmt crate
* test_parse _mostly_ moves out of parse crate and into `test_snapshots.rs` (some simple tests remain)
* now there's only two fuzz targets, fuzz_expr and fuzz_module, that cover both parsing and formatting
* added a system to auto-add new snapshot entries for new test files
* took some commented-out tests in `test_parse` and converted them to snapshot tests
* moved test_fmt's verification of formatting consistency into test_snapshots
* fixed a huge derp on my part where the fmt fuzzer in #4758 was completely useless (broken by refactoring just prior to submitting the PR)
* fixed a formatting bug found by fuzzing (bound_variable.expr.roc) - that I missed earlier due to ^^^ that derp
* no longer have roc_test_utils as a dependency in fmt - which was causing problems for the wasm build
2022-12-26 22:50:24 -08:00
Ayaz
dbdf4acdd7
Merge pull request #4758 from joshuawarner32/fuzzing-take-2
Add fuzzing for the formatter and fix bugs
2022-12-22 06:35:34 -07:00
Richard Feldman
09764be7c3
Go back to PackageName 2022-12-18 10:11:19 -05:00
Joshua Warner
a046428ce6
Add fuzzing for the formatter and fix bugs
This commit adds fuzzing for the (expr) formatter, with the same invariants that we use for fmt tests:
  * We start with text, which we parse
  * We format the AST, which must succeed
  * We parse back the AST and make sure it's identical igoring whitespace+comments
  * We format the new AST and assert it's equal to the first formatted version ("idempotency")

Interestingly, while a lot of bugs this found were in the formatter, it also found some parsing bugs.

It then fixes a bunch of bugs that fell out:
* Some small oversights in RemoveSpaces
* Make sure `_a` doesn't parse as an inferred type (`_`) followed by an identifier (parsing bug!)
* Call `extract_spaces` on a parsed expr before matching on it, lest it be Expr::SpaceBefore - when parsing aliases
* A few cases where the formatter generated invalid/different code
* Numerous formatting bugs that caused the formatting to not be idempotent

The last point there is worth talking further about. There were several cases where the old code was trying to enforce strong
opinions about how to insert newlines in function types and defs. In both of those cases, it looked like the goals of
(1) idempotency, (2) giving the user some say in the output, and (3) these strong opinions - were often in conflict.

For these cases, I erred on the side of following the user's existing choices about where to put newlines.

We can go back and re-add this strong opinionation later - but this seemed the right approach for now.
2022-12-17 09:52:09 -08:00
Richard Feldman
d022c19f5c
Merge remote-tracking branch 'origin/main' into packages 2022-12-13 06:04:43 -05:00
Richard Feldman
3d1cdf1fd4
Merge pull request #4737 from roc-lang/to
Use app module's `to` to determine platform
2022-12-13 06:04:25 -05:00
Richard Feldman
ec9cf4efe2
Merge branch 'to' into packages 2022-12-12 01:15:34 -05:00
Richard Feldman
8a9e152a5b
Rename PackageName to PackagePath 2022-12-12 00:41:55 -05:00
Nathan Freestone
83f4cdfaeb
fix for format behavior for multi-line strings 2022-12-11 18:38:47 -07:00
Richard Feldman
3227f95d45
Merge branch 'refactor-platform-info' into packages 2022-12-11 06:17:29 -05:00
Ayaz Hafiz
aab509c5c1
Make sure to escape formatting of char literals
Closes #4682
2022-12-05 14:09:28 -06:00
Richard Feldman
8a5ddaab2f
Drop imports from package header
That doesn't actually make sense!
2022-12-04 06:26:44 -05:00
Richard Feldman
da595a86b0
Parse package module header 2022-12-04 06:26:44 -05:00