From 2b0a4e2746e632d3f823baade49b560f79317497 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Thu, 21 Mar 2019 19:09:42 +0000 Subject: Fix: Use doc_binding for printing scattered mapping types Issue with pretty-printing mapping clauses types fixed by both cf7eb8b83 and 0e2f1710a, so remove the redundant clauses. In the parser we allow both ``` | Mapping id { mk_sd (SD_mapping ($2, mk_tannotn)) $startpos $endpos } | Mapping id Colon funcl_typ { mk_sd (SD_mapping ($2, $4)) $startpos $endpos } ``` so we should probably use doc_binding to correctly print any quantifier on the funcl_typ. Although since polymorphism and mappings don't play nicely together right now this likely doesn't occur very often in practice. --- src/pretty_print_sail.ml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/pretty_print_sail.ml b/src/pretty_print_sail.ml index af25f189..1fa14a7d 100644 --- a/src/pretty_print_sail.ml +++ b/src/pretty_print_sail.ml @@ -659,14 +659,10 @@ let rec doc_scattered (SD_aux (sd_aux, _)) = separate space [string "mapping clause"; doc_id id; equals; doc_mapcl mapcl] | SD_mapping (id, Typ_annot_opt_aux (Typ_annot_opt_none, _)) -> separate space [string "scattered mapping"; doc_id id] - | SD_mapping (id, Typ_annot_opt_aux (Typ_annot_opt_some (_, typ), _)) -> - separate space [string "scattered mapping"; doc_id id; string ":"; doc_typ typ] + | SD_mapping (id, Typ_annot_opt_aux (Typ_annot_opt_some (typq, typ), _)) -> + separate space [string "scattered mapping"; doc_id id; colon; doc_binding (typq, typ)] | SD_unioncl (id, tu) -> separate space [string "union clause"; doc_id id; equals; doc_union tu] - | SD_mapping (id, _) -> - string "scattered" ^^ space ^^ string "mapping" ^^ space ^^ doc_id id - | SD_mapcl (id, mapcl) -> - separate space [string "mapping clause"; doc_id id; equals; doc_mapcl mapcl] let rec doc_def def = group (match def with | DEF_default df -> doc_default df -- cgit v1.2.3