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

The top level drops all the "fancy" type variables #5445

Closed
vicuna opened this issue Dec 23, 2011 · 2 comments
Closed

The top level drops all the "fancy" type variables #5445

vicuna opened this issue Dec 23, 2011 · 2 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Dec 23, 2011

Original bug ID: 5445
Reporter: pilki
Assigned to: @garrigue
Status: closed (set by @garrigue on 2011-12-27T07:03:06Z)
Resolution: fixed
Severity: feature
Fixed in version: 3.13.0+dev
Category: ~DO NOT USE (was: OCaml general)
Child of: #5444
Monitored by: @protz

Bug description

When "nice" type variables are given for a function, and the function name is then typed in the top level, the type is changed:
<<<

let f (x:'foo) = x;;

val f : 'foo -> 'foo =

f;;

  • : 'a -> 'a =

I often use the top level to give me the type of functions, and if one day "Hashtbl.add" is given a "fancy" type, it would be nice to see it that way.

#show_type might be a solution, but it's longer to type!

@vicuna
Copy link
Author

vicuna commented Dec 24, 2011

Comment author: @garrigue

Names are forgotten when instantiating, and here the type of f is instantiated before being generalized again.
The simplest fix would be to provide a special case in type_expression for just typing one identifier (no need to instantiate).

@vicuna
Copy link
Author

vicuna commented Dec 27, 2011

Comment author: @garrigue

Fixed in typecore, revision 11956

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants