Skip to content

Commit 9de6064

Browse files
committed
fix estg pretty printer: indent case scrutinees when necessary, i.e. when they have SourceNotes
1 parent bd3e56d commit 9de6064

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

external-stg/lib/Stg/Pretty.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,19 +410,19 @@ pprExpr exp = do
410410
StgLit l -> pretty l
411411
StgCase x b at [Alt AltDefault [] rhs] -> sep
412412
[ withStgPoint (SP_CaseScrutineeExpr $ Id b) $
413-
pprBinder b <+> text "<-" <+> pprExpr x
413+
pprBinder b <+> text "<-" <+> nest 2 (pprExpr x)
414414
, withStgPoint (SP_AltExpr (Id b) 0) $
415415
pprExpr rhs
416416
]
417417
StgCase x b at [Alt con bndrs rhs] -> sep
418418
[ withStgPoint (SP_CaseScrutineeExpr $ Id b) $
419-
pprBinder b <+> text "@" <+> parens (hsep $ pretty con : map (pprBinder) bndrs) <+> text "<-" <+> pprExpr x
419+
pprBinder b <+> text "@" <+> parens (hsep $ pretty con : map (pprBinder) bndrs) <+> text "<-" <+> nest 2 (pprExpr x)
420420
, withStgPoint (SP_AltExpr (Id b) 0) $
421421
pprExpr rhs
422422
]
423423
StgCase x b at alts -> sep
424424
[ withStgPoint (SP_CaseScrutineeExpr $ Id b) $
425-
pprBinder b <+> text "<-" <+> pprExpr x
425+
pprBinder b <+> text "<-" <+> nest 2 (pprExpr x)
426426
, text "case" <+> pprVar b <+> text "of"
427427
, indent 2 $ vcat $ putDefaultLast alts [pprAlt (Id b) idx a | (idx, a) <- zip [0..] alts]
428428
]

0 commit comments

Comments
 (0)