mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Fix comment between multiline annotation args
This commit is contained in:
parent
0412578e49
commit
dbbbacc32a
2 changed files with 20 additions and 3 deletions
|
@ -207,9 +207,11 @@ impl<'a> Formattable for TypeAnnotation<'a> {
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
Function(arguments, result) => {
|
Function(arguments, result) => {
|
||||||
let write_parens = parens != Parens::NotNeeded;
|
let needs_parens = parens != Parens::NotNeeded;
|
||||||
|
|
||||||
if write_parens {
|
buf.indent(indent);
|
||||||
|
|
||||||
|
if needs_parens {
|
||||||
buf.push('(')
|
buf.push('(')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +258,7 @@ impl<'a> Formattable for TypeAnnotation<'a> {
|
||||||
indent,
|
indent,
|
||||||
);
|
);
|
||||||
|
|
||||||
if write_parens {
|
if needs_parens {
|
||||||
buf.push(')')
|
buf.push(')')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4276,6 +4276,21 @@ mod test_fmt {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn comment_between_multiline_ann_args() {
|
||||||
|
expr_formats_same(indoc!(
|
||||||
|
r#"
|
||||||
|
blah :
|
||||||
|
Str,
|
||||||
|
# comment
|
||||||
|
(Str -> Str)
|
||||||
|
-> Str
|
||||||
|
|
||||||
|
42
|
||||||
|
"#
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pipeline_apply_lambda_multiline() {
|
fn pipeline_apply_lambda_multiline() {
|
||||||
expr_formats_same(indoc!(
|
expr_formats_same(indoc!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue