Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object coercion #3745

Closed
vicuna opened this issue Aug 4, 2005 · 1 comment
Closed

Object coercion #3745

vicuna opened this issue Aug 4, 2005 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Aug 4, 2005

Original bug ID: 3745
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Anatoly Zaretsky
Version: Objective Caml 3.08.3
OS: Debian GNU/Linux 3.1
Submission from: zaretsky.apex.dp.ua (212.3.110.34)

Hello!

Compilation of the following code causes compiler fatal error:

% ocamlc -c test.ml
myself/77

Fatal error: Bytegen.comp_expr: var myself_77
Fatal error: exception Misc.Fatal_error

% ocamlopt -c test.ml

Fatal error: Selection.size_expr: unbound var myself_77
Fatal error: exception Misc.Fatal_error

However, "ocamlc -i test.ml" succeeds.

When I do not use let binding for 'myself' and substitute it manually,
everything compiles fine.

(* test.ml *)

class virtual enterprise =
object (self)
val categories : category list = []

method online =
let myself = (self :> enterprise) in
List.iter
(fun cat ->
cat#add_ent myself;
List.iter
(fun client -> client#inform cat myself)
cat#get_clients)
categories

method virtual inform : category -> client -> unit
end

and virtual client =
object (self)
val categories : category list = []

method online =
let myself = (self :> client) in
List.iter
(fun cat ->
cat#add_client myself;
List.iter
(fun ent ->
self#inform cat ent;
ent#inform cat myself)
cat#get_ents)
categories;

method virtual inform : category -> enterprise -> unit
end

and virtual category =
object
method virtual add_ent : enterprise -> unit
method virtual get_ents : enterprise list
method virtual add_client : client -> unit
method virtual get_clients : client list
end

@vicuna
Copy link
Author

vicuna commented Sep 25, 2005

Comment author: administrator

fixed by JG 2005-08-08
see CVS log for bytecomp/translclass.ml

@vicuna vicuna closed this as completed Sep 25, 2005
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant