Skip to content

Commit 7245742

Browse files
author
Jeremie Dimino
committed
fix printing of prefix operator applications
Fix printing of prefix operator applications with multiple arguments and/or labelled arguments. Old output (invalid syntax): ! 1 2 3 ! ~a:42 New output: (!) 1 2 3 (!) ~a:42
1 parent fae6354 commit 7245742

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

parsing/pprintast.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,10 +518,11 @@ class printer ()= object(self:'self)
518518
else s
519519
in
520520
(match l with
521-
|[v] -> pp f "@[<2>%s@;%a@]" s self#label_x_expression_param v
522-
| _ -> pp f "@[<2>%s@;%a@]" s
523-
(self#list self#label_x_expression_param) l
524-
(*FIXME assert false*)
521+
| [(Nolabel, _) as v] ->
522+
pp f "@[<2>%s@;%a@]" s self#label_x_expression_param v
523+
| _ ->
524+
pp f "@[<2>%a %a@]" self#simple_expr e
525+
(self#list self#label_x_expression_param) l
525526
)
526527
| _ ->
527528
pp f "@[<hov2>%a@]" begin fun f (e,l) ->

0 commit comments

Comments
 (0)