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

ppx generates badly typed code #416

Closed
zoggy opened this issue Feb 1, 2016 · 2 comments
Closed

ppx generates badly typed code #416

zoggy opened this issue Feb 1, 2016 · 2 comments

Comments

@zoggy
Copy link
Contributor

zoggy commented Feb 1, 2016

Hello,

Current version of ppx processor generates code for method calls which does not compile.

Example:

$ cat > j.ml
let doc = Dom_html.window##document;;
^D
$ ocamlfind ocamlc -c -package js_of_ocaml.ppx j.ml
File "j.ml", line 1, characters 10-35:
Error: This expression has type
         Dom_html.document Js.t Js.readonly_prop =
           < get : Dom_html.document Js.t > Js.gen_prop
       but an expression was expected of type 'jsoo_32b5ee21 Js.meth

Examples could make use of the ppx extension to detect these problems as soon as possible.

@hhugo
Copy link
Member

hhugo commented Feb 1, 2016

the ppx syntax for property access is ##. https://github.com/ocsigen/js_of_ocaml/blob/master/lib/ppx/ppx_js.mli#L19

let doc = Dom_html.window##.document

@hhugo
Copy link
Member

hhugo commented Feb 1, 2016

note that the syntax for method call has changed as well.
camlp4 x##m(a,b,c) translates to ppx x##m a b c or x##(m a b c)

@hhugo hhugo closed this as completed Feb 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants