E0049: unknown_handler_property
E0049 unknown_handler_property — an unknown handler annotation.
A compile-time error of soma check, the checker of the Soma programming language (soma explain E0049).
The rule
A handler annotation in brackets after the parameter list must be one of [native], [task], [deterministic] or [record]. A misspelt annotation such as [nativ] is refused rather than ignored, because the handler would otherwise silently run without it. Fix the spelling; the message suggests the closest known annotation.
A program that triggers it
wrong.cell
cell Loans {
face {
signal monthly_interest(balance_cents: Int, rate_bps: Int, months: Int) -> Int
}
on monthly_interest(balance_cents: Int, rate_bps: Int, months: Int) [nativ] {
let total = 0
for m in range(0, months) {
total = total + idiv(balance_cents * rate_bps, 120000)
}
return total
}
}What soma check prints:
$ soma check wrong.cell
error: unknown handler annotation [nativ] on `monthly_interest` — did you mean [native]? (known: [native], [task], [deterministic], [record])
--> wrong.cell:5:5
|
5 | on monthly_interest(balance_cents: Int, rate_bps: Int, month…
| ^
= code: E0049
✗ 1 error(s), 0 warning(s).The fix field of soma check --json: did you mean [native]? (known: [native], [task], [deterministic], [record])
The fix
On line 5, on monthly_interest(balance_cents: Int, rate_bps: Int, months: Int) [nativ] { becomes on monthly_interest(balance_cents: Int, rate_bps: Int, months: Int) [native] {.
wrong.cell → right.cell
--- wrong.cell
+++ right.cell
@@ -3,5 +3,5 @@
signal monthly_interest(balance_cents: Int, rate_bps: Int, months: Int) -> Int
}
- on monthly_interest(balance_cents: Int, rate_bps: Int, months: Int) [nativ] {
+ on monthly_interest(balance_cents: Int, rate_bps: Int, months: Int) [native] {
let total = 0
for m in range(0, months) {With the fix, soma check accepts the program:
$ soma check right.cell
✓ All checks passed.