Home / Docs / Diagnostics

U3001: Capability not in scope

Release v0.4.0

The code refers to a capability that no binding in scope holds.

Why Una rejects it

A capability operation @c.op(...) acts through the binding @c of the current capability context (spec/05 §1, §3):

U3001 reports a reference that no binding in scope holds. It also reports:

How to fix it

The repair at a glance

diff
  module demo

  capability Log
    op write(line: Text) -> Unit

  pub note(line: Text) -> Unit
-   uses @journal: Log[write]
+   uses @log: Log[write]
  =
    @log.write(line)

Failing example

una
module demo

capability Log
  op write(line: Text) -> Unit

pub note(line: Text) -> Unit
  uses @journal: Log[write]
=
  @log.write(line)

Fixed example

una
module demo

capability Log
  op write(line: Text) -> Unit

pub note(line: Text) -> Unit
  uses @log: Log[write]
=
  @log.write(line)