W0004: unknown_property_ref
W0004 unknown_property_ref — a cell property refers to an unknown property.
A warning of soma check, the checker of the Soma programming language (soma explain W0004).
The rule
A cell property can state rules about other properties (implies, contradicts, requires); when a rule names a property that no loaded cell property defines, soma check warns with W0004 and says the rule never applies as written. Here implies [persistant, …] was meant to make every [audited] slot persistent. Correct the name to one that exists (persistent), or define the missing property.
A program that triggers it
wrong.cell
cell property audited {
rules {
implies [persistant, immutable]
}
}
cell Ledger {
memory {
entries: List<String> [audited]
}
on record(line: String) {
entries.push(line)
return len(entries)
}
}What soma check prints:
$ soma check wrong.cell
warning: `cell property audited` implies 'persistant', which no loaded cell property defines — did you mean 'persistent'? (as written the rule never applies)
--> wrong.cell:3:9
|
3 | implies [persistant, immutable]
| ^
note: 'audited' on 'entries' implies 'immutable' (added automatically)
--> wrong.cell:9:9
|
9 | entries: List<String> [audited]
| ^
note: 'audited' on 'entries' implies 'persistant' (added automatically)
--> wrong.cell:9:9
|
9 | entries: List<String> [audited]
| ^
✓ 1 warning(s), no errors.The fix field of soma check --json: Write 'persistent' in `cell property audited`, or define 'persistant' with 'cell property persistant { }'.
The fix
On line 3, implies [persistant, immutable] becomes implies [persistent, immutable].
wrong.cell → right.cell
--- wrong.cell
+++ right.cell
@@ -1,5 +1,5 @@
cell property audited {
rules {
- implies [persistant, immutable]
+ implies [persistent, immutable]
}
}With the fix, soma check accepts the program:
$ soma check right.cell
note: 'audited' on 'entries' implies 'immutable' (added automatically)
--> right.cell:9:9
|
9 | entries: List<String> [audited]
| ^
note: 'audited' on 'entries' implies 'persistent' (added automatically)
--> right.cell:9:9
|
9 | entries: List<String> [audited]
| ^
✓ All checks passed (2 notes above).