Fix formatting of initial newlines in collections

Fixes #5015
This commit is contained in:
Joshua Warner 2023-02-09 19:48:56 -08:00
parent f98a75fc51
commit 2541a09273
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
6 changed files with 198 additions and 86 deletions

View file

@ -0,0 +1,7 @@
table :
{
height : Pixels,
}
-> Table
table = \{ height } -> crash "not implemented"
table

View file

@ -0,0 +1,131 @@
Defs(
Defs {
tags: [
Index(2147483649),
],
regions: [
@0-89,
],
space_before: [
Slice(start = 0, length = 0),
],
space_after: [
Slice(start = 0, length = 0),
],
spaces: [],
type_defs: [],
value_defs: [
Annotation(
@0-5 Identifier(
"table",
),
@8-44 Function(
[
@8-35 Record {
fields: [
@14-29 SpaceBefore(
SpaceAfter(
RequiredValue(
@14-20 "height",
[],
@23-29 Apply(
"",
"Pixels",
[],
),
),
[
Newline,
],
),
[
Newline,
],
),
],
ext: None,
},
],
@39-44 Apply(
"",
"Table",
[],
),
),
),
AnnotatedBody {
ann_pattern: @0-5 Identifier(
"table",
),
ann_type: @8-44 Function(
[
@8-35 Record {
fields: [
@14-29 SpaceBefore(
SpaceAfter(
RequiredValue(
@14-20 "height",
[],
@23-29 Apply(
"",
"Pixels",
[],
),
),
[
Newline,
],
),
[
Newline,
],
),
],
ext: None,
},
],
@39-44 Apply(
"",
"Table",
[],
),
),
comment: None,
body_pattern: @45-50 Identifier(
"table",
),
body_expr: @53-89 Closure(
[
@54-62 RecordDestructure(
[
@55-61 Identifier(
"height",
),
],
),
],
@66-89 Apply(
@66-71 Crash,
[
@72-89 Str(
PlainLine(
"not implemented",
),
),
],
Space,
),
),
},
],
},
@90-95 SpaceBefore(
Var {
module_name: "",
ident: "table",
},
[
Newline,
],
),
)

View file

@ -0,0 +1,5 @@
table : {
height : Pixels
} -> Table
table = \{height} -> crash "not implemented"
table

View file

@ -311,6 +311,7 @@ mod test_snapshots {
pass/expect_fx.moduledefs,
pass/extra_newline_in_parens.expr,
pass/float_with_underscores.expr,
pass/fn_with_record_arg.expr,
pass/full_app_header.header,
pass/full_app_header_trailing_commas.header,
pass/function_effect_types.header,