Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004673OCamlCamlp4public2008-12-16 19:552012-09-25 20:06
Reporteravaron 
Assigned Toxclerc 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11.0+beta 
Target VersionFixed in Version3.12.1+dev 
Summary0004673: camlp4 fails to preprocess correctly valid object oriented OCaml
DescriptionThe following tiny file:

-----------------
(* test.ml *)

class test (x : int) = object
    val a = x;
    val b = x;
    method clone = ({< a = x; b = x>})
end
--------------

compiles correctly with OCaml 3.10.2, OCaml 3.11.0, and when the preprocessor is camlp4 3.10.2.

However, when the preprocessors is camlp4 3.11.0 it fails:

samson:~ andres$ ocamlc -pp 'camlp4orf pa_extend.cmo' test.ml
File "test.ml", line 4, characters 27-28:
Warning S: this expression should have type unit.
File "test.ml", line 4, characters 30-35:
Error: This expression has type bool but is here used with type int

The problem is the {< ...; .... >} which is valid. A single assignment as in {< x = 4 >} would be preprocessed correctly.

TagsNo tags attached.
Attached Filesdiff file icon Camlp4OCamlRevisedParser.ml.diff [^] (907 bytes) 2009-06-01 16:21 [Show Content]

- Relationships
duplicate of 0005144closedxclerc object copy syntax parsed wrong with camlp4of 

-  Notes
(0004802)
avaron (reporter)
2008-12-16 20:03

The following is the way camlp4 is interpreting the class definition:

samson:~ andres$ camlp4orf pr_r.cmo test.ml
class test (x : int) =
  object value a = x; value b = x; method clone = {< a = (x; b = x); >}; end;
(0004978)
bluestorm (reporter)
2009-06-01 16:20

I attached a tentative bugfix, wich I also uploaded at http://bluestorm.info/camlp4/objcopy-fix/Camlp4OCamlRevisedParser.ml.diff [^]

I also wrote a small extension for a quick workaround : http://bluestorm.info/camlp4/objcopy-fix/list.php [^]
(0005805)
xclerc (developer)
2011-02-15 11:56

Provided patch tested and applied -- thanks.

- Issue History
Date Modified Username Field Change
2008-12-16 19:55 avaron New Issue
2008-12-16 20:03 avaron Note Added: 0004802
2009-03-31 13:41 xleroy Status new => assigned
2009-03-31 13:41 xleroy Assigned To => ertai
2009-06-01 16:20 bluestorm Note Added: 0004978
2009-06-01 16:21 bluestorm File Added: Camlp4OCamlRevisedParser.ml.diff
2011-02-15 11:43 xclerc Relationship added duplicate of 0005144
2011-02-15 11:55 xclerc Assigned To ertai => xclerc
2011-02-15 11:56 xclerc Note Added: 0005805
2011-02-15 11:56 xclerc Status assigned => resolved
2011-02-15 11:56 xclerc Fixed in Version => 3.12.1+dev
2011-02-15 11:56 xclerc Resolution open => fixed
2012-09-25 20:06 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker