mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Merge pull request #2079 from rtfeldman/joshuawarner32/type-apply-package-name-fmt
Fix formatting in the presence of a pkg name in TypeAnnotation::Apply
This commit is contained in:
commit
e2e095eb69
2 changed files with 18 additions and 1 deletions
|
@ -277,7 +277,7 @@ impl<'a> Formattable<'a> for TypeAnnotation<'a> {
|
||||||
buf.push(')')
|
buf.push(')')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Apply(_, name, arguments) => {
|
Apply(pkg, name, arguments) => {
|
||||||
// NOTE apply is never multiline
|
// NOTE apply is never multiline
|
||||||
let write_parens = parens == Parens::InApply && !arguments.is_empty();
|
let write_parens = parens == Parens::InApply && !arguments.is_empty();
|
||||||
|
|
||||||
|
@ -285,6 +285,11 @@ impl<'a> Formattable<'a> for TypeAnnotation<'a> {
|
||||||
buf.push('(')
|
buf.push('(')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !pkg.is_empty() {
|
||||||
|
buf.push_str(pkg);
|
||||||
|
buf.push('.');
|
||||||
|
}
|
||||||
|
|
||||||
buf.push_str(name);
|
buf.push_str(name);
|
||||||
|
|
||||||
for argument in *arguments {
|
for argument in *arguments {
|
||||||
|
|
|
@ -2654,6 +2654,18 @@ mod test_fmt {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn function_application_package_type() {
|
||||||
|
expr_formats_same(indoc!(
|
||||||
|
r#"
|
||||||
|
main : Task.Task {} []
|
||||||
|
main = 42
|
||||||
|
|
||||||
|
main
|
||||||
|
"#
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn record_type() {
|
fn record_type() {
|
||||||
expr_formats_same(indoc!(
|
expr_formats_same(indoc!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue