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

Camlp4 produces invalid syntax for "let _ = ..." #5668

Closed
vicuna opened this issue Jul 4, 2012 · 1 comment
Closed

Camlp4 produces invalid syntax for "let _ = ..." #5668

vicuna opened this issue Jul 4, 2012 · 1 comment
Assignees

Comments

@vicuna
Copy link

@vicuna vicuna commented Jul 4, 2012

Original bug ID: 5668
Reporter: @alainfrisch
Assigned to: @diml
Status: closed (set by @xavierleroy on 2015-12-11T18:07:05Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 4.00.0+dev
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues

Bug description

The following code, taken from pa_js.ml in js_of_ocaml, creates a fragment which produces a syntax error (when Camlp4 prints the AST as source code):

let constr =
  let y = random_var () in
  let body =
    let o = <:expr< $lid:y$ >> in
    let _loc = m_loc in <:expr< ($o$#$m$ : $m_typ$) >>
  in
  <:expr< fun ($lid:y$ : $obj_type$) -> $body$ >>
in
<:expr< let $lid:x$ = $obj$ in
        let _ = $constr$ in
        $f x$ >>

The pre-processed code looks like:

let _ (foo : 'a) = ...

which is not valid OCaml syntax.

@vicuna
Copy link
Author

@vicuna vicuna commented Jul 4, 2012

Comment author: @diml

Fixed. Commits 12656 and 12657.

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

Successfully merging a pull request may close this issue.

None yet
2 participants