Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004776OCaml~DO NOT USE (was: OCaml general)public2009-04-27 11:522009-04-28 07:26
Assigned To 
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

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
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.
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
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker