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

Named type variable in a function are not used for the type inferrence of other function #5447

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

Comments

@vicuna
Copy link

vicuna commented Dec 23, 2011

Original bug ID: 5447
Reporter: pilki
Assigned to: @garrigue
Status: closed (set by @garrigue on 2011-12-24T03:21:52Z)
Resolution: not a bug
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Related to: #5448
Child of: #5444
Monitored by: @protz

Bug description

Say you have

<<<
type ('fst, 'snd) mypair = MkMyPair of 'fst * 'snd
let myfst (MkMyPair (x, _): ('fst, 'snd) mypair) = x
let foo x = myfst x + 1

The inferred types are:
<<<
type ('fst, 'snd) mypair = MkMyPair of 'fst * 'snd
val myfst : ('fst, 'snd) mypair -> 'fst
val foo : (int, 'a) mypair -> int

One might have expected
val foo: (int, 'snd) mypair -> int

@vicuna
Copy link
Author

vicuna commented Dec 24, 2011

Comment author: @garrigue

As mentioned in #5445, names are forgotten upon instantiation.
It is not clear to me how useful it would be to inherit them in other types.
At the very least, we would need two categories of names: explicit names
(given by the user in the function) and inherited names, with a priority
to explicit names.
If deemed useful, would need to experiment with several policies.

@vicuna
Copy link
Author

vicuna commented Dec 24, 2011

Comment author: @garrigue

Might consider some future action, but this is not a bug.

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