Skip to content
Playground(another site)

bynk.resolve.unconsumed_context

Error A context's service was called, or its capability named in given, without a consumes declaration.

A call such as platform.pay.charge(1) reaches into another context, and a context may only do that to one it has declared with consumes. The declaration is what makes a dependency between contexts visible and checked, instead of a name that happens to resolve. The same code is reported for a given platform.pay.Cap whose context is not consumed. Add consumes platform.pay (with an alias, if you want to call it by another name) at the top of the calling context. A consumed context that does not export a capability is bynk.given.cross_context_unknown_capability.

Example

app/shop.bynk
context app.shop
service checkout {
on call() -> Effect[Int] by Caller {
platform.pay.charge(1) // ✗ `platform.pay` is not in this context's `consumes`
}
}
context app.shop
consumes platform.pay // ✓ declared at the top

In the Book

See also

  • The grammar rule it governs: consumes_decl.
  • Every code in its category, Resolution, on the diagnostic index.
  • bynk explain bynk.resolve.unconsumed_context shows the same from the installed toolchain, without a network.