Skip to content

Commit

Permalink
Fix crash on extension sequence (#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetiot authored Aug 29, 2019
1 parent d82bc96 commit e9b0a92
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Fmt_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2251,7 +2251,8 @@ and fmt_expression c ?(box = true) ?pro ?epi ?eol ?parens ?(indent_wrap = 0)
; pstr_loc= _ } ] )
when List.is_empty pexp_attributes
&& ( Poly.(c.conf.extension_sugar = `Always)
|| Source.extension_using_sugar ~name:ext ~payload:e1 ) ->
|| Source.extension_using_sugar ~name:ext ~payload:e1
&& List.length (Sugar.sequence c.conf c.cmts xexp) > 1 ) ->
fmt_sequence c parens width xexp pexp_loc fmt_atrs ~ext
| Pexp_sequence _ ->
fmt_sequence c parens width xexp pexp_loc fmt_atrs ?ext
Expand Down
2 changes: 2 additions & 0 deletions test/passing/extensions-indent.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,5 @@ let _ =
[%ext
let+ a = b in
c]

let _ = [%ext "foo" ; "bar"]
2 changes: 2 additions & 0 deletions test/passing/extensions-sugar_always.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,5 @@ let _ =
[%ext
let+ a = b in
c]

let _ = "foo" ;%ext "bar"
2 changes: 2 additions & 0 deletions test/passing/extensions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,5 @@ let foo =
foooooooooooooooooooooooooooo]

let _ = [%ext let+ a = b in c]

let _ = (begin%ext "foo"; "bar" end)
2 changes: 2 additions & 0 deletions test/passing/extensions.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,5 @@ let _ =
[%ext
let+ a = b in
c]

let _ = [%ext "foo" ; "bar"]

0 comments on commit e9b0a92

Please sign in to comment.