summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>1999-12-08 17:25:36 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>1999-12-08 17:25:36 +0000
commitb1231d6d1d68c0151a744919bec073d3940cc11e (patch)
tree7ea7c18581c634836fccf291456d0932f2728e5b
parent77d4f18ce657800ebd85530c510521b467d7c3dd (diff)
variant types
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2678 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--parsing/parser.mly2
-rw-r--r--typing/printtyp.ml10
2 files changed, 9 insertions, 3 deletions
diff --git a/parsing/parser.mly b/parsing/parser.mly
index afb9c4139..1f65d7ba6 100644
--- a/parsing/parser.mly
+++ b/parsing/parser.mly
@@ -1213,6 +1213,8 @@ simple_core_type:
{ mktyp(Ptyp_variant(List.rev $2, not $3, List.rev $5)) }
| LBRACKET RBRACKET
{ mktyp(Ptyp_variant([],true,[])) }
+ | LBRACKETLESS DOTDOT RBRACKET
+ { mktyp(Ptyp_variant([],false,[])) }
;
opt_opened:
BAR DOTDOT { true }
diff --git a/typing/printtyp.ml b/typing/printtyp.ml
index 81e3e19e1..aa8e9e799 100644
--- a/typing/printtyp.ml
+++ b/typing/printtyp.ml
@@ -285,14 +285,18 @@ let rec typexp sch prio0 ty =
if not (row.row_closed && all_present) && sch &&
px.level <> generic_level then print_string "_["
else print_char '[';
- if row.row_closed && all_present then () else
- if all_present then print_char '>' else print_char '<';
+ if all_present then begin
+ if row.row_closed then () else
+ if fields = [] then print_string "< .." else
+ print_char '>'
+ end else
+ print_char '<';
print_list (row_field sch) (fun () -> printf "@,|") fields;
if not (row.row_closed || all_present) then printf "@,| ..";
if present <> [] && not all_present then begin
print_space ();
open_hovbox 2;
- print_string "|>";
+ print_string ">";
print_list (fun (s,_) -> print_char '`'; print_string s)
print_space present;
close_box ()