| /-! | |
| Tests that a list, array or vector literal with one element and a trailing comma gets the same | |
| layout as the literal without the comma. The formatter drops the comma, so a different layout | |
| would change again when the output is formatted a second time. | |
| -/ | |
| def pairs : Array (Nat × Nat) := #[( | |
| 1111111111111111111111111111111111111111111111111, | |
| 2222222222222222222222222222222222222222222222222222222222222222222222 | |
| )] | |
| def pairsWithoutComma : Array (Nat × Nat) := #[( | |
| 1111111111111111111111111111111111111111111111111, | |
| 2222222222222222222222222222222222222222222222222222222222222222222222 | |
| )] | |
| def nested : List (List Nat) := [[ | |
| 1111111111111111111111111111111111111111111111111, | |
| 2222222222222222222222222222222222222222222222222222222222222222222222, 3 | |
| ]] | |
| structure Point where | |
| x : Nat | |
| y : Nat | |
| def points : Array Point := #[{ | |
| x := 1111111111111111111111111111111111111111111111111 | |
| y := 2222222222222222222222222222222222222222222222222222222222222 | |
| }] | |
| def vector : Vector (Nat × Nat) 1 := #v[( | |
| 1111111111111111111111111111111111111111111111111, | |
| 2222222222222222222222222222222222222222222222222222222222222222222 | |
| )] | |
| -- A short element. | |
| def short : Array Nat := #[1] | |
| -- An application as the element needs the general layout, with and without the comma. | |
| def app (f : Nat → Nat → Nat) : Array Nat := #[ | |
| f 1111111111111111111111111111111111111111111111111 | |
| 2222222222222222222222222222222222222222222222222222222222222222222222 | |
| ] | |
| -- A comment after the trailing comma. | |
| def withComment : Array (Nat × Nat) := #[( | |
| 1111111111111111111111111111111111111111111111111, | |
| 2222222222222222222222222222222222222222222222222222222222222222222222 | |
| )] -- comment | |
| -- Several elements with a trailing comma. | |
| def several : Array Nat := #[ | |
| 1111111111111111111111111111111111111111111111111, | |
| 2222222222222222222222222222222222222222222222222222222222222222222222, 3 | |
| ] |