soma.cell

E0046: unknown_type

E0046 unknown_type — a type name nothing declares.

A compile-time error of soma check, the checker of the Soma programming language (soma explain E0046).

The rule

A parameter, return or slot type uses a name that is not declared but is close to a built-in type or is a common alias from another language, such as Integer, Text, Boolean or Dict. Soma refuses it because an undeclared type name would accept any value at run time. Use the Soma type the message suggests (Int, String, Bool, Map, …). Any other undeclared name (q: Lots with no cell type Lots), and a parameterised scalar such as Int<lots>, which checks nothing, are warning W0018 in edition 2026 and this error in edition 2027.

A program that triggers it

wrong.cell

cell Inventory {
    face {
        signal restock(sku: String, qty: Integer) -> Int
    }
    memory {
        stock: Map<String, Int> [persistent]
    }
    on restock(sku: String, qty: Integer) {
        let level = (stock.get(sku) ?? 0) + qty
        stock.set(sku, level)
        return level
    }
}

What soma check prints:

$ soma check wrong.cell
error: unknown type `Integer` — did you mean `Int`? (an undeclared type name would accept any value)
  --> wrong.cell:3:9
  |
3 |         signal restock(sku: String, qty: Integer) -> Int
  |         ^
  = code: E0046
✗ 1 error(s), 0 warning(s).

The fix field of soma check --json: did you mean `Int`? (an undeclared type name would accept any value)

On line 3, signal restock(sku: String, qty: Integer) -> Int becomes signal restock(sku: String, qty: Int) -> Int; on line 8, on restock(sku: String, qty: Integer) { becomes on restock(sku: String, qty: Int) {.

wrong.cell → right.cell

--- wrong.cell
+++ right.cell
@@ -1,10 +1,10 @@
 cell Inventory {
     face {
-        signal restock(sku: String, qty: Integer) -> Int
+        signal restock(sku: String, qty: Int) -> Int
     }
     memory {
         stock: Map<String, Int> [persistent]
     }
-    on restock(sku: String, qty: Integer) {
+    on restock(sku: String, qty: Int) {
         let level = (stock.get(sku) ?? 0) + qty
         stock.set(sku, level)

With the fix, soma check accepts the program:

$ soma check right.cell
✓ All checks passed.