E0013: unmatched_await
E0013 unmatched_await — an await names a signal nothing sends.
A compile-time error of soma check, the checker of the Soma programming language (soma explain E0013).
The rule
Inside an interior block, sibling cells are wired by name: an await x(…) in one cell's face must match a signal x(…) that a sibling declares. soma check reports an await that no sibling emits (here order_paid, while Checkout only emits order_placed), since it would never be delivered. Await the signal a sibling actually declares, or add that signal to the sibling that should send it.
A program that triggers it
wrong.cell
cell Shop {
interior {
cell Checkout {
face {
signal order_placed(order_id: String, total: Int)
}
on order_placed(order_id: String, total: Int) {
return order_id
}
}
cell Fulfillment {
face {
await order_paid(order_id: String, total: Int)
}
memory {
queue: List<String> [persistent]
}
on order_placed(order_id: String, total: Int) {
queue.push(order_id)
}
}
}
}What soma check prints:
$ soma check wrong.cell
warning: cell 'Fulfillment' declares await 'order_paid' but has no handler for it (will it be delivered via bus?)
--> wrong.cell:13:17
|
13 | await order_paid(order_id: String, total: Int)
| ^
error: unmatched await: cell 'Fulfillment' awaits signal 'order_paid' but no sibling emits it
--> wrong.cell:13:17
|
13 | await order_paid(order_id: String, total: Int)
| ^
= code: E0013
✗ 1 error(s), 1 warning(s).The fix field of soma check --json: unmatched await: cell 'Fulfillment' awaits signal 'order_paid' but no sibling emits it
The fix
On line 13, await order_paid(order_id: String, total: Int) becomes await order_placed(order_id: String, total: Int).
wrong.cell → right.cell
--- wrong.cell
+++ right.cell
@@ -11,5 +11,5 @@
cell Fulfillment {
face {
- await order_paid(order_id: String, total: Int)
+ await order_placed(order_id: String, total: Int)
}
memory {With the fix, soma check accepts the program:
$ soma check right.cell
✓ All checks passed.