Enforce newline after assignment / clause.

This leads to more consistent formatting across entire Aiken programs.
  Before that commit, only long expressions would be formatted on a
  newline, causing non-consistent formatting and additional reading
  barrier when looking at source code.

  Programs also now take more vertical space, which is better for more
  friendly diffing in version control systems (especially git).
This commit is contained in:
KtorZ
2023-03-16 19:42:57 +01:00
parent bf9297efcf
commit 20f5baffa7
60 changed files with 998 additions and 548 deletions

View File

@@ -1,33 +1,47 @@
test foo_1() {
let a = False
let a =
False
when a is {
a if a -> False
_ -> True
a if a ->
False
_ ->
True
}
}
test foo_2() {
let point = (14, 42)
let point =
(14, 42)
when point is {
(x, _) if x > 100 -> False
(x, _) if x > 10 -> True
_ -> False
(x, _) if x > 100 ->
False
(x, _) if x > 10 ->
True
_ ->
False
}
}
test foo_3() {
let point = (14, 42)
let point =
(14, 42)
when point is {
(x, y) if x == 14 && y <= 100 -> True
_ -> False
(x, y) if x == 14 && y <= 100 ->
True
_ ->
False
}
}
test foo_4() {
let a = False
let point = (14, 42)
let a =
False
let point =
(14, 42)
when point is {
(x, y) if !a -> x + y == 56
_ -> False
(x, y) if !a ->
x + y == 56
_ ->
False
}
}

View File

@@ -1,6 +1,7 @@
fn when_tuple(a: (Int, Int)) -> Int {
when a is {
(a, b) -> a
(a, b) ->
a
}
}