soma.cell

E0088: interior_call

E0088 interior_call — a call into an interior cell from outside its parent.

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

The rule

A cell declared inside another cell's interior { } is not registered by name: it is driven by its siblings' signals, and Picker.pick(...) from outside would raise undefined variable: Picker at run time. Check refuses the call. Make the cell top-level if other cells must call it, as in the fix, or drive it with a signal from inside its parent.

A program that triggers it

wrong.cell

cell Warehouse {
    interior {
        cell Picker {
            face { signal pick(sku: String) }
            memory {
                queue: List<String> [persistent]
            }
            on pick(sku: String) {
                queue.push(sku)
            }
        }
    }
    runtime { signal pick("sku-42") }
}

cell Orders {
    on place(sku: String) {
        Picker.pick(sku)
        return sku
    }
}

What soma check prints:

$ soma check wrong.cell
error: `Picker.pick(…)`: 'Picker' is a cell inside the `interior { }` of 'Warehouse' — those are driven by a sibling's signals, never called by name (calling it raises `undefined variable: Picker` at run time)
  --> wrong.cell:18:9
   |
18 |         Picker.pick(sku)
   |         ^
  = code: E0088
✗ 1 error(s), 0 warning(s).

The fix field of soma check --json: those are driven by a sibling's signals, never called by name (calling it raises `undefined variable: Picker` at run time)

Lines 1–11 are rewritten; line 13 is rewritten.

wrong.cell → right.cell

--- wrong.cell
+++ right.cell
@@ -1,15 +1,9 @@
-cell Warehouse {
-    interior {
-        cell Picker {
-            face { signal pick(sku: String) }
-            memory {
-                queue: List<String> [persistent]
-            }
-            on pick(sku: String) {
-                queue.push(sku)
-            }
-        }
+cell Picker {
+    memory {
+        queue: List<String> [persistent]
     }
-    runtime { signal pick("sku-42") }
+    on pick(sku: String) {
+        queue.push(sku)
+    }
 }
 

With the fix, soma check accepts the program:

$ soma check right.cell
✓ All checks passed.