diff --git a/compiler/fmt/src/annotation.rs b/compiler/fmt/src/annotation.rs index 4380af17e2..4c389f7147 100644 --- a/compiler/fmt/src/annotation.rs +++ b/compiler/fmt/src/annotation.rs @@ -293,6 +293,9 @@ impl<'a> Formattable for TypeAnnotation<'a> { SpaceBefore(ann, spaces) => { buf.newline(); + + buf.indent(indent); + fmt_comments_only(buf, spaces.iter(), NewlineAt::Bottom, indent); ann.format_with_options(buf, parens, Newlines::No, indent) } diff --git a/compiler/fmt/tests/test_fmt.rs b/compiler/fmt/tests/test_fmt.rs index a49914abce..edea7957d3 100644 --- a/compiler/fmt/tests/test_fmt.rs +++ b/compiler/fmt/tests/test_fmt.rs @@ -2984,6 +2984,18 @@ mod test_fmt { )); } + #[test] + fn multiline_higher_order_function() { + expr_formats_same(indoc!( + r#" + foo : + (Str -> Bool) -> Bool + + 42 + "# + )); + } + #[test] /// Test that everything under examples/ is formatted correctly /// If this test fails on your diff, it probably means you need to re-format the examples.