diff options
| author | Gabriel Kerneis | 2013-12-13 16:01:30 +0000 |
|---|---|---|
| committer | Gabriel Kerneis | 2013-12-13 16:01:57 +0000 |
| commit | 7d368ee6a43f3bcb99b5cb754c52f5246db85618 (patch) | |
| tree | 305e0dde3743a307b799b674f729870439c2e1d1 /src | |
| parent | d2628288f054e72fef2d5bbad24f1aac0f5d1db7 (diff) | |
Fix effect annotation pretty-printing
There is also a bug for parsing effect annotations (in fundecl).
But for some reason, my fix for the parser does not work:
test/test2.sail still refuses to parse (chokes on "effect
pure"), even with "Effect" added to parser.mly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/parser.mly | 4 | ||||
| -rw-r--r-- | src/pretty_print.ml | 2 | ||||
| -rw-r--r-- | src/test/test2.sail | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/parser.mly b/src/parser.mly index 6ef0a91e..010ac76d 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -862,8 +862,8 @@ fun_def: { funloc (FD_function(mk_rec 2,mk_tannot (mk_typqn ()) $3 3 3, mk_eannotn (), $4)) } | Function_ Rec funcl_ands { funloc (FD_function(mk_rec 2, mk_tannotn (), mk_eannotn (), $3)) } - | Function_ typquant atomic_typ effect_typ funcl_ands - { funloc (FD_function(mk_recn (), mk_tannot $2 $3 2 3, mk_eannot $4 4, $5)) } + | Function_ typquant atomic_typ Effect effect_typ funcl_ands + { funloc (FD_function(mk_recn (), mk_tannot $2 $3 2 3, mk_eannot $5 5, $6)) } | Function_ typquant typ funcl_ands { funloc (FD_function(mk_recn (), mk_tannot $2 $3 2 2, mk_eannotn (), $4)) } | Function_ Effect effect_typ funcl_ands diff --git a/src/pretty_print.ml b/src/pretty_print.ml index a32db3b1..ff8772a0 100644 --- a/src/pretty_print.ml +++ b/src/pretty_print.ml @@ -330,7 +330,7 @@ let pp_funcl ppf (FCL_aux(FCL_Funcl(id,pat,exp),_)) = let pp_fundef ppf (FD_aux(FD_function(r, typa, efa, fcls),_)) = let pp_funcls ppf funcl = fprintf ppf "%a %a" kwd "and" pp_funcl funcl in - fprintf ppf "@[<0>%a %a%a%a%a@ @[<1>%a@] @]@\n" + fprintf ppf "@[<0>%a %a%a%a %a@ @[<1>%a@] @]@\n" kwd "function" pp_rec r pp_tannot_opt typa pp_effects_opt efa pp_funcl (List.hd fcls) (list_pp pp_funcls pp_funcls) (List.tl fcls) let pp_def ppf (DEF_aux(d,(l,_))) = diff --git a/src/test/test2.sail b/src/test/test2.sail index 24d82655..1418f990 100644 --- a/src/test/test2.sail +++ b/src/test/test2.sail @@ -1,5 +1,5 @@ function nat id ( n ) = n -function nat main _ = { +function nat effect pure main _ = { id(42); } |
