def differ
import bend-lint-rules@0.2.0.0/layout/format.bend as Formatimport Base
2341# Where `a` and `b` first differ: `same` is whether the characters before `at` were the same.
2342def differ(a: String, b: String, at: U32, same: Bool) -> U32:
2343 match a b same:
2344 case _ _ False{}:
2345 (at - 1: U32)
2346 case SCon{x, xs} SCon{y, ys} True{}:
2347 differ(xs, ys, (at + 1: U32), Char.is_eq(x, y))
2348 case _ _ True{}:
2349 at