def same
bolt@1.27.0.0 · src/rules/correctness/twice.bend:42
import bolt@1.27.0.0/src/rules/correctness/twice.bend as Twice
import Base
import bolt@1.27.0.0/src/finding.bend as F
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
import bolt@1.27.0.0/src/rules/tokens.bend as T
42
43def same(aa: Maybe<&2, Lex.Tok>, bb: Maybe<&2, Lex.Tok>, +path: String) -> List<&2, F.Finding>:
44 match aa bb:
45 case Some{Lex.Tok{k, +t, l, c}} Some{Lex.Tok{k2, +t2, l2, c2}}:
46 Bool.pick(List<&2, F.Finding>, String.eq(t, t2),
47 [F.Finding{path, l2, c2, T.width(t2), "twice",
48 "This literal appears twice in one list pattern, which makes the checker hang; match one element per step."}],
49 [])
50 case a2 b2:
51 []