✓
Passing Passing: the compiler rejects this program as expected.
Code
// `fold` on a binding whose node kind can't be resolved refuses with the
// same provenance teaching `dispose` gives.
import std/tree
std/tree:node(Node) { item: i64, left: ?Node }
pub tor mk { } -> i64
mk = if(true)
| then -> 1
| else -> 0
mk(): t
|> std/tree:fold(t, as: i64): c
| node n -> n.item + n.left
| null -> 0
Actual compiler output
error[KORU184]: std/tree:fold(t): can't resolve which node kind 't' is — bind it from a std/tree:mint, a tor returning *X<owned!>, or declare the parameter `*X<...>` for a node-registered X
--> tests/regression/600_STDLIB/682_TREE/682_017_fold_unresolvable_binding/input.k:13:1Must contain:
KORU184Flows
flow ~node click a branch to expand · @labels scroll to their anchor
node (Node, source: item: i64, left: ?Node)
subflow ~mk click a branch to expand · @labels scroll to their anchor
if (true)
flow ~mk click a branch to expand · @labels scroll to their anchor
mk
Test Configuration
MUST_ERROR