Fix formatter getting rid of curly braces around multi-line constants.
This commit is contained in:
parent
0c0369ad61
commit
616dec8f03
|
@ -12,6 +12,7 @@
|
||||||
- **aiken-lang**: Fix list-pattern needlessly formatting over multiple lines. @KtorZ
|
- **aiken-lang**: Fix list-pattern needlessly formatting over multiple lines. @KtorZ
|
||||||
- **aiken-lang**: Fix formatter on long alternative patterns spanning over multiple lines. @KtorZ
|
- **aiken-lang**: Fix formatter on long alternative patterns spanning over multiple lines. @KtorZ
|
||||||
- **aiken-lang**: Fix needed parentheses under trace-if-false operator for todo, fail, unop & pipelines; removed when formatting. @KtorZ
|
- **aiken-lang**: Fix needed parentheses under trace-if-false operator for todo, fail, unop & pipelines; removed when formatting. @KtorZ
|
||||||
|
- **aiken-lang**: Fix formatter removing curly braces around multi-line constants. It's fine to not have curly braces, but it's the Aiken signature after all. @KtorZ
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ impl<'comments> Formatter<'comments> {
|
||||||
|
|
||||||
head.append(" =")
|
head.append(" =")
|
||||||
.append(break_("", " "))
|
.append(break_("", " "))
|
||||||
.append(self.expr(value, true))
|
.append(self.expr(value, false))
|
||||||
.nest(INDENT)
|
.nest(INDENT)
|
||||||
.group()
|
.group()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1340,3 +1340,15 @@ fn trace_if_false_fail() {
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn multiline_constant() {
|
||||||
|
assert_format!(
|
||||||
|
r#"
|
||||||
|
const n: Int = {
|
||||||
|
let x = 0
|
||||||
|
x + 1
|
||||||
|
}
|
||||||
|
"#
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
source: crates/aiken-lang/src/tests/format.rs
|
||||||
|
description: "Code:\n\nconst n: Int = {\n let x = 0\n x + 1\n}\n"
|
||||||
|
---
|
||||||
|
const n: Int = {
|
||||||
|
let x = 0
|
||||||
|
x + 1
|
||||||
|
}
|
Loading…
Reference in New Issue