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

Methodes+variants polymorphes #3384

Closed
vicuna opened this issue Jun 8, 2002 · 2 comments
Closed

Methodes+variants polymorphes #3384

vicuna opened this issue Jun 8, 2002 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jun 8, 2002

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

Bug description

OCaml refuse ça:

class c =
(
object method f : 'a. ([< A] as 'a) -> unit = fun _ -> () end : object method f : [< A] -> unit end
)

The class type object method f : [ A] -> unit end is not matched by the class type object method f : [< A] -> unit end
The method f has type 'a. ([ A] as 'a) -> unit but is expected to have type 'b. ([< A] as 'b) -> unit

C'est le cas avec 3.04+11 et 3.04+13. J'ai une vieille version "3.04+6
polymorphic methods (2002-02-16)" qui acceptait ça.

-- Alain

@vicuna
Copy link
Author

vicuna commented Jun 9, 2002

Comment author: administrator

From: frisch@clipper.ens.fr

OCaml refuse ca:

class c =
(
object method f : 'a. ([< A] as 'a) -> unit = fun _ -> () end : object method f : [< A] -> unit end
)

The class type object method f : [ A] -> unit end is not matched by the class type object method f : [< A] -> unit end
The method f has type 'a. ([ A] as 'a) -> unit but is expected to have type 'b. ([< A] as 'b) -> unit

C'est le cas avec 3.04+11 et 3.04+13. J'ai une vieille version "3.04+6
polymorphic methods (2002-02-16)" qui acceptait ca.

Le probleme est subtil: j'ai recemment modifie' le compilateur pour
qu'il force la presence dans tous les variants a un seul champs. D'ou l'apparition de ce [ A]. Clairement, ca pose probleme quand ils sont introduits a la main:
soit l'implementation doit etre refusee (la variable quantifiee n'en
est pas une), soit l'interface doit etre acceptee. Je vais voir quoi
faire.

Sur le fond, distinguer [< A] n'a pas de sens: la seule instance possible de ce type est [ A].

Jacques

@vicuna
Copy link
Author

vicuna commented Jun 10, 2002

Comment author: administrator

Fixed by Jacques on 2002-06-10.
(Ignore absent univars)

@vicuna vicuna closed this as completed Jun 10, 2002
@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