You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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).
The text was updated successfully, but these errors were encountered: