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

Weird polymorphic variants behaviour #2924

Closed
vicuna opened this issue Aug 22, 2001 · 2 comments
Closed

Weird polymorphic variants behaviour #2924

vicuna opened this issue Aug 22, 2001 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Aug 22, 2001

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

Bug description

Bonjour,

je suis pas certain que ce soit un bug, mais je trouve le comportement
assez étrange :

le morceau de code suivant compile bien quand il est un fichier .ml
sans fichier .mli .

<<<<<<
class type ['a] renderer =
object
constraint 'a = [< A of unit | B]
method set_style : 'a -> unit
end

class type ['a] component =
object
method add_style : 'a -> unit
method draw : 'a renderer -> unit
end

$ ocamlc -c t.ml
$

Par contre :

$ cp t.ml t.mli
$ ocamlc t.mli
$ ocamlc -c t.ml
The implementation t.ml does not match the interface t.cmi:
Type declarations do not match:
type 'a component = < add : 'a -> unit; draw : 'a renderer -> unit >
constraint 'a = [< A of unit | B]
is not included in
type 'a component = < add : 'a -> unit; draw : 'a renderer -> unit >
constraint 'a = [< A of unit | B]

Par contre ça marche en utilisant :
contraint 'a = [< A | B]
En supprimant le deuxième class type, ça compile bien également.

Je vois pas bien pourquoi le fait d'utiliser un variant avec
contructeur pose un problème (et le message d'erreur n'aide pas trop).

    Olivier
@vicuna
Copy link
Author

vicuna commented Aug 23, 2001

Comment author: administrator

je suis pas certain que ce soit un bug, mais je trouve le comportement
assez etrange :

C'est bien un bug. Ou plutot un oubli.
C'est maintenant corrige' en CVS.
Bon camlage, et merci pour ce rapport

Jacques Garrigue

@vicuna
Copy link
Author

vicuna commented Aug 23, 2001

Comment author: administrator

Fixed byg JG. (2001-08-24)

@vicuna vicuna closed this as completed Aug 23, 2001
@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