Home / Docs / Diagnostics

U2002: Unknown or ill-formed type

Release v0.4.0

U2002 reports a written type that is unknown or ill-formed.

Why Una rejects it

A written type names a built-in type, a kind or a type parameter (spec/03). U2002 reports:

A refined kind or a range written as a type argument, as List[Pos], is U2002 in editions 0.1 and 0.2 (ADR 0040). Edition 0.3 accepts it and proves the refinement of every element where values are built (ADR 0103).

How to fix it

For a recursive field, the diagnostic carries an edit that makes the field optional.

The repair at a glance

diff
  module demo

  pub kind Node
    value: Int
-   next: Node
+   next: Option[Node]

Failing example

una
module demo

pub kind Node
  value: Int
  next: Node

Fixed example

una
module demo

pub kind Node
  value: Int
  next: Option[Node]