Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005114OCamlCamlp4public2010-07-25 14:402014-08-20 09:49
ReporterHendrik Tews 
Assigned Toxclerc 
PriorityhighSeverityminorReproducibilityalways
StatusassignedResolutionopen 
PlatformOSOS Version
Product Version3.12.0+beta1 or 3.12.0+rc1 
Target Versionafter-4.02.0Fixed in Version 
Summary0005114: wrong location inside alias patterns
DescriptionFor "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.
Tagspatch
Attached Files? file icon patch [^] (10,044 bytes) 2012-01-30 21:49 [Show Content]
? file icon new-patch [^] (1,217 bytes) 2012-07-20 11:04 [Show Content]

- Relationships

-  Notes
(0005622)
Hendrik Tews (reporter)
2010-07-26 22:02

Same problem for "exception A of int". Here "A" gets the location
of "A of int".
(0005623)
Hendrik Tews (reporter)
2010-07-27 16:44

Same for "exception A of int" in interfaces or signatures.
(0005660)
Hendrik Tews (reporter)
2010-09-16 16:29

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.
(0005661)
Hendrik Tews (reporter)
2010-09-16 16:50

Same for "class type virtual ['a] t = ... Here the location for t starts with "virtual". Happens also in interfaces for class types and classes.
(0005662)
Hendrik Tews (reporter)
2010-09-16 17:13

Same for "class virtual ['a] t = ... in structures. Here the location of "t" starts with virtual.
(0005663)
Hendrik Tews (reporter)
2010-09-16 17:25

Same for infix operators: for "let ( *** ) ..." the location for "***" contains the parenthesis'.
(0006852)
Hendrik Tews (reporter)
2012-01-30 22:03

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
(0007785)
Hendrik Tews (reporter)
2012-07-20 11:07

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.
(0008103)
doligez (administrator)
2012-09-18 11:45

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.

- Issue History
Date Modified Username Field Change
2010-07-25 14:40 Hendrik Tews New Issue
2010-07-25 14:40 Hendrik Tews Status new => assigned
2010-07-25 14:40 Hendrik Tews Assigned To => ertai
2010-07-26 22:02 Hendrik Tews Note Added: 0005622
2010-07-27 16:44 Hendrik Tews Note Added: 0005623
2010-09-16 16:29 Hendrik Tews Note Added: 0005660
2010-09-16 16:50 Hendrik Tews Note Added: 0005661
2010-09-16 17:13 Hendrik Tews Note Added: 0005662
2010-09-16 17:25 Hendrik Tews Note Added: 0005663
2011-10-26 08:38 ertai Assigned To ertai => xclerc
2012-01-30 21:49 Hendrik Tews File Added: patch
2012-01-30 22:03 Hendrik Tews Note Added: 0006852
2012-07-10 20:00 doligez Target Version => 4.01.0+dev
2012-07-20 11:04 Hendrik Tews File Added: new-patch
2012-07-20 11:07 Hendrik Tews Note Added: 0007785
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-18 11:45 doligez Note Added: 0008103
2012-09-18 13:01 doligez Priority normal => high
2012-09-18 13:01 doligez Target Version 4.00.1+dev => 4.00.2+dev
2013-07-11 12:58 doligez Target Version 4.00.2+dev => 4.01.0+dev
2013-08-19 11:58 doligez Target Version 4.01.0+dev => 4.01.1+dev
2013-10-07 16:14 doligez Tag Attached: patch
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-08-20 09:49 shinwell Target Version 4.02.0+dev => after-4.02.0


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker