Home / Docs / Diagnostics

U2013: it or error outside its allowed position

Release v0.4.0

it names the value being refined, so it appears only in a where clause and in the predicate of checked; error names the failure being handled, so it appears only in the fail or use part of an if error clause (spec/02 §8).

The repair at a glance

diff
  module demo

  pub kind Small = Int where it < 100

- pub bound(x: Small) -> Int = it
+ pub bound(x: Small) -> Int = x

Failing example

una
module demo

pub kind Small = Int where it < 100

pub bound(x: Small) -> Int = it

Fixed example

una
module demo

pub kind Small = Int where it < 100

pub bound(x: Small) -> Int = x