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

Comments

Projects
None yet
2 participants
@vicuna
Copy link

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

This comment has been minimized.

Copy link
Author

commented Jul 4, 2012

Comment author: @diml

Fixed. Commits 12656 and 12657.

@vicuna vicuna closed this Dec 11, 2015

@vicuna vicuna added the camlp4 label Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.