diff --git a/src/comp/CSyntax.hs b/src/comp/CSyntax.hs index a0580f5f1..281cf9697 100644 --- a/src/comp/CSyntax.hs +++ b/src/comp/CSyntax.hs @@ -1044,12 +1044,12 @@ instance PPrint CExpr where pPrint d p (Cletseq [] e) = pparen (p > 0) $ (t"letseq in" <+> pp d e) pPrint d p (Cletseq ds e) = pparen (p > 0) $ - (t"letseq" <+> foldr1 ($+$) (map (pp d) ds)) $+$ + (t"letseq" <+> text "{" <+> foldr1 ($+$) (map (pp d) ds)) <+> text "}" $+$ (t"in " <> pp d e) pPrint d p (Cletrec [] e) = pparen (p > 0) $ (t"let in" <+> pp d e) pPrint d p (Cletrec ds e) = pparen (p > 0) $ - (t"let" <+> foldr1 ($+$) (map (pp d) ds)) $+$ + (t"let" <+> text "{" <+> foldr1 ($+$) (map (pp d) ds)) <+> text "}" $+$ (t"in " <> pp d e) pPrint d p (CSelect e i) = pparen (p > (maxPrec+2)) $ pPrint d (maxPrec+2) e <> t"." <> ppVarId d i pPrint d p (CCon i []) = ppConId d i @@ -1151,9 +1151,9 @@ instance PPrint CStmt where (map (ppPProp d . snd) pprops) ++ [pp d pat <+> t "<-" <+> pp d e] pPrint d p (CSletseq []) = internalError "CSyntax.PPrint(CStmt): CSletseq []" - pPrint d p (CSletseq ds) = text "letseq" <+> foldr1 ($+$) (map (pp d) ds) + pPrint d p (CSletseq ds) = text "letseq" <+> text "{" <+> foldr1 ($+$) (map (pp d) ds) <+> text "}" pPrint d p (CSletrec []) = internalError "CSyntax.PPrint(CStmt): CSletrec []" - pPrint d p (CSletrec ds) = text "let" <+> foldr1 ($+$) (map (pp d) ds) + pPrint d p (CSletrec ds) = text "let" <+> text "{" <+> foldr1 ($+$) (map (pp d) ds) <+> text "}" pPrint d p (CSExpr _ e) = pPrint d p e instance PPrint CMStmt where diff --git a/testsuite/README.md b/testsuite/README.md index f4f3e2ca9..a0732c712 100644 --- a/testsuite/README.md +++ b/testsuite/README.md @@ -115,9 +115,9 @@ on the file and checking for an error exit code. There are also a small number of tests that explicitly run `vcdcheck` as part of their testing. -One test (`bsc.bugs/b611/`) checks for a bug in `bsc2bsv` -but otherwise this tool is not used. There are no tests -for the related tool, `bsv2bsc`. +There are a number of tests that check for bugs in the `bsc2bsv` tool (e.g., +`bsc.bugs/bluespec_inc/b611/`) and the `bsv2bsc` tool (e.g., +`bsc.bugs/github/gh529/`), but otherwise these tools are not used. ### Running some or all tests diff --git a/testsuite/bsc.bugs/github/gh529/.gitignore b/testsuite/bsc.bugs/github/gh529/.gitignore new file mode 100644 index 000000000..4c8c04f6d --- /dev/null +++ b/testsuite/bsc.bugs/github/gh529/.gitignore @@ -0,0 +1,2 @@ +# Generated file +Bug529.bs diff --git a/testsuite/bsc.bugs/github/gh529/Bug529.bsv b/testsuite/bsc.bugs/github/gh529/Bug529.bsv new file mode 100644 index 000000000..9d4d7e52f --- /dev/null +++ b/testsuite/bsc.bugs/github/gh529/Bug529.bsv @@ -0,0 +1,7 @@ +module helloWorld (Empty); + rule hello_world; + let hw = "Hello, World!"; + $display (hw); + $finish; + endrule +endmodule diff --git a/testsuite/bsc.bugs/github/gh529/Makefile b/testsuite/bsc.bugs/github/gh529/Makefile new file mode 100644 index 000000000..607fb8db7 --- /dev/null +++ b/testsuite/bsc.bugs/github/gh529/Makefile @@ -0,0 +1,5 @@ +# for "make clean" to work everywhere + +CONFDIR = $(realpath ../../..) + +include $(CONFDIR)/clean.mk diff --git a/testsuite/bsc.bugs/github/gh529/gh529.exp b/testsuite/bsc.bugs/github/gh529/gh529.exp new file mode 100644 index 000000000..2b69427e9 --- /dev/null +++ b/testsuite/bsc.bugs/github/gh529/gh529.exp @@ -0,0 +1,6 @@ +if [do_internal_checks] { + run_bsv2bsc Bug529.bsv + # We need a file extension that bsc recognizes + copy Bug529.bsv.bsv2bsc-out Bug529.bs + compile_pass Bug529.bs +}