Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004776OCamlOCaml generalpublic2009-04-27 11:522009-04-28 07:26
Reporterfrisch 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version3.11.1+dev 
Summary0004776: Bad interaction between exceptions and classes
DescriptionThe code generator for classes behaves badly w.r.t. exceptions, as demonstrated by the code below:

============================================================================
module F(X : sig end) = struct
  exception A
  let a = A

  let () =
    let o = object method test = match a with A -> print_endline "OK" | _ -> assert false end in
    o # test
end

module X = F(struct end)
module Y = F(struct end) (* fails!!! *)
============================================================================


The reason, I believe, is that Env.diff does not take exception constructors into account. As a consequence, the new_ids variable in Translclass.transl_class does not include such constructors and the classes are not closed over them, as they should (as far as I understand compilation of classes).
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0004925)
frisch (developer)
2009-04-27 12:00

I confirm that if one extends Env.t with a new field that keep tracks of all exceptions (one only needs to change the store_exception function and the empty value) and if we use this in Env.diff, the bug is fixed.
(0004928)
garrigue (manager)
2009-04-28 07:26

Fixed by tracking (local) exceptions in Env.diff.

- Issue History
Date Modified Username Field Change
2009-04-27 11:52 frisch New Issue
2009-04-27 12:00 frisch Note Added: 0004925
2009-04-28 07:26 garrigue Note Added: 0004928
2009-04-28 07:26 garrigue Status new => closed
2009-04-28 07:26 garrigue Resolution open => fixed
2009-04-28 07:26 garrigue Fixed in Version => 3.11.1+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker