You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4319 Reporter: eaubin Assigned to:@garrigue Status: closed (set by @xavierleroy on 2015-12-11T18:07:16Z) Resolution: fixed Priority: normal Severity: feature Version: 3.10.0 Fixed in version: 4.00.0+dev Category: ~DO NOT USE (was: OCaml general) Monitored by: bartjacobs @ygrek till jm hirokawa
Bug description
Could the -dtypes option preserve the name of type variables in annotations? E.g. I've a function
let discriminate
(disc: ('t,int,'v) discriminable) (xs: 't list): 'v list list = ...
which gets shown as ('d, int, 'e) discriminable -> 'd list -> 'e list list by caml-types-show-type instead of ('t,int,'v) discriminable -> 't list -> 'v list list.
The text was updated successfully, but these errors were encountered:
It's an instance of a more general aspect of the OCaml printer for types, namely that it invents names 'a, 'b, etc, for type variables occurring in types. The infrastructure to record and propagate user-provided names is simply not there. I'm afraid it won't change any time soon, but leave this PR as a feature wish.
Notice that F# does this: it preserves user-provided type variable names in error messages and IDE tooltips. It even issues a warning when it constrains a user-provided type variable, saying something like "the polymorphism of this function is less than what is indicated by the type annotations".
In the upcoming ocaml 4.00, type names are kept during type inference, and they should also appear in .annot files.
Whether we should have a warning when instantiating user-named type variables is an open question.
In Standard ML this is an error to instantiate a provided type.
In OCaml type variables are handled just as unification variables, which can be freely instantiated, but since 3.12 one can also use explicitly polymorphic type annotations to prohibit instantiation.
Original bug ID: 4319
Reporter: eaubin
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:07:16Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.10.0
Fixed in version: 4.00.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: bartjacobs @ygrek till jm hirokawa
Bug description
Could the -dtypes option preserve the name of type variables in annotations? E.g. I've a function
let discriminate
(disc: ('t,int,'v) discriminable) (xs: 't list): 'v list list = ...
which gets shown as ('d, int, 'e) discriminable -> 'd list -> 'e list list by caml-types-show-type instead of ('t,int,'v) discriminable -> 't list -> 'v list list.
The text was updated successfully, but these errors were encountered: