|Anonymous | Login | Signup for a new account||2014-12-22 17:17 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0006331||OCaml||OCaml typing||public||2014-02-18 17:54||2014-02-25 09:19|
|Target Version||Fixed in Version||4.02.0+dev|
|Summary||0006331: `is_fixed_type` does not take account of nested aliases|
|Description||The `is_fixed_type` function in "typedecl.ml" does not take account of nested|
aliases. For example,
# type t = private < x : int; .. > as 'a;;
type t = private < x : int; .. >
# type t = private (< x : int; .. > as 'a) as 'a;;
type t = private (< x : int; .. > as 'a) as 'a;;
Error: A type variable is unbound in this type declaration.
In type < x : int; .. > as 'a the variable 'a is unbound
and probably more concerning
# type t = private < x : int > as 'a;;
type t = private < x : int > as 'a;;
Error: This fixed type has no row variable
# type t = private (< x : int > as 'a) as 'b;;
type t = private < x : int >
|Tags||No tags attached.|
Actually, the problem is rather that the distinction between private abbreviations and private row types is made on a purely syntactic, and you get an error if the system guessed wrong. I agree that the guessing could be improved: in your example the object type has syntactically no row variable, so both cases should succeed; symmetrically, having several aliases should not change the behavior (but I'm not sure why one would want to pile up aliases in this way).
Note that one can already force a private abbreviation by using a constraint:
type t = private 'a constraint 'a = <x:int>
Another approach would be to do it more semantically: produce a private row type if the type has an unbound row, independently of the syntax. The problem is that it might behave in unexpected ways: a type that syntactically it looks like a private row type could end up generating a private abbreviation.
For instance the following is already accepted
type 'a t = <x:'a> as 'a
type u = private 'b constraint 'b = <x:'b t; ..>
and the semantic approach would allow
type u = <x:'b t; ..> as 'b
Fixed in trunk at revision 14443, following the "Another approach".
Now all for cases are accepted, creating a private abbreviation or a private row depending of whether .. is used or not ('as' doesn't matter).
|2014-02-18 17:54||lpw25||New Issue|
|2014-02-19 03:30||garrigue||Note Added: 0010944|
|2014-02-25 09:19||garrigue||Note Added: 0010978|
|2014-02-25 09:19||garrigue||Status||new => resolved|
|2014-02-25 09:19||garrigue||Fixed in Version||=> 4.02.0+dev|
|2014-02-25 09:19||garrigue||Resolution||open => fixed|
|2014-02-25 09:19||garrigue||Assigned To||=> garrigue|
|Copyright © 2000 - 2011 MantisBT Group|