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

type-checker crash #3643

Closed
vicuna opened this issue Sep 6, 2002 · 2 comments
Closed

type-checker crash #3643

vicuna opened this issue Sep 6, 2002 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Sep 6, 2002

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

Bug description

bonjour,

le code suivant est accepté :

class c = object (self)
method m : 'a. ([> `A of 'a] as 'a) -> unit
= fun x -> self#m x
end

alors que si l'on passe par une déclaration de type
type 'a t = [ `A of 'a] , on obtient des résultats variables...

paros[11:05]%ocaml
Objective Caml version 3.06

type 'a t= [`A of 'a]

;;
type 'a t = [ `A of 'a]

class c = object (self)

method m : 'a. ([> 'a t] as 'a) -> unit
= fun x -> self#m x
end
;; (* boucle *)
Interrupted.

class c = object (self)

method m : 'a. ([> 'a t] as 'a) -> unit
  = fun x -> match x with
  | `A x' -> self#m x'
  | _ -> failwith "c#m"

end
;; (* refusé alors que devrait être OK *)
This method has type ([> 'a t] as 'a) -> unit which is less general than
'b. ([> 'b t] as 'b) -> unit

class c = object (self)
method m : 'a. ([> 'a t] as 'a) -> 'a
= fun x -> self#m x
end
;; (* crash *)
Fatal error: exception Stack_overflow
paros[11:07]%

@vicuna
Copy link
Author

vicuna commented Sep 7, 2002

Comment author: administrator

le code suivant est accepte' :

class c = object (self)
method m : 'a. ([> `A of 'a] as 'a) -> unit
= fun x -> self#m x
end

alors que si l'on passe par une declaration de type
type 'a t = [ `A of 'a] , on obtient des resultats variables...

Effectivement, le code de 3.06 est incorrect quand un alias de rangee
universel est passe' en argument a un autre type avant ou a
l'interieur de l'alias, et casse de nombreux invariants. Merci pour
ce rapport.

C'est maintenant corrige' en CVS.

  Jacques

@vicuna
Copy link
Author

vicuna commented Sep 9, 2002

Comment author: administrator

Fixed by Jacques (2002-09-07)

@vicuna vicuna closed this as completed Sep 9, 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