def key_err
import bend-schema-lib@0.4.1.0/core.bend as Coreimport Base
471# The repeated key as check reports it: at the key's own name, with no step
472# after it (the second occurrence is not a place in the schema). The test is
473# passed in rather than read here (a match cannot scrutinize a computed value):
474# b is key_once(name, r), so nothing is reported exactly when key_once holds,
475# which is what check_exact needs.
476def key_err(b: Bool, +name: String) -> Maybe<&2, Err>:
477 match b:
478 case True{}:
479 None{}
480 case False{}:
481 Some{Err{AtField{0n, name} <> Nil{}, RepeatedKey{name}}}