Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004522OCamlCamlp4public2008-03-19 20:482012-09-15 12:31
Reportermottl 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.10.1 
Target Version4.00.1+devFixed in Version3.12.0 
Summary0004522: Camlp4 erases unused optional arguments
DescriptionThe following valid code cannot be compiled when preprocessed with Camlp4:

  module type S = sig val f : ?x : 'a -> unit -> unit end
  module M : S = struct let f ?x:_ () = () end

Compiler output (with ocamlc -pp camlp4o foo.ml):

  File "foo.ml", line 2, characters 15-44:
  Signature mismatch:
  Modules do not match: sig val f : 'a -> unit -> unit end is not included in S
  Values do not match:
    val f : 'a -> unit -> unit
  is not included in
    val f : ?x:'a -> unit -> unit

The label of the ignored optional argument obviously got deleted by Camlp4 as evidenced by the output when pretty-printing with "camlp4o -printer o foo.ml":

  module type S = sig val f : ?x: 'a -> unit -> unit end
  module M : S = struct let f _ () = () end

Regards,
Markus
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0007945)
mrm (reporter)
2012-08-15 21:02
edited on: 2012-08-15 21:09

The problem with optional arguments in the original syntax is fixed in OCaml 3.12 and was caused by:
1) An old bug in the camlp4 parsing engine (PR#4603, PR#4330,PR#4551, PR#4513) which was fixed by ertai in
   http://caml.inria.fr/cgi-bin/viewvc.cgi?view=revision&revision=9053 [^]
2) A bug in Camlp4OCamlParser.ml (PR#4939) which was fixed in
   http://caml.inria.fr/cgi-bin/viewvc.cgi?view=revision&revision=11034 [^]

-- Max Mouratov

(0007973)
hongboz (developer)
2012-08-22 14:17

Should this be closed? I can not reproduce it
(0008081)
doligez (administrator)
2012-09-15 12:31

As Max said, the problem is fixed since 3.12.0

- Issue History
Date Modified Username Field Change
2008-03-19 20:48 mottl New Issue
2008-03-20 10:50 ertai Status new => assigned
2008-03-20 10:50 ertai Assigned To => ertai
2012-07-11 15:53 doligez Assigned To ertai =>
2012-07-11 15:53 doligez Status assigned => acknowledged
2012-07-11 15:53 doligez Target Version => 4.01.0+dev
2012-07-31 13:37 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-08-15 21:02 mrm Note Added: 0007945
2012-08-15 21:09 mrm Note Edited: 0007945 View Revisions
2012-08-22 14:17 hongboz Note Added: 0007973
2012-09-15 12:31 doligez Note Added: 0008081
2012-09-15 12:31 doligez Status acknowledged => closed
2012-09-15 12:31 doligez Resolution open => fixed
2012-09-15 12:31 doligez Fixed in Version => 3.12.0


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker