This commit is contained in:
KtorZ 2024-03-21 18:20:19 +01:00
parent ee280bc309
commit 0f9dbfd874
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
3 changed files with 30 additions and 7 deletions

View File

@ -476,12 +476,17 @@ impl<'comments> Formatter<'comments> {
let doc_comments = self.doc_comments(arg.location.start);
let doc = arg
.arg_name
.to_doc()
.append(" via ")
.append(self.expr(&arg.via, false))
.group();
let doc = match &arg.annotation {
None => arg.arg_name.to_doc(),
Some(a) => arg
.arg_name
.to_doc()
.append(": ")
.append(self.annotation(a)),
}
.append(" via ")
.append(self.expr(&arg.via, false))
.group();
let doc = doc_comments.append(doc.group()).group();

View File

@ -478,7 +478,7 @@ fn format_many_assignment_patterns() {
assert_format!(
r#"
fn backpassing() -> Int {
let
elem, accumulator, wow,
who,
@ -744,3 +744,14 @@ fn fail_expr() {
"#
);
}
#[test]
fn fuzzer_annotations() {
assert_format!(
r#"
test foo(n: Int via int()) {
todo
}
"#
);
}

View File

@ -0,0 +1,7 @@
---
source: crates/aiken-lang/src/tests/format.rs
description: "Code:\n\ntest foo(n: Int via int()) {\n todo\n}\n"
---
test foo(n: Int via int()) {
todo
}