W0003: unknown_property
W0003 unknown_property — a slot property nothing defines.
A warning of soma check, the checker of the Soma programming language (soma explain W0003).
The rule
A memory slot's properties in [...] must be ones Soma or a loaded cell property defines; an unknown name is not an error, but it does nothing, and soma check warns with W0003 and suggests the closest known property. A misspelled [persistant] therefore leaves the slot without the persistence the programmer meant. Correct the spelling ([persistent]), or define the property with cell property persistant { } if it really is your own.
A program that triggers it
wrong.cell
cell Inventory {
memory {
stock: Map<String, Int> [persistant]
}
on restock(sku: String, qty: Int) {
let next = (stock.get(sku) ?? 0) + qty
stock.set(sku, next)
return next
}
}What soma check prints:
$ soma check wrong.cell
warning: unknown property 'persistant' on 'stock' — did you mean 'persistent'? (it is not defined in any loaded cell property, so it does nothing)
--> wrong.cell:3:34
|
3 | stock: Map<String, Int> [persistant]
| ^
✓ 1 warning(s), no errors.The fix field of soma check --json: Write 'persistent' on slot 'stock', or, if 'persistant' is a property of your own, define it with 'cell property persistant { }'.
The fix
On line 3, stock: Map<String, Int> [persistant] becomes stock: Map<String, Int> [persistent].
wrong.cell → right.cell
--- wrong.cell
+++ right.cell
@@ -1,5 +1,5 @@
cell Inventory {
memory {
- stock: Map<String, Int> [persistant]
+ stock: Map<String, Int> [persistent]
}
on restock(sku: String, qty: Int) {With the fix, soma check accepts the program:
$ soma check right.cell
✓ All checks passed.