Add tailrec annotation to walkPaths.