Skip to content

Commit

Permalink
fix non-exhaustiveness in scanf.ml, caused by the fixing of PR#7390
Browse files Browse the repository at this point in the history
  • Loading branch information
garrigue committed Oct 19, 2016
1 parent 958d234 commit 5fa0eed
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions stdlib/scanf.ml
Expand Up @@ -1299,9 +1299,9 @@ fun k ign fmt -> match ign with
take_format_readers, and aggegate scanned values into an
heterogeneous list. *)
(* Return the heterogeneous list of scanned values. *)
let rec make_scanf : type a c d e f .
let rec make_scanf : type a c d e f.
Scanning.in_channel -> (a, Scanning.in_channel, c, d, e, f) fmt ->
(d, _) heter_list -> (a, f) heter_list =
(d, e) heter_list -> (a, f) heter_list =
fun ib fmt readers -> match fmt with
| Char rest ->
let _ = scan_char 0 ib in
Expand Down Expand Up @@ -1368,9 +1368,13 @@ fun ib fmt readers -> match fmt with
| Custom _ ->
invalid_arg "scanf: bad conversion \"%?\" (custom converter)"
| Reader fmt_rest ->
let Cons (reader, readers_rest) = readers in
let x = reader ib in
Cons (x, make_scanf ib fmt_rest readers_rest)
begin match readers with
| Cons (reader, readers_rest) ->
let x = reader ib in
Cons (x, make_scanf ib fmt_rest readers_rest)
| Nil ->
invalid_arg "scanf: missing reader"
end
| Flush rest ->
if Scanning.end_of_input ib then make_scanf ib rest readers
else bad_input "end of input not found"
Expand Down Expand Up @@ -1460,7 +1464,7 @@ fun ib fmt readers -> match fmt with
(* Pass padding and precision to the generic scanner `scan'. *)
and pad_prec_scanf : type a c d e f x y z t .
Scanning.in_channel -> (a, Scanning.in_channel, c, d, e, f) fmt ->
(d, _) heter_list -> (x, y) padding -> (y, z -> a) precision ->
(d, e) heter_list -> (x, y) padding -> (y, z -> a) precision ->
(int -> int -> Scanning.in_channel -> t) ->
(Scanning.in_channel -> z) ->
(x, f) heter_list =
Expand Down

1 comment on commit 5fa0eed

@gasche
Copy link
Member

@gasche gasche commented on 5fa0eed Oct 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is exactly the fix that I was just thinking of after looking at the code.

Please sign in to comment.