Commit graph

75 commits

Author SHA1 Message Date
Joshua Warner
8f0566a55f
Fix crash with doubly-nested parens in patterns 2024-12-24 14:08:52 -05:00
Joshua Warner
941c6c4fe3
Fix exponential behavior in parsing function types in tuples 2024-12-24 11:20:36 -05:00
Joshua Warner
512be85f9a
Fix parens around as in tag union 2024-12-21 20:14:19 -05:00
Joshua Warner
7ba5135602
Fix as in apply type 2024-12-21 20:14:19 -05:00
Joshua Warner
249125297e
Add missing indent call 2024-12-21 20:14:15 -05:00
Anthony Bullard
66529503ff
Fix snake case formatting 2024-12-17 05:40:42 -06:00
Joshua Warner
d6d396b887
Fix 'implements' variable in types 2024-12-15 18:33:57 -08:00
Joshua Warner
cc611533e0
Fix formatting of literals in closure args 2024-12-15 18:33:57 -08:00
Joshua Warner
61fb9e45fb
Fix handling of spaces in record types 2024-12-15 18:33:57 -08:00
Joshua Warner
df16e1b633
Move spaces outside of parens 2024-12-15 18:33:55 -08:00
Joshua Warner
1b4f5bbb52
Move indent call to correct spot 2024-12-15 18:33:54 -08:00
Joshua Warner
f7baa878f2
Fix as indentation 2024-12-15 18:33:53 -08:00
Joshua Warner
54a0456c30
Fix double-as formatting 2024-12-15 18:33:52 -08:00
Joshua Warner
9f3f99c573
Format spaces in as annotation correctly 2024-12-15 18:33:52 -08:00
Joshua Warner
7ea074dfa1
Refactoring Node 2024-12-15 18:33:49 -08:00
Joshua Warner
3acc6940b4
Fix parenthesized spaces in tag unions 2024-12-13 13:45:12 -08:00
Joshua Warner
f233c5328d
lift to spaces in ann_lift_to_node default case 2024-12-13 13:45:11 -08:00
Joshua Warner
d66f51db7b
Don't mix spaces before/after the field separator 2024-12-13 13:45:10 -08:00
Joshua Warner
6ac6a7c19a
Feedback: dry out term, make fmt_spaces_with_newline_mode more readable, explicitly implement all the variants in ann_lift_spaces 2024-12-05 18:54:25 -08:00
Joshua Warner
2163b28390
Fix formatting of newlines in parens in a function type 2024-12-05 18:54:18 -08:00
Joshua Warner
48c941d542
Add lifting for ext values in types 2024-12-05 18:54:14 -08:00
Joshua Warner
b06afa7bb9
Fix purity removal 2024-12-05 18:54:10 -08:00
Joshua Warner
cfec120b13
Fix indent calls in optional fields 2024-12-05 18:54:08 -08:00
Joshua Warner
84b3969648
Adjust parens around patterns in annotations 2024-12-05 18:54:08 -08:00
Joshua Warner
b9862b47dc
Several fixes found in fuzzing 2024-12-05 18:54:03 -08:00
Joshua Warner
120e9be550
Move MigrationFlags from an argument on format* to a field on Buf
That has a few advantages:

* We avoid a bunch of extra parameter-passing "noise", since the vast majority of formatting code doesn't need to care about this setting beyond just passing it to nested format calls.
* It aligns really well with the "global" nature of this setting, and makes it impossible to have bugs where e.g. one callsite forgets to pass the correct value to it's children - which would lead to parts of the tree not being migrated. If this is truly a global setting on Buf, that simply can't happen.
2024-12-04 17:57:31 -08:00
Anthony Bullard
a2083cec30
Parsing support for snake_case identifiers
In this initial commit, I have done the following:

- Added unit tests to roc_parse's ident.rs file to cover at least the
  simplest Ident enum cases (Tag, OpaqueRef, and simple Access)
- Added '_' as a valid "rest" character in both uppercase and lowercase
  identifier parts
- Updated the test_syntax snapshots appropriately

There is still a lot left to do here. Such as:

- Do we want to allow multiple '_'s to parse successfully?
- Handle qualified access
- Handle accessor functions
- Handle record update functions
- Remove the UnderscoreInMiddle case from BadIdent
- Write unit tests for Malformed Idents

I am not a "Rustacean" by any means, but have been through the Book in
years past.  Any feedback on the way I wrote the tests or any other part
of the implementation would be very appreciated.
2024-12-03 20:50:47 -06:00
Joshua Warner
f7a5f06e5b
Fix a bunch of bugs found in fuzzing 2024-12-01 12:40:19 -08:00
Anton-4
74d137cad4
Revert "Merge pull request #7267 from joshuawarner32/fuzzing-bugs-2"
This reverts commit 364249a29d, reversing
changes made to 0e550a7f68.
2024-11-30 18:43:16 +01:00
Joshua Warner
ed62bcc15a
Fix a bunch of parser/formatter bugs found in fuzzing
Notably:
* Unified how parens are formatted between (1) when we have a ParensAround, and (2) when we've decided an Apply needs to have parens
* Made unary minus require the be indented to the same level as any other expression continuation. (it used to accidentally have rules meant for binary operators applied)
* Don't apply extra indent to the backpassing continuation in the case that the call does itself require indentation
* Make `try@foo` correctly parse as `try @foo`, so that formatting doesn't change the tree when it adds that space
* Detect more cases where we need to outdent trailing e.g. {} blocks in applies
* Approximately a bagillion other things, 90% of which I added tests for, and none of which affected the formatting of examples or builtins
2024-11-29 16:25:59 -08:00
JRI98
a332acd7bf
Remove unused malformed related variants 2024-11-14 10:23:06 +00:00
Agus Zubiaga
d692fc7c42
Format effectful arrows in annotations 2024-11-07 18:54:11 -03:00
Agus Zubiaga
ef4eeb5c1a
Parse effectful arrow in function annotations 2024-11-07 18:54:11 -03:00
Sam Mohr
2da08be8ef
Remove old record builder syntax 2024-09-21 04:44:44 -07:00
Agus Zubiaga
4e19753189
fmt: Use format_with_options Parens for as pattern arguments 2024-09-02 12:02:01 -03:00
Sam Mohr
cb8040f629
Ignore underscore-prefixed fields in record builders 2024-08-06 22:49:35 -07:00
Sam Mohr
f415017c90
Implement new builder syntax alongside old one 2024-07-07 03:28:59 -07:00
Bryce Miller
cb08225bf0
| -> where 2023-06-05 20:19:00 -04:00
Bryce Miller
e514d0cb83
Define and use IMPLEMENTS const in roc_parse::keyword 2023-05-29 07:21:27 -04:00
Bryce Miller
dbc0204532
abilities syntax has -> implements 2023-05-24 21:30:16 -04:00
Bryce Miller
95516d585a
Update formatter has -> implements 2023-05-21 19:03:53 -04:00
Bryce Miller
10d92bf0f3
ast::ImplementsAbilities::Has ->
ast::ImplementsAbilities::Implements
2023-05-20 19:16:13 -04:00
Bryce Miller
4b90948fcf
ast::HasAbilities -> ast::ImplementsAbilities 2023-05-20 19:13:01 -04:00
Bryce Miller
9eb2180a0f
ast::HasAbility -> ast::ImplementsAbility 2023-05-20 08:27:42 -04:00
Bryce Miller
413ccb24ad
ast::HasImpls -> ast::AbilityImpls 2023-05-20 08:24:02 -04:00
Bryce Miller
ebbdae6c28
ast::HasClause -> ast::ImplementsClause 2023-05-20 08:20:44 -04: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
c2e50a22b6 Record Builder formatting 2023-05-07 15:51:08 -03:00