Home / Docs / Diagnostics

U7001: Non-canonical formatting

Release v0.4.0

A region of a file differs from the file's canonical form. una check compares each file with its canonical form and reports U7001 for every region that differs.

Why Una rejects it

Every Una program has one canonical form (ADR 0011, ADR 0020):

A file with syntax errors is checked for U7001 once they are fixed.

How to fix it

una check reports each region with a mechanical edit that replaces the region. una fmt rewrites whole files, and una fmt --check reports without writing. The formatter keeps every comment on its line.

The repair at a glance

diff
  module demo

- pub double(x: Int) -> Int
- =
-   x * 2
+ pub double(x: Int) -> Int = x * 2

Failing example

una
module demo

pub double(x: Int) -> Int
=
  x * 2

Fixed example

una
module demo

pub double(x: Int) -> Int = x * 2