diff --git a/crates/compiler/fmt/src/def.rs b/crates/compiler/fmt/src/def.rs index 3f62ac4179..3434990564 100644 --- a/crates/compiler/fmt/src/def.rs +++ b/crates/compiler/fmt/src/def.rs @@ -558,6 +558,7 @@ impl<'a> Formattable for TypeHeader<'a> { let need_parens = matches!(var.item, Pattern::Apply(..)); if need_parens { + buf.indent(vars_indent); buf.push_str("("); } diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/repr_7346.expr.formatted.roc b/crates/compiler/test_syntax/tests/snapshots/pass/repr_7346.expr.formatted.roc new file mode 100644 index 0000000000..26fa962bed --- /dev/null +++ b/crates/compiler/test_syntax/tests/snapshots/pass/repr_7346.expr.formatted.roc @@ -0,0 +1,4 @@ +il3 \k -> # w#z + CCC @C # i + (t! K) : i + C \ No newline at end of file diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/repr_7346.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/repr_7346.expr.result-ast new file mode 100644 index 0000000000..d8e89a5573 --- /dev/null +++ b/crates/compiler/test_syntax/tests/snapshots/pass/repr_7346.expr.result-ast @@ -0,0 +1,86 @@ +@0-31 SpaceAfter( + Apply( + @0-3 Var { + module_name: "", + ident: "il3", + }, + [ + @3-31 Closure( + [ + @4-5 Identifier { + ident: "k", + }, + ], + @13-31 SpaceBefore( + Defs( + Defs { + tags: [ + EitherIndex(0), + ], + regions: [ + @13-28, + ], + space_before: [ + Slice { start: 0, length: 0 }, + ], + space_after: [ + Slice { start: 0, length: 0 }, + ], + spaces: [], + type_defs: [ + Alias { + header: TypeHeader { + name: @13-16 "CCC", + vars: [ + @16-18 OpaqueRef( + "@C", + ), + @22-25 SpaceBefore( + Apply( + @22-24 Identifier { + ident: "t!", + }, + [ + @24-25 Tag( + "K", + ), + ], + ), + [ + LineComment( + "i", + ), + ], + ), + ], + }, + ann: @27-28 BoundVariable( + "i", + ), + }, + ], + value_defs: [], + }, + @30-31 SpaceBefore( + Tag( + "C", + ), + [ + Newline, + ], + ), + ), + [ + LineComment( + "w#z", + ), + ], + ), + ), + ], + Space, + ), + [ + Newline, + ], +) diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/repr_7346.expr.roc b/crates/compiler/test_syntax/tests/snapshots/pass/repr_7346.expr.roc new file mode 100644 index 0000000000..7f7f5a10b3 --- /dev/null +++ b/crates/compiler/test_syntax/tests/snapshots/pass/repr_7346.expr.roc @@ -0,0 +1,4 @@ +il3\k->#w#z + CCC@C(#i +t!K):i + C diff --git a/crates/compiler/test_syntax/tests/test_snapshots.rs b/crates/compiler/test_syntax/tests/test_snapshots.rs index cfed66a2aa..b722891bcd 100644 --- a/crates/compiler/test_syntax/tests/test_snapshots.rs +++ b/crates/compiler/test_syntax/tests/test_snapshots.rs @@ -596,6 +596,7 @@ mod test_snapshots { pass/record_updater_var_apply.expr, pass/record_with_if.expr, pass/record_with_lots_of_newlines.expr, + pass/repr_7346.expr, pass/requires_type.header, pass/return_apply_newline.expr, pass/return_field_access_in_parens.expr,