mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Fix as indentation
This commit is contained in:
parent
7b9aa59d64
commit
f7baa878f2
6 changed files with 72 additions and 4 deletions
|
@ -365,18 +365,24 @@ fn fmt_ty_ann(
|
|||
buf.push('(')
|
||||
}
|
||||
|
||||
buf.indent(indent);
|
||||
let lhs_indent = buf.cur_line_indent();
|
||||
lhs.value
|
||||
.format_with_options(buf, Parens::InAsPattern, Newlines::No, indent);
|
||||
buf.spaces(1);
|
||||
format_spaces(buf, spaces, newlines, indent);
|
||||
buf.indent(indent);
|
||||
buf.indent(lhs_indent + INDENT);
|
||||
buf.push_str("as");
|
||||
buf.spaces(1);
|
||||
buf.push_str(name.value);
|
||||
for var in *vars {
|
||||
buf.spaces(1);
|
||||
var.value
|
||||
.format_with_options(buf, Parens::NotNeeded, Newlines::No, indent);
|
||||
var.value.format_with_options(
|
||||
buf,
|
||||
Parens::NotNeeded,
|
||||
Newlines::No,
|
||||
lhs_indent + INDENT,
|
||||
);
|
||||
}
|
||||
|
||||
if write_parens {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
e : A #
|
||||
as H
|
||||
n
|
|
@ -0,0 +1,55 @@
|
|||
@0-13 SpaceAfter(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-11,
|
||||
],
|
||||
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 Identifier {
|
||||
ident: "e",
|
||||
},
|
||||
@2-0 As(
|
||||
@2-3 Apply(
|
||||
"",
|
||||
"A",
|
||||
[],
|
||||
),
|
||||
[
|
||||
LineComment(
|
||||
"",
|
||||
),
|
||||
],
|
||||
TypeHeader {
|
||||
name: @10-11 "H",
|
||||
vars: [],
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@12-13 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "n",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
e:A#
|
||||
as H
|
||||
n
|
|
@ -298,6 +298,7 @@ mod test_snapshots {
|
|||
pass/annotated_tag_destructure.expr,
|
||||
pass/annotated_tuple_destructure.expr,
|
||||
pass/annotation_apply_newlines.expr,
|
||||
pass/annotation_comment_before_as.expr,
|
||||
pass/annotation_comment_before_colon.expr,
|
||||
pass/annotation_double_as.expr,
|
||||
pass/annotation_tag_parens_comment.expr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue