fix #4352 and add regression test

This commit is contained in:
Paul Chiusano 2023-11-04 09:27:25 -05:00
parent ddf15e39b3
commit 6d704104a5
3 changed files with 6 additions and 1 deletions

View File

@ -228,7 +228,7 @@ pretty0
tm' <- pretty0 (ac 10 Normal im doc) tm
tp' <- TypePrinter.pretty0 im 0 t
pure . paren (p >= 0) $ tm' <> PP.hang (fmt S.TypeAscriptionColon " :") tp'
Int' i -> pure . fmt S.NumericLiteral $ (if i >= 0 then l "+" else mempty) <> l (show i)
Int' i -> pure . fmt S.NumericLiteral . l $ (if i >= 0 then ("+" ++ show i) else (show i))
Nat' u -> pure . fmt S.NumericLiteral . l $ show u
Float' f -> pure . fmt S.NumericLiteral . l $ show f
-- TODO How to handle Infinity, -Infinity and NaN? Parser cannot parse

View File

@ -265,6 +265,9 @@ So we can see the pretty-printed output:
Some x -> x
None -> bug "oops"
fix_4352 : Doc2
fix_4352 = {{ `` +1 `` }}
Fix_525.bar.quaffle : Nat
Fix_525.bar.quaffle = 32

View File

@ -466,3 +466,5 @@ test3 = do
-- this would previously get printed as `Join.Join`
structural type foo.Join =
Table | Join Boolean | Values [Nat]
fix_4352 = {{``+1``}}