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
Fancy named type variables are not used in typing error #5448
Comments
Comment author: @garrigue Might consider some future action, but this is not a bug. |
Comment author: pilki I guess my example was badly chosen, but here I'm not suggesting to take the name of type variables from type definition. Another (better) example: <<< <<< Type variable names are only used in error messages when they are defined locally: Since you (Jacques) told me the main purpose of this modification on type variables is error reporting, I would almost call that a bug and not a feature request! |
Comment author: @garrigue Sorry, my first answer was a bit ambiguous, as I answered simultaneously several bug. Actually, your second example precisely demonstrates the advantage of not inheriting: let f x = This is different from the first example because named type variables in local If we were to keep names upon instantiation, we would need a way to distinguish |
Original bug ID: 5448
Reporter: pilki
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2013-08-31T10:44:05Z)
Resolution: not a bug
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Related to: #5447
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
with type inferred:
<<<
type ('fst, 'snd) mypair = MkMyPair of 'fst * 'snd
val myfst : ('fst, 'snd) mypair -> 'fst
then
<<<
let () = myfst
leads to error message:
<<<
Error: This expression has type ('a, 'b) mypair -> 'a
but an expression was expected of type unit
where 'fst and 'snd don't appear
The text was updated successfully, but these errors were encountered: