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

The default ast mapper should explicitly specify the mapping order. (ast_mapper.ml) #6936

Closed
vicuna opened this issue Jul 22, 2015 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Jul 22, 2015

Original bug ID: 6936
Reporter: @hhugo
Assigned to: @alainfrisch
Status: resolved (set by @alainfrisch on 2016-12-08T15:46:03Z)
Resolution: suspended
Priority: normal
Severity: feature
Version: 4.02.2
Target version: later
Category: standard library
Monitored by: @Drup @diml

Bug description

The order is currently unspecified.
ie:

    | Ptyp_arrow (lab, t1, t2) ->
        arrow ~loc ~attrs lab (sub.typ sub t1) (sub.typ sub t2)

should be written

    | Ptyp_arrow (lab, t1, t2) ->
        let t1' = sub.typ sub t1 in
        let t2' = sub.typ sub t2 in
        arrow ~loc ~attrs lab t1' t2'

Additional information

similar issue in ppx_tools ocaml-ppx/ppx_tools#27

@vicuna
Copy link
Author

vicuna commented Jul 23, 2015

Comment author: @alainfrisch

It's probably a good idea, although it will not guarantee that terms are traversed in the same ordering as they appear in the source code. For instance:

let x : int = 3

gives the same Parsetree (modulo locations) as:

let x = (3 : int)

And the natural traversal order (based on the Parsetree representation) will go over expression "3" before type "int".

@vicuna
Copy link
Author

vicuna commented Dec 8, 2016

Comment author: @alainfrisch

Marking as suspended, since it's a rather tedious change and the benefit is not so clear to me (esp. considering my remark that the traversal order would still not necessarily match source code locations). Feel free to submit a PR, though!

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