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

tools/untypeast.ml creates unary Pexp_tuple #5729

Closed
vicuna opened this issue Aug 16, 2012 · 1 comment
Closed

tools/untypeast.ml creates unary Pexp_tuple #5729

vicuna opened this issue Aug 16, 2012 · 1 comment
Assignees
Milestone

Comments

@vicuna
Copy link

@vicuna vicuna commented Aug 16, 2012

Original bug ID: 5729
Reporter: furuse
Assigned to: @lefessan
Status: closed (set by @xavierleroy on 2015-12-11T18:08:20Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.00.0
Target version: 4.00.1+dev
Fixed in version: 4.00.1+dev
Category: tools (ocaml{lex,yacc,dep,debug,...})
Related to: #5811

Bug description

There is a bug of `untyping' unary variant constructor, which creates unary tuple Parsetree node, which never appear in legal OCaml programs AFAIK.

This is found when I wrote a modified ocamlc which tries to retype once typed source code using Untypeast.

Additional information

*** ../../ocaml/ocaml-custom/tools/untypeast.ml Thu Aug 16 15:11:41 2012
--- untypeast.ml Thu Aug 16 15:11:16 2012


This simple patch fix the problem:

*** 225,230 ****
--- 225,231 ----
Pexp_construct (lid,
(match args with
[] -> None

  •         | [arg] -> Some (untype_expression arg)
            | args -> Some
                  { pexp_desc = Pexp_tuple (List.map untype_expression args);
                  pexp_loc = exp.exp_loc; }
    
@vicuna
Copy link
Author

@vicuna vicuna commented Sep 27, 2012

Comment author: @lefessan

Fixed in commit 12966.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants