Home / Docs / Diagnostics

U1006: Undeclared requirement in derived from

Release v0.4.0

A derived from clause traces a function to the requirements it implements (spec/08 §1). Every identifier it lists must be declared by a requirement somewhere in the package, so that una trace can connect the contract to its origin. Declare the requirement, with its text, source, owner and status, or correct the identifier.

The repair at a glance

diff
  module demo

+ requirement EVENTS_3
+   text "An event with no remaining seats is always shown as sold out"
+   source policy "Box Office Handbook 2.1"
+   owner box_office
+   status active
+
  pub sold_out(remaining: Int) -> Bool
    derived from EVENTS_3
  =
    remaining < 1

Failing example

una
module demo

pub sold_out(remaining: Int) -> Bool
  derived from EVENTS_3
=
  remaining < 1

Fixed example

una
module demo

requirement EVENTS_3
  text "An event with no remaining seats is always shown as sold out"
  source policy "Box Office Handbook 2.1"
  owner box_office
  status active

pub sold_out(remaining: Int) -> Bool
  derived from EVENTS_3
=
  remaining < 1