Force type headers to format just like Pattern::Apply

This commit is contained in:
Joshua Warner 2024-12-15 10:01:51 -08:00
parent df16e1b633
commit 20aee5c37b
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
14 changed files with 269 additions and 168 deletions

View file

@ -1,4 +1,5 @@
M { s ? s
M
{ s ? s
{ J &
} }
{ s ? s

View file

@ -0,0 +1,6 @@
Q
(
"""
"""
"") : a
q

View file

@ -0,0 +1,58 @@
@0-15 SpaceAfter(
Defs(
Defs {
tags: [
EitherIndex(0),
],
regions: [
@0-13,
],
space_before: [
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [
Alias {
header: TypeHeader {
name: @0-1 "Q",
vars: [
@2-10 Apply(
@2-8 StrLiteral(
Block(
[],
),
),
[
@8-10 StrLiteral(
PlainLine(
"",
),
),
],
),
],
},
ann: @12-13 BoundVariable(
"a",
),
},
],
value_defs: [],
},
@14-15 SpaceBefore(
Var {
module_name: "",
ident: "q",
},
[
Newline,
],
),
),
[
Newline,
],
)

View file

@ -0,0 +1,2 @@
Q(""""""""):a
q

View file

@ -1,4 +1,5 @@
il3 \k -> # w#z
CCC @C # i
CCC
@C # i
(t! K) : i
C

View file

@ -0,0 +1,64 @@
@0-14 SpaceAfter(
Defs(
Defs {
tags: [
EitherIndex(2147483648),
],
regions: [
@0-12,
],
space_before: [
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
value_defs: [
Annotation(
@0-1 NumLiteral(
"1",
),
@2-12 TagUnion {
ext: None,
tags: [
@3-11 Apply {
name: @3-4 "N",
args: [
@5-10 Apply(
"",
"H",
[
@7-8 SpaceAfter(
Apply(
"",
"S",
[],
),
[
Newline,
],
),
],
),
],
},
],
},
),
],
},
@13-14 SpaceBefore(
Underscore(
"",
),
[
Newline,
],
),
),
[
Newline,
],
)

View file

@ -612,6 +612,7 @@ mod test_snapshots {
pass/provides_type.header,
pass/qualified_field.expr,
pass/qualified_var.expr,
pass/quotes_in_parens_in_pat.expr,
pass/record_access_after_tuple.expr,
pass/record_builder.expr,
pass/record_builder_ignored_fields.expr,