Bug correction in Mls_printer and Hept_printer
Correction of infix operators printing : infix printing only when two arguments of pervasives infix operators (no assertions on number of arguments).
This commit is contained in:
parent
f696203eb1
commit
71f7db2d11
2 changed files with 19 additions and 6 deletions
|
@ -194,9 +194,14 @@ and print_app ff (app, args) =
|
|||
| Efun { name = n } when (n = "*" or n = "*.") ->
|
||||
let a1, a2 = assert_2 args in
|
||||
fprintf ff "@[%a@, %s@, %a@]" print_exp a1 n print_exp a2
|
||||
| Efun { qual = Pervasives; name = n } when (is_infix n) ->
|
||||
let a1, a2 = assert_2 args in
|
||||
fprintf ff "@[(%a@, %s@, %a)@]" print_exp a1 n print_exp a2
|
||||
| Efun ({ qual = Pervasives; name = n } as f) when (is_infix n) ->
|
||||
begin match args with
|
||||
[a1;a2] ->
|
||||
fprintf ff "@[(%a@, %s@, %a)@]" print_exp a1 n print_exp a2
|
||||
| _ ->
|
||||
fprintf ff "@[%a@,%a@,%a@]"
|
||||
print_qualname f print_params app.a_params print_exp_tuple args
|
||||
end
|
||||
| Efun f ->
|
||||
fprintf ff "@[%a@,%a@,%a@]"
|
||||
print_qualname f print_params app.a_params print_exp_tuple args
|
||||
|
|
|
@ -154,9 +154,17 @@ and print_app ff (app, args) =
|
|||
| Eequal ->
|
||||
let e1, e2 = assert_2 args in
|
||||
fprintf ff "@[<2>%a@ = %a@]" print_extvalue e1 print_extvalue e2
|
||||
| Efun { qual = Pervasives; name = n } when (is_infix n) ->
|
||||
let a1, a2 = assert_2 args in
|
||||
fprintf ff "@[(%a@, %s@, %a)@]" print_extvalue a1 n print_extvalue a2
|
||||
| Efun ({ qual = Pervasives; name = n } as f) when (is_infix n) ->
|
||||
begin match args with
|
||||
[a1;a2] ->
|
||||
fprintf ff "@[(%a@, %s@, %a)@]"
|
||||
print_extvalue a1
|
||||
n
|
||||
print_extvalue a2
|
||||
| _ ->
|
||||
fprintf ff "@[%a@,%a@,%a@]"
|
||||
print_qualname f print_params app.a_params print_w_tuple args
|
||||
end
|
||||
| Efun f | Enode f ->
|
||||
fprintf ff "@[%a@,%a@,%a@]"
|
||||
print_qualname f print_params app.a_params print_w_tuple args
|
||||
|
|
Loading…
Reference in a new issue