Home / Docs / Diagnostics

U0003: Inconsistent indentation

Release v0.4.0

Each indentation level is exactly two spaces deeper than the enclosing one, and a line that closes blocks must return to the indentation of an enclosing level (spec/01 §2). U0003 reports a line indented by an odd number of spaces relative to its block, a line more than one level deeper than the line before it, and a line dedented to a column that no enclosing block uses. The diagnostic proposes mechanical edits that re-indent the line to the nearest valid levels.

The repair at a glance

diff
  module demo

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

Failing example

una
module demo

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

Fixed example

una
module demo

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