mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 05:34:11 +03: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
@ -277,7 +277,7 @@ impl<'a> Formattable<'a> for TypeAnnotation<'a> {
|
||||
buf.push(')')
|
||||
}
|
||||
}
|
||||
Apply(_, name, arguments) => {
|
||||
Apply(pkg, name, arguments) => {
|
||||
// NOTE apply is never multiline
|
||||
let write_parens = parens == Parens::InApply && !arguments.is_empty();
|
||||
|
||||
@ -285,6 +285,11 @@ impl<'a> Formattable<'a> for TypeAnnotation<'a> {
|
||||
buf.push('(')
|
||||
}
|
||||
|
||||
if !pkg.is_empty() {
|
||||
buf.push_str(pkg);
|
||||
buf.push('.');
|
||||
}
|
||||
|
||||
buf.push_str(name);
|
||||
|
||||
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]
|
||||
fn record_type() {
|
||||
expr_formats_same(indoc!(
|
||||
|
Loading…
Reference in New Issue
Block a user