Skip to content

Commit 97a03a4

Browse files
committed
fix shape_of_string
1 parent 3a0b9d0 commit 97a03a4

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

compiler/lib/shape.ml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,22 @@ let of_string (s : string) =
9898
| 'F' ->
9999
next ();
100100
parse_fun ()
101-
| c -> failwith (String.make 1 c)
101+
| _ -> assert false
102102
and parse_block acc =
103-
let x = parse_shape () in
104103
match current () with
105-
| ',' ->
106-
next ();
107-
parse_block (x :: acc)
108104
| ']' ->
109105
next ();
110-
Block (List.rev (x :: acc))
111-
| _ -> assert false
106+
Block (List.rev acc)
107+
| _ -> (
108+
let x = parse_shape () in
109+
match current () with
110+
| ',' ->
111+
next ();
112+
parse_block (x :: acc)
113+
| ']' ->
114+
next ();
115+
Block (List.rev (x :: acc))
116+
| _ -> assert false)
112117
and parse_fun () =
113118
let () = parse_char '(' in
114119
let arity = parse_int 0 in

0 commit comments

Comments
 (0)