E0015: signal_type_mismatch
E0015 signal_type_mismatch — a handler's parameter types differ from its face signal.
A compile-time error of soma check, the checker of the Soma programming language (soma explain E0015).
The rule
When an interior cell handles or awaits a signal that a sibling declares, the parameter types must agree with the sibling's signal declaration. Here Checkout sends total: Int but Fulfillment's handler takes total: String, which soma check reports as a signal type mismatch. Make the receiving handler's parameter types match the emitter's signal. (A handler that disagrees with its own cell's face is a different code, E0092.)
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_placed(order_id: String, total: Int)
}
memory {
queue: List<String> [persistent]
}
on order_placed(order_id: String, total: String) {
queue.push(order_id)
}
}
}
}What soma check prints:
$ soma check wrong.cell
error: signal type mismatch: signal 'order_placed' has incompatible parameter types between emitter and handler
--> wrong.cell:18:13
|
18 | on order_placed(order_id: String, total: String) {
| ^
= code: E0015
✗ 1 error(s), 0 warning(s).The fix field of soma check --json: signal type mismatch: signal 'order_placed' has incompatible parameter types between emitter and handler
The fix
On line 18, on order_placed(order_id: String, total: String) { becomes on order_placed(order_id: String, total: Int) {.
wrong.cell → right.cell
--- wrong.cell
+++ right.cell
@@ -16,5 +16,5 @@
queue: List<String> [persistent]
}
- on order_placed(order_id: String, total: String) {
+ on order_placed(order_id: String, total: Int) {
queue.push(order_id)
}With the fix, soma check accepts the program:
$ soma check right.cell
✓ All checks passed.