Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004426OCamlOCaml generalpublic2007-10-20 03:042007-10-29 07:57
Reporterjm 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
Platformi686OSDebianOS VersionSid
Product Version3.10+dev 
Target VersionFixed in Version3.10+dev 
Summary0004426: Unexpected memorization of an optional label.
DescriptionIn the example below, the optional argument ?l of class ko shouldn't be memorized at the first instantiation.
Steps To Reproduce% ocaml
        Objective Caml version 3.10.1+dev0 (2007-05-21)

# class i ?(l=fun () -> 0) () =
  object val v = l () method v = v
         initializer prerr_endline ("v="^string_of_int v)
  end;;
class i : ?l:(unit -> int) -> unit -> object val v : int method v : int end
# class ko ?l = i ~l: (fun () -> (object inherit i () ?l end)#v + 1)
  class ok ?l = i ~l: ((fun ?l () -> (object inherit i () ?l end)#v + 1) ?l)
;;
class ko : ?l:(unit -> int) -> unit -> i
class ok : ?l:(unit -> int) -> unit -> i

# new ko () ~l: (fun _ -> 42);;
v=42
v=43
- : ko = <obj>
# new ko ();;
v=42
v=43
- : ko = <obj>
# new ko () ~l: (fun _ -> 24);;
v=42
v=43
- : ko = <obj>

# new ok () ~l: (fun _ -> 42);;
v=42
v=43
- : ok = <obj>
# new ok ();;
v=0
v=1
- : ok = <obj>
# new ok () ~l: (fun _ -> 24);;
v=24
v=25
- : ok = <obj>
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0004214)
garrigue (manager)
2007-10-29 04:24

I see no attached example...
(0004215)
jm (reporter)
2007-10-29 04:44

It is because the example is inside the field "Steps to reproduce" hidden in the advanced view:
  http://caml.inria.fr/mantis/bug_view_advanced_page.php?bug_id=4426 [^]
(0004217)
garrigue (manager)
2007-10-29 07:57

Fixed in branch release310 (typing/typeclass.ml)
Environment declared by class functions was incorrect.

- Issue History
Date Modified Username Field Change
2007-10-20 03:04 jm New Issue
2007-10-29 04:24 garrigue Note Added: 0004214
2007-10-29 04:28 garrigue Status new => feedback
2007-10-29 04:44 jm Note Added: 0004215
2007-10-29 07:57 garrigue Status feedback => closed
2007-10-29 07:57 garrigue Note Added: 0004217
2007-10-29 07:57 garrigue Resolution open => fixed
2007-10-29 07:57 garrigue Fixed in Version => 3.10+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker