aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/GhcUtils.hs
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2022-03-29 16:36:45 +0200
committersheaf <sam.derbyshire@gmail.com>2022-04-01 12:02:02 +0200
commit58237d76c96325f25627bfd7cdad5b93364d29a4 (patch)
tree4ecfac250db22272c83acc777a8c4157d28af3b1 /haddock-api/src/Haddock/GhcUtils.hs
parent559e41505e81d93939e9afa6aa9793b0a428924f (diff)
Keep track of promotion ticks in HsOpTy
Keeping track of promotion ticks in HsOpTy allows us to properly pretty-print promoted constructors such as lists.
Diffstat (limited to 'haddock-api/src/Haddock/GhcUtils.hs')
-rw-r--r--haddock-api/src/Haddock/GhcUtils.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/haddock-api/src/Haddock/GhcUtils.hs b/haddock-api/src/Haddock/GhcUtils.hs
index 9f9120fa..7c1dc73b 100644
--- a/haddock-api/src/Haddock/GhcUtils.hs
+++ b/haddock-api/src/Haddock/GhcUtils.hs
@@ -229,7 +229,7 @@ addClassContext cls tvs0 (L pos (ClassOpSig _ _ lname ltype))
= L loc (HsQualTy { hst_xqual = noExtField
, hst_ctxt = add_ctxt (noLocA []), hst_body = L loc ty })
- extra_pred = nlHsTyConApp Prefix cls (lHsQTyVarsToTypes tvs0)
+ extra_pred = nlHsTyConApp NotPromoted Prefix cls (lHsQTyVarsToTypes tvs0)
add_ctxt (L loc preds) = L loc (extra_pred : preds)
@@ -365,8 +365,8 @@ reparenTypePrec = go
= paren p PREC_CON $ HsAppTy x (goL PREC_FUN fun_ty) (goL PREC_CON arg_ty)
go p (HsAppKindTy x fun_ty arg_ki)
= paren p PREC_CON $ HsAppKindTy x (goL PREC_FUN fun_ty) (goL PREC_CON arg_ki)
- go p (HsOpTy x ty1 op ty2)
- = paren p PREC_FUN $ HsOpTy x (goL PREC_OP ty1) op (goL PREC_OP ty2)
+ go p (HsOpTy x prom ty1 op ty2)
+ = paren p PREC_FUN $ HsOpTy x prom (goL PREC_OP ty1) op (goL PREC_OP ty2)
go p (HsParTy _ t) = unXRec @a $ goL p t -- pretend the paren doesn't exist - it will be added back if needed
go _ t@HsTyVar{} = t
go _ t@HsStarTy{} = t