Ensure we indent before writing implements keyword

This commit is contained in:
Joshua Warner 2025-01-01 10:46:25 -05:00
parent d9ad34592c
commit 2f420d8e4e
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
5 changed files with 68 additions and 0 deletions

View file

@ -496,6 +496,7 @@ impl<'a> Formattable for TypeDef<'a> {
} => { } => {
header.format_with_options(buf, Parens::NotNeeded, Newlines::No, indent); header.format_with_options(buf, Parens::NotNeeded, Newlines::No, indent);
buf.spaces(1); buf.spaces(1);
buf.indent(indent + INDENT);
buf.push_str(roc_parse::keyword::IMPLEMENTS); buf.push_str(roc_parse::keyword::IMPLEMENTS);
buf.spaces(1); buf.spaces(1);

View file

@ -0,0 +1,4 @@
C
4 #
implements e : m
C

View file

@ -0,0 +1,59 @@
@0-22 SpaceAfter(
Defs(
Defs {
tags: [
EitherIndex(0),
],
regions: [
@0-20,
],
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: [
Ability {
header: TypeHeader {
name: @0-1 "C",
vars: [
@2-3 SpaceAfter(
NumLiteral(
"4",
),
[
LineComment(
"",
),
],
),
],
},
loc_implements: @6-16 Implements,
members: [
AbilityMember {
name: @17-18 "e",
typ: @19-20 BoundVariable(
"m",
),
},
],
},
],
value_defs: [],
},
@21-22 SpaceBefore(
Tag(
"C",
),
[
Newline,
],
),
),
[
Newline,
],
)

View file

@ -0,0 +1,3 @@
C(4#
)implements e:m
C

View file

@ -459,6 +459,7 @@ mod test_snapshots {
pass/if_in_record_field_opt_pat.expr, pass/if_in_record_field_opt_pat.expr,
pass/if_newline_then_negate_else_recordupdater.expr, pass/if_newline_then_negate_else_recordupdater.expr,
pass/if_then_weird_indent.expr, pass/if_then_weird_indent.expr,
pass/implements_after_parens_comment.expr,
pass/implements_annotation_comment.expr, pass/implements_annotation_comment.expr,
pass/implements_in_pat_after_comment.expr, pass/implements_in_pat_after_comment.expr,
pass/implements_newline_in_fn_ty.expr, pass/implements_newline_in_fn_ty.expr,