def tag_key_defect

bend-schema-lib@0.4.1.0 · core.bend:1179

import bend-schema-lib@0.4.1.0/core.bend as Core
import Base

1179# The tag key of a tagged case, taken twice, as defect replays it. check
1180# reports it before the case's own schema is walked -- there is no place in the
1181# schema for the second occurrence -- so the path is one field step at the
1182# tag's own name and nothing after it. b is whether the key is not read once,
1183# so nothing is reported exactly when key_once holds; a path of any other shape
1184# is the case's own report, which the walk below answers.
1185def tag_key_defect(b: Bool, +k: String, p: List<&2, Step>) -> Maybe<&2, Why>:
1186  match b p:
1187    case False{} q:
1188      None{}
1189    case True{} AtField{0n, +j} <> Nil{}:
1190      pick_why(String.eq(j, k), Some{RepeatedKey{k}}, None{})
1191    case True{} q:
1192      None{}

Uses (9)

Used by (1)