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

wrong location inside alias patterns #5114

Closed
vicuna opened this issue Jul 25, 2010 · 10 comments
Closed

wrong location inside alias patterns #5114

vicuna opened this issue Jul 25, 2010 · 10 comments

Comments

@vicuna
Copy link

vicuna commented Jul 25, 2010

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

@vicuna
Copy link
Author

vicuna commented Jul 26, 2010

Comment author: Hendrik Tews

Same problem for "exception A of int". Here "A" gets the location
of "A of int".

@vicuna
Copy link
Author

vicuna commented Jul 27, 2010

Comment author: Hendrik Tews

Same for "exception A of int" in interfaces or signatures.

@vicuna
Copy link
Author

vicuna commented Sep 16, 2010

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.

@vicuna
Copy link
Author

vicuna commented Sep 16, 2010

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.

@vicuna
Copy link
Author

vicuna commented Sep 16, 2010

Comment author: Hendrik Tews

Same for "class virtual ['a] t = ... in structures. Here the location of "t" starts with virtual.

@vicuna
Copy link
Author

vicuna commented Sep 16, 2010

Comment author: Hendrik Tews

Same for infix operators: for "let ( *** ) ..." the location for "***" contains the parenthesis'.

@vicuna
Copy link
Author

vicuna commented Jan 30, 2012

Comment author: Hendrik Tews

Hi,

I added a first patch that fixes the locations inside exceptions.
I would invest some more time to fix the other issues as well,
however, I would like to have some feedback before I proceed.

The uploaded patch is a diff against the distributed version
ocaml-3.12.1. However, the version 3.12.1 is not distributed with
a fully bootstraped camlp4. Therefore, before applying the patch
you first have to bootstrap camlp4 until the fixpoint is reached.

Hendrik

@vicuna
Copy link
Author

vicuna commented Jul 20, 2012

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.

@vicuna
Copy link
Author

vicuna commented Sep 18, 2012

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.

@vicuna
Copy link
Author

vicuna commented Jan 9, 2015

Comment author: @damiendoligez

Transferred to camlp4/camlp4#71

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