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

camlp4o wrongly reports the location of Pexp_ident #6170

Closed
vicuna opened this issue Sep 11, 2013 · 3 comments
Closed

camlp4o wrongly reports the location of Pexp_ident #6170

vicuna opened this issue Sep 11, 2013 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Sep 11, 2013

Original bug ID: 6170
Reporter: furuse
Assigned to: @bobzhang
Status: closed (set by @xavierleroy on 2015-12-11T18:24:07Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.01.0+beta/+rc
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues

Bug description

It seems that camlp4o's locations for identifiers are not cover the all Longident.ts but only point to the last Lident compoments.

For example, X.x is parsed by camlp4o as Pexp_ident {loc}, where loc only points the part of 'x', not the whole 'X.x'.

This requires a workaround of handling identifier's locations for applications which utilize cmt files like ocamlspotter and probably Typerex.

@vicuna
Copy link
Author

vicuna commented Sep 11, 2013

Comment author: @bobzhang

This should be fixable, would you mind upload a minimal example?

@vicuna
Copy link
Author

vicuna commented Sep 12, 2013

Comment author: furuse

Compile the following:


module X = struct
let x = 1
end

let _ = X.x

With ocamlc -dparsetree x.ml and ocamlc -dparsetree -pp camlp4o x.ml .

Then you can see the location difference of Pexp_ident "X.x". Preprocessed version has only 1 char width for "X.x".

@vicuna
Copy link
Author

vicuna commented Sep 12, 2013

Comment author: @bobzhang

Thanks for your reporting. Fixed in revision 14116

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

1 participant