@@ -115,16 +115,29 @@ p_hsType = \case
115 Promoted -> txt "'"
115 Promoted -> txt "'"
116 NotPromoted -> return ()
116 NotPromoted -> return ()
117 brackets $ do
117 brackets $ do
118+ -- If both this list itself and the first element is promoted,
119+ -- we need to put a space in between or it fails to parse.
118− case xs of
120+ case (p, xs) of
119− ((L _ (HsTyVar _ Promoted _)):_) -> space
121+ (Promoted, ((L _ t):_)) | isPromoted t -> space
120 _ -> return ()
122 _ -> return ()
121 sitcc $ sep (comma >> breakpoint) (sitcc . located' p_hsType) xs
123 sitcc $ sep (comma >> breakpoint) (sitcc . located' p_hsType) xs
122 HsExplicitTupleTy NoExt xs -> do
124 HsExplicitTupleTy NoExt xs -> do
128+ ((L _ t):_) | isPromoted t -> space
124− parens $ sep (comma >> breakpoint) (located' p_hsType) xs
130+ sep (comma >> breakpoint) (located' p_hsType) xs
125 HsTyLit NoExt t -> atom t
131 HsTyLit NoExt t -> atom t
126 HsWildCardTy NoExt -> txt "_"
132 HsWildCardTy NoExt -> txt "_"
127 XHsType (NHsCoreTy t) -> atom t
133 XHsType (NHsCoreTy t) -> atom t
136+ HsTyVar _ Promoted _ -> True
137+ HsExplicitListTy _ _ _ -> True
138+ HsExplicitTupleTy _ _ -> True
129p_hsContext :: HsContext GhcPs -> R ()
142p_hsContext :: HsContext GhcPs -> R ()
130p_hsContext = \case
143p_hsContext = \case