Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple toplevel value pretty-printing not parsable #3594

Closed
vicuna opened this issue Aug 27, 2002 · 1 comment
Closed

simple toplevel value pretty-printing not parsable #3594

vicuna opened this issue Aug 27, 2002 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Aug 27, 2002

Original bug ID: 1355
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Jean-Marc Eber
Version: 3.06
OS: linux,win32
Submission from: parwch03-up1.sgib.com (207.45.248.21)

Hi all,

Some(-2);;

  • : int option = Some -2

Some -2;;

The constructor Some expects 1 argument(s)...

Too bad:
the value printed by the toplevel "Some -2" isn't a correct ocaml expression.

Easy fix (may be there is a more elegant?):

In /typing/oprint.ml,
add the lines marked (+)

let print_out_value ppf tree =
let rec print_tree_1 ppf =
function

  • | Oval_constr (name, [Oval_int i as param]) when i < 0 ->
  •    fprintf ppf "@[<1>%a(%a)@]" print_ident name print_simple_tree param
    
  • | Oval_constr (name, [Oval_float f as param]) when f < 0. ->
  •    fprintf ppf "@[<1>%a(%a)@]" print_ident name print_simple_tree param
    
    | Oval_constr (name, [param]) ->
    fprintf ppf "@[<1>%a@ %a@]" print_ident name print_simple_tree param
    | Oval_constr (name, (_ :: _ as params)) ->
    fprintf ppf "@[<1>%a@ (%a)@]" print_ident name
    (print_tree_list print_tree_1 ",") params
    | Oval_variant (name, Some param) ->
    fprintf ppf "@[<2>`%s@ %a@]" name print_simple_tree param
    | tree -> print_simple_tree ppf tree
    and print_simple_tree ppf =

Jean-Marc Eber

@vicuna
Copy link
Author

vicuna commented Jan 3, 2003

Comment author: administrator

fixed by PW on 2002-09-05

@vicuna vicuna closed this as completed Jan 3, 2003
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant