diff options
Diffstat (limited to 'lib/syntax/dead_end.ml')
-rw-r--r-- | lib/syntax/dead_end.ml | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/lib/syntax/dead_end.ml b/lib/syntax/dead_end.ml index 1240e72..042e640 100644 --- a/lib/syntax/dead_end.ml +++ b/lib/syntax/dead_end.ml @@ -140,24 +140,25 @@ module Instruction = struct end module Location = struct - type t = unit + type t = Report.t list type instruction = Instruction.t' - let location : S.pos -> instruction list -> t * Report.t list = + let v = Fun.id + + let location : S.pos -> instruction list -> t = fun _pos instructions -> - ( (), - List.fold_left instructions ~init:[] ~f:(fun report t -> - match (t.Instruction.is_gt, t.Instruction.pos) with - | false, Some (cause, value) -> - ignore cause; - if t.Instruction.block_pos != value then - match cause with - | Missing_else -> - Report.debug value "Possible dead end (no else fallback)" - :: report - | Unchecked_path -> - Report.warn value "Possible dead end (unmatched path)" - :: report - else report - | _ -> report) ) + List.fold_left instructions ~init:[] ~f:(fun report t -> + match (t.Instruction.is_gt, t.Instruction.pos) with + | false, Some (cause, value) -> + ignore cause; + if t.Instruction.block_pos != value then + match cause with + | Missing_else -> + Report.debug value "Possible dead end (no else fallback)" + :: report + | Unchecked_path -> + Report.warn value "Possible dead end (unmatched path)" + :: report + else report + | _ -> report) end |