Commit graph

93 commits

Author SHA1 Message Date
Joshua Warner
f8f762a0ff Fix clippy 2024-12-28 22:35:10 -05:00
Joshua Warner
5e08515ed5
Remove dbg 2024-12-28 22:31:34 -05:00
Joshua Warner
72da294d55
Move apply to NodeInfo 2024-12-28 22:31:33 -05:00
Joshua Warner
99efcee275
Fix outdenting 2024-12-28 22:31:33 -05:00
Joshua Warner
c9ba958101
Remove unused code 2024-12-28 22:31:32 -05:00
Joshua Warner
07101f10a0
Simplifying fmt_ty_ann 2024-12-28 22:31:32 -05:00
Joshua Warner
4d438d8693
Move TypeAnnotation::Where to to_node 2024-12-28 22:31:31 -05:00
Joshua Warner
24ebcf68d1
wip 2024-12-28 22:31:31 -05:00
Joshua Warner
7a7f8340b9
Refactor: Convert TypeAnnotation::Apply to to_node 2024-12-28 22:31:30 -05:00
Joshua Warner
9ae5dc1bbc
Refactor: Convert TypeAnnotation::TagUnion to to_node (already working) 2024-12-28 22:31:30 -05:00
Joshua Warner
95d8fd471b
Refactor: Convert TypeAnnotation::Tuple to to_node, which required changing precedence information to flow up instead of down 2024-12-28 22:31:28 -05:00
Joshua Warner
35fa82cbef
Refactor: Convert TypeAnnotation::Record to to_node 2024-12-28 22:31:28 -05:00
Joshua Warner
d2e1c12b96
Refactor: introduce NodeInfo and needs_indent 2024-12-28 22:31:27 -05:00
Joshua Warner
13ec99c16b
Move TypeAnnotation::Apply to to_node 2024-12-28 22:31:26 -05:00
Joshua Warner
f169329c0e
Move TypeAnnotation::Function to to_node 2024-12-28 22:31:26 -05:00
Joshua Warner
3a7265baed
More impls for to_node 2024-12-28 22:31:25 -05:00
Joshua Warner
dbbd097708
Always use to_node for TypeAnnotation::As 2024-12-28 22:31:25 -05:00
Joshua Warner
5b93e834f1
Refactor more things into TypeAnnotation::Nodify 2024-12-28 22:31:24 -05:00
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