Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlc throws exception
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] ocamlc throws exception
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
> From: Michael Wohlwend <micha-1@fantasymail.de>
> > that code :
> [..]
> > causes this exception:
> > Fatal error: exception Ctype.Unify(_, 0)
> > (Program not linked with -g, cannot print stack backtrace)
> 
> This should be a bug report :-)
> Indeed, the problem seems to be still there on the 3.08 branch after
> 3.08.4.
> On the other, this bug does not appear on the 3.09 branch.

The last sentence is wrong: this bug is common to all versions.
The fix is simple enough, and is already in CVS.
You just have to replace the definition of hide_private_methods in
typing/ctype.ml by

let hide_private_methods ty =
  match (repr ty).desc with
    Tobject (fi, nm) ->
      nm := None;
      let (fl, _) = flatten_fields fi in
      List.iter
        (function (_, k, _) ->
          match field_kind_repr k with
            Fvar r -> set_kind r Fabsent
          | _      -> ())
        fl
  | _ ->
      assert false

Jacques Garrigue