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
wrong location inside alias patterns #5114
Comments
Comment author: Hendrik Tews Same problem for "exception A of int". Here "A" gets the location |
Comment author: Hendrik Tews Same for "exception A of int" in interfaces or signatures. |
Comment author: Hendrik Tews Same for "type t = { a : int }". Here "a" gets the location of "a : int". If the field is "mutable a : int" then the location of "a" covers "mutable as well. Happens in interfaces and implementations. |
Comment author: Hendrik Tews Same for "class type virtual ['a] t = ... Here the location for t starts with "virtual". Happens also in interfaces for class types and classes. |
Comment author: Hendrik Tews Same for "class virtual ['a] t = ... in structures. Here the location of "t" starts with virtual. |
Comment author: Hendrik Tews Same for infix operators: for "let ( *** ) ..." the location for "***" contains the parenthesis'. |
Comment author: Hendrik Tews Hi, I added a first patch that fixes the locations inside exceptions. The uploaded patch is a diff against the distributed version Hendrik |
Comment author: Hendrik Tews I uploaded a new patch (against 4.00 branch) that fixes the problem for exceptions in structures and signatures (notes 5622 and 5623). This patch only contains the diff for the real parser sources and not for the generated code in camlp4/boot. |
Comment author: @damiendoligez For infix operators, I think this is on purpose. The standard parser also does that, and more generally if an expression is enclosed in parentheses, its location includes the parentheses. We could discuss whether that is a good thing, but for the moment you might want to keep camlp4 as close as possible to the standard parser. |
Comment author: @damiendoligez Transferred to camlp4/camlp4#71 |
Original bug ID: 5114
Reporter: Hendrik Tews
Assigned to: @xclerc
Status: closed (set by @damiendoligez on 2015-01-09T18:55:34Z)
Resolution: suspended
Priority: high
Severity: minor
Version: 3.12.0+beta1 or 3.12.0+rc1
Target version: undecided
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Tags: patch
Monitored by: @hcarty
Bug description
For "let (a8, a9) as a10 = (9,10)" camlp4o gives the identifier
a10 the same location as the whole alias pattern "(a8, a9) as
a10". When I dump the camlp4 ast I see
StVal (["test/c.ml": 1:0-28 1:28],
...
PaAli (["test/c.ml": 1:4-19 1:19],
...
PaId (["test/c.ml": 1:4-19 1:19],
IdLid (["test/c.ml": 1:4-19 1:19], "a10"))),
...)
The problem is present in 3.11.2 and in the release candidate.
File attachments
The text was updated successfully, but these errors were encountered: