~/bend-docscommunity

src/rules/correctness/twice.bend fails

raw source on the hub · import 0xde9bb08f7de298b03207fb5797ede9a5/src/rules/correctness/twice.bend as Twice

rule twice: a list pattern in a def that calls itself, opening with the same literal twice (case 10 <> 10 <> _:, case Con{'a', Con{'a', t}}:). The checker hangs on it (pi-bend BEND-018, b6a83a52; bend 2.0.16 still does). Only the opening pair was seen to hang: 10 <> 11 <> 10, _ <> 10 <> 10 and 10 <> 11 <> 11 check at once, and so does the same pattern in a def that does not recurse. Match one element per step, with a state. A def recurses when its body calls it, name(..): a parameter or a value named like the def is not a call. Only a case's first match column is read: a list pattern in a later column of match a b: is not.

9 imports
import Base
import ../../src.bend as Src
import ../../finding.bend as F
import ../../syntax/lex.bend as Lex
import ../../syntax/tree.bend as Tree
import ../../syntax/bind.bend as Bind
import ../../lazy/lazy.bend as Lazy
import ../tokens.bend as T
import ../calls.bend as Calls