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 abbreviation hides constraints #2325

Closed
vicuna opened this issue Dec 20, 1999 · 2 comments
Closed

type abbreviation hides constraints #2325

vicuna opened this issue Dec 20, 1999 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Dec 20, 1999

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

Bug description

Full_Name: Hendrik Tews
Version: 2.02
OS:
Submission from: estephe.inria.fr (128.93.11.95)
Submitted by: xleroy

Hi,

if I type

# class type ['a] cta = object val a_val : 'a method b : int end;;
# class ['a] ca (a:'a) : ['a] cta =
   object val a_val = a method b = a_val#get + 5 end;; 

into the toplevel, the system derives the type

class ['a] ca : 'a -> ['a] cta 

IMO this is wrong, because there must be a constraint for the type
parameter of class ca (the constraint becomes visible, if the
type annotation ['a] cta is left out). The problem becomes even
more apparent, when the system derives for

# module M = struct class ['a] ca (a:'a) : ['a] cta =
  object val a_val = a method b = a_val#get + 5 end end ;;

the type

  module M : sig class ['a] ca : 'a -> ['a] cta end

because

# module type MT = sig class ['a] ca : 'a -> ['a] cta end;;
# module M : MT = struct class ['a] ca (a:'a) : ['a] cta =
  object val a_val = a method b = a_val#get + 5 end end ;;

produces an error.

@vicuna
Copy link
Author

vicuna commented Nov 19, 2001

Comment author: administrator

Hello,

I have finally closed #2325.
The fix was much simpler than what I thought, but it is somehow weak:
all classes whose parameters have constraints will not be abbreviated,
independently of wether the abbreviation is correct or not.

Jacques Garrigue

@vicuna
Copy link
Author

vicuna commented Nov 19, 2001

Comment author: administrator

Fixed by Jacques on 2001-11-19.

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