Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

19 changed files:

Changes:

  • changelog.d/ghc-api-holes-ast-27111
    1
    +section: ghc-lib
    
    2
    +synopsis: Refactor ``HsWildCardTy`` to use ``HoleKind``
    
    3
    +issues: #27111
    
    4
    +mrs: !15817
    
    5
    +
    
    6
    +description: {
    
    7
    +Refactor the AST to store ``HoleKind`` not only in ``XHole``, but also in
    
    8
    +``XWildCardTy`` and ``XBndrWildCard``. This provides more information for exact
    
    9
    +printing of infix holes.
    
    10
    +}

  • compiler/GHC/Hs/Expr.hs-boot
    ... ... @@ -54,3 +54,5 @@ data HsUntypedSpliceResult thing
    54 54
     
    
    55 55
     type HsMatchContextRn = HsMatchContext (LIdP GhcRn)
    
    56 56
     type HsStmtContextRn = HsStmtContext (LIdP GhcRn)
    
    57
    +
    
    58
    +data HoleKind

  • compiler/GHC/Hs/Type.hs
    ... ... @@ -55,7 +55,7 @@ module GHC.Hs.Type (
    55 55
     
    
    56 56
             OpName(..),
    
    57 57
     
    
    58
    -        mkAnonWildCardTy, pprAnonWildCard,
    
    58
    +        pprAnonWildCard,
    
    59 59
     
    
    60 60
             hsOuterTyVarNames, hsOuterExplicitBndrs, mapHsOuterImplicit,
    
    61 61
             mkHsOuterImplicit, mkHsOuterExplicit,
    
    ... ... @@ -93,7 +93,7 @@ import GHC.Prelude
    93 93
     
    
    94 94
     import Language.Haskell.Syntax.Type
    
    95 95
     
    
    96
    -import {-# SOURCE #-} GHC.Hs.Expr ( pprUntypedSplice, HsUntypedSpliceResult(..) )
    
    96
    +import {-# SOURCE #-} GHC.Hs.Expr ( pprUntypedSplice, HsUntypedSpliceResult(..), HoleKind )
    
    97 97
     
    
    98 98
     import Language.Haskell.Syntax.Extension
    
    99 99
     import GHC.Core.DataCon ( SrcStrictness(..), SrcUnpackedness(..)
    
    ... ... @@ -342,8 +342,8 @@ type instance XXBndrKind (GhcPass p) = DataConCantHappen
    342 342
     
    
    343 343
     type instance XBndrVar (GhcPass p) = NoExtField
    
    344 344
     
    
    345
    -type instance XBndrWildCard GhcPs = EpToken "_"
    
    346
    -type instance XBndrWildCard GhcRn = NoExtField
    
    345
    +type instance XBndrWildCard GhcPs = HoleKind
    
    346
    +type instance XBndrWildCard GhcRn = HoleKind
    
    347 347
     type instance XBndrWildCard GhcTc = NoExtField
    
    348 348
     
    
    349 349
     type instance XXBndrVar (GhcPass p) = DataConCantHappen
    
    ... ... @@ -476,8 +476,8 @@ type instance XExplicitTupleTy GhcTc = [Kind]
    476 476
     
    
    477 477
     type instance XTyLit           (GhcPass _) = NoExtField
    
    478 478
     
    
    479
    -type instance XWildCardTy      GhcPs = EpToken "_"
    
    480
    -type instance XWildCardTy      GhcRn = NoExtField
    
    479
    +type instance XWildCardTy      GhcPs = HoleKind
    
    480
    +type instance XWildCardTy      GhcRn = HoleKind
    
    481 481
     type instance XWildCardTy      GhcTc = NoExtField
    
    482 482
     
    
    483 483
     type instance XXType           GhcPs = HsTypeGhcPsExt
    
    ... ... @@ -661,9 +661,6 @@ ignoreParens ty = ty
    661 661
     ************************************************************************
    
    662 662
     -}
    
    663 663
     
    
    664
    -mkAnonWildCardTy :: EpToken "_" -> HsType GhcPs
    
    665
    -mkAnonWildCardTy tok = HsWildCardTy tok
    
    666
    -
    
    667 664
     mkHsOpTy :: (Anno (IdOccGhcP p) ~ EpAnn a)
    
    668 665
              => PromotionFlag
    
    669 666
              -> LHsType (GhcPass p) -> LIdOccP (GhcPass p)
    

  • compiler/GHC/Parser.y
    ... ... @@ -2366,13 +2366,13 @@ tyop :: { LHsType GhcPs }
    2366 2366
             | tyvarop                       { sL1a $1 (HsTyVar noAnn NotPromoted $1) }
    
    2367 2367
             | SIMPLEQUOTE qconop            { sLLa $1 $> (HsTyVar (epTok $1) IsPromoted $2) }
    
    2368 2368
             | SIMPLEQUOTE varop             { sLLa $1 $> (HsTyVar (epTok $1) IsPromoted $2) }
    
    2369
    -        | '`' '_' '`'                   { sLLa $1 $> (mkAnonWildCardTy (epTok $2)) }   -- TODO: reuse hole_op (blocked on #27111)
    
    2369
    +        | hole_op                       { sLLa $1 $> (HsWildCardTy (HoleVar $1)) }
    
    2370 2370
     
    
    2371 2371
     atype :: { LHsType GhcPs }
    
    2372 2372
             : ntgtycon                       {% amsA' (sL1 $1 (HsTyVar noAnn NotPromoted $1)) }      -- Not including unit tuples
    
    2373 2373
             -- See Note [%shift: atype -> tyvar]
    
    2374 2374
             | tyvar %shift                   {% amsA' (sL1 $1 (HsTyVar noAnn NotPromoted $1)) }      -- (See Note [Unit tuples])
    
    2375
    -        | '_'   %shift                   { sL1a $1 $ mkAnonWildCardTy (epTok $1) }
    
    2375
    +        | '_'   %shift                   { sL1a $1 $ HsWildCardTy (HoleVar (sL1a $1 unnamedHoleRdrName)) }
    
    2376 2376
             | '*'                            {% do { warnStarIsType (getLoc $1)
    
    2377 2377
                                                    ; return $ sL1a $1 (HsStarTy (epUniTok $1)) } }
    
    2378 2378
     
    
    ... ... @@ -2486,7 +2486,7 @@ tv_bndr_no_braces :: { LHsTyVarBndr Specificity GhcPs }
    2486 2486
     
    
    2487 2487
     tyvar_wc :: { Located (HsBndrVar GhcPs) }
    
    2488 2488
             : tyvar                         { sL1 $1 (HsBndrVar noExtField $1) }
    
    2489
    -        | '_'                           { sL1 $1 (HsBndrWildCard (epTok $1)) }
    
    2489
    +        | '_'                           { sL1 $1 (HsBndrWildCard (HoleVar (sL1a $1 unnamedHoleRdrName))) }
    
    2490 2490
     
    
    2491 2491
     fds :: { Located (EpToken "|",[LHsFunDep GhcPs]) }
    
    2492 2492
             : {- empty -}                   { noLoc (NoEpTok,[]) }
    
    ... ... @@ -4021,7 +4021,7 @@ qopm :: { forall b. DisambInfixOp b => PV (LocatedN b) } -- used in section
    4021 4021
             | hole_op               { mkHsInfixHolePV $1 }
    
    4022 4022
     
    
    4023 4023
     hole_op :: { LocatedN RdrName }   -- used in sections
    
    4024
    -hole_op : '`' '_' '`'           {% amsr (sLL $1 $> (mkUnqual varName (fsLit "_")))
    
    4024
    +hole_op : '`' '_' '`'           {% amsr (sLL $1 $> unnamedHoleRdrName)
    
    4025 4025
                                                (NameAnn (NameBackquotes (epTok $1) (epTok $3)) (glR $2) []) }
    
    4026 4026
     
    
    4027 4027
     qvarop :: { LocatedN RdrName }
    

  • compiler/GHC/Parser/PostProcess.hs
    ... ... @@ -2072,7 +2072,7 @@ instance DisambECP (HsExpr GhcPs) where
    2072 2072
       mkHsQualLitPV (L (EpAnn l an csIn) a) = do
    
    2073 2073
         !cs <- getCommentsFor (locA l)
    
    2074 2074
         return $ L (EpAnn l an (cs Semi.<> csIn)) (HsQualLit noExtField a)
    
    2075
    -  mkHsWildCardPV l = return $ L (noAnnSrcSpan l) (HsHole (HoleVar (L (noAnnSrcSpan l) (mkUnqual varName (fsLit "_")))))
    
    2075
    +  mkHsWildCardPV l = return $ L (noAnnSrcSpan l) (HsHole (HoleVar (L (noAnnSrcSpan l) unnamedHoleRdrName)))
    
    2076 2076
       mkHsTySigPV l@(EpAnn anc an csIn) a sig anns = do
    
    2077 2077
         !cs <- getCommentsFor (locA l)
    
    2078 2078
         return $ L (EpAnn anc an (csIn Semi.<> cs)) (ExprWithTySig anns a (hsTypeToHsSigWcType sig))
    

  • compiler/GHC/Rename/HsType.hs
    ... ... @@ -235,10 +235,10 @@ rnWcBodyTyKi level ctxt nwc_rdrs hs_ty
    235 235
         rn_ty env (HsQualTy { hst_ctxt = L cx hs_ctxt
    
    236 236
                             , hst_body = hs_ty })
    
    237 237
           | Just (hs_ctxt1, hs_ctxt_last) <- snocView hs_ctxt
    
    238
    -      , L lx (HsWildCardTy _)  <- ignoreParens hs_ctxt_last
    
    238
    +      , L lx (HsWildCardTy h)  <- ignoreParens hs_ctxt_last
    
    239 239
           = do { (hs_ctxt1', fvs1) <- mapFvRn (rn_top_constraint env) hs_ctxt1
    
    240 240
                ; setSrcSpanA lx $ checkExtraConstraintWildCard env hs_ctxt1
    
    241
    -           ; let hs_ctxt' = hs_ctxt1' ++ [L lx (HsWildCardTy noExtField)]
    
    241
    +           ; let hs_ctxt' = hs_ctxt1' ++ [L lx (HsWildCardTy h)]
    
    242 242
                ; (hs_ty', fvs2) <- rnLHsTyKi env hs_ty
    
    243 243
                ; return (HsQualTy { hst_xqual = noExtField
    
    244 244
                                   , hst_ctxt = L cx hs_ctxt'
    
    ... ... @@ -732,7 +732,7 @@ rnHsTyKi env ty@(XHsType (HsRecTy {})) = do
    732 732
       addErr $
    
    733 733
         TcRnWithHsDocContext (rtke_ctxt env) $
    
    734 734
           TcRnIllegalRecordSyntax ty
    
    735
    -  return (HsWildCardTy noExtField, emptyFNs) -- trick to avoid `failWithTc`
    
    735
    +  return (HsWildCardTy GHC.Hs.HoleError, emptyFNs) -- trick to avoid `failWithTc`
    
    736 736
     
    
    737 737
     rnHsTyKi env ty@(HsExplicitListTy _ ip tys)
    
    738 738
       = do { checkDataKinds env ty
    
    ... ... @@ -746,9 +746,9 @@ rnHsTyKi env ty@(HsExplicitTupleTy _ ip tys)
    746 746
            ; (tys', fvs) <- mapFvRn (rnLHsTyKi env) tys
    
    747 747
            ; return (HsExplicitTupleTy noExtField ip tys', fvs) }
    
    748 748
     
    
    749
    -rnHsTyKi env (HsWildCardTy _)
    
    749
    +rnHsTyKi env (HsWildCardTy h)
    
    750 750
       = do { checkAnonWildCard env
    
    751
    -       ; return (HsWildCardTy noExtField, emptyFNs) }
    
    751
    +       ; return (HsWildCardTy h, emptyFNs) }
    
    752 752
     
    
    753 753
     {-
    
    754 754
     Note [Strict level checks with ExplicitLevelImports]
    
    ... ... @@ -1039,10 +1039,10 @@ bindHsQTyVars doc mb_assoc body_kv_occs hsq_bndrs thing_inside
    1039 1039
         get_bndr_loc (L l tvb) =
    
    1040 1040
           combineSrcSpans
    
    1041 1041
             (case hsBndrVar tvb of
    
    1042
    -          HsBndrWildCard tok ->
    
    1043
    -            case tok of
    
    1044
    -              NoEpTok   -> locA l
    
    1045
    -              EpTok loc -> locA loc
    
    1042
    +          HsBndrWildCard hole ->
    
    1043
    +            case hole of
    
    1044
    +              GHC.Hs.HoleError  -> locA l
    
    1045
    +              HoleVar (L loc _) -> locA loc
    
    1046 1046
               HsBndrVar _ ln   -> getLocA ln)
    
    1047 1047
             (case hsBndrKind tvb of
    
    1048 1048
               HsBndrNoKind _ -> noSrcSpan
    
    ... ... @@ -1310,8 +1310,8 @@ bindHsBndrVar mb_assoc (HsBndrVar _ lrdr@(L lv _)) thing_inside
    1310 1310
       = do { tv_nm  <- newTyVarNameRn mb_assoc lrdr
    
    1311 1311
            ; bindLocalNamesFV [tv_nm] $
    
    1312 1312
              thing_inside (HsBndrVar noExtField (L lv tv_nm)) }
    
    1313
    -bindHsBndrVar _ (HsBndrWildCard _) thing_inside
    
    1314
    -  = thing_inside (HsBndrWildCard noExtField)
    
    1313
    +bindHsBndrVar _ (HsBndrWildCard h) thing_inside
    
    1314
    +  = thing_inside (HsBndrWildCard h)
    
    1315 1315
     
    
    1316 1316
     rnHsBndrKind :: HsDocContext -> HsBndrKind GhcPs -> RnM (HsBndrKind GhcRn, FreeNames)
    
    1317 1317
     rnHsBndrKind _ (HsBndrNoKind _) = return (HsBndrNoKind noExtField, emptyFNs)
    

  • compiler/GHC/Rename/Pat.hs
    ... ... @@ -1430,8 +1430,8 @@ rn_ty_pat tyLit@(HsTyLit src lit) = do
    1430 1430
       check_data_kinds tyLit
    
    1431 1431
       pure (HsTyLit src (convertLit lit))
    
    1432 1432
     
    
    1433
    -rn_ty_pat (HsWildCardTy _) =
    
    1434
    -  pure (HsWildCardTy noExtField)
    
    1433
    +rn_ty_pat (HsWildCardTy h) =
    
    1434
    +  pure (HsWildCardTy h)
    
    1435 1435
     
    
    1436 1436
     rn_ty_pat (HsKindSig an ty ki) = do
    
    1437 1437
       ctxt <- askDocContext
    

  • compiler/GHC/Tc/Gen/App.hs
    ... ... @@ -1234,8 +1234,8 @@ expr_to_type earg =
    1234 1234
                ; return (L l (HsSpliceTy splice_result' splice)) }
    
    1235 1235
         go (L l (HsStar x))
    
    1236 1236
           = return (L l (HsStarTy x))
    
    1237
    -    go (L l (HsHole (HoleVar (L _ rdr))))
    
    1238
    -      | isUnderscore occ = return (L l (HsWildCardTy noExtField))
    
    1237
    +    go (L l (HsHole h@(HoleVar (L _ rdr))))
    
    1238
    +      | isUnderscore occ = return (L l (HsWildCardTy h))
    
    1239 1239
           | startsWithUnderscore occ =
    
    1240 1240
               -- See Note [Wildcards in the T2T translation]
    
    1241 1241
               do { wildcards_enabled <- xoptM LangExt.NamedWildCards
    

  • compiler/GHC/Tc/Gen/HsType.hs
    ... ... @@ -4772,8 +4772,8 @@ tyPatToBndr HsTP{hstp_body = (L _ hs_ty)} = go hs_ty where
    4772 4772
       go_bvar (HsTyVar _ _ tv)
    
    4773 4773
         | isTyVarName (getName tv)
    
    4774 4774
         = Just (HsBndrVar noExtField (fmap getName tv))
    
    4775
    -  go_bvar (HsWildCardTy _)
    
    4776
    -    = Just (HsBndrWildCard noExtField)
    
    4775
    +  go_bvar (HsWildCardTy h)
    
    4776
    +    = Just (HsBndrWildCard h)
    
    4777 4777
       go_bvar _ = Nothing
    
    4778 4778
     
    
    4779 4779
     {- Note [Type patterns: binders and unifiers]
    

  • compiler/GHC/Tc/Gen/Pat.hs
    ... ... @@ -515,7 +515,7 @@ pat_to_type (VarPat _ lname) =
    515 515
          ; return b }
    
    516 516
       where b = noLocA (HsTyVar noAnn NotPromoted $ fmap noUserRdr lname)
    
    517 517
     pat_to_type (WildPat _) = return b
    
    518
    -  where b = noLocA (HsWildCardTy noExtField)
    
    518
    +  where b = noLocA (HsWildCardTy (HoleVar (noLocA unnamedHoleRdrName)))
    
    519 519
     pat_to_type (SigPat _ pat sig_ty)
    
    520 520
       = do { t <- pat_to_type (unLoc pat)
    
    521 521
            ; let { !(HsPS x_hsps k) = sig_ty
    

  • compiler/GHC/ThToHs.hs
    ... ... @@ -1798,7 +1798,8 @@ cvtTypeKind typeOrKind ty
    1798 1798
                  -> mk_apps (HsTyLit noExtField (cvtTyLit lit)) tys'
    
    1799 1799
     
    
    1800 1800
                WildCardT
    
    1801
    -             -> mk_apps (mkAnonWildCardTy noAnn) tys'
    
    1801
    +             -> do { n' <- wrapLN (return unnamedHoleRdrName)
    
    1802
    +                   ; mk_apps (HsWildCardTy (HoleVar n')) tys' }
    
    1802 1803
     
    
    1803 1804
                InfixT t1 s t2
    
    1804 1805
                  -> do { s'  <- tconName s
    

  • testsuite/tests/ghc-api/T25121_status.stdout
    ... ... @@ -20,9 +20,7 @@ X(ExplicitList) mismatch
    20 20
     X(ExplicitTuple) mismatch
    
    21 21
       >>> ((EpaLocation' [GenLocated (EpaLocation' NoComments) EpaComment]),(EpaLocation' [GenLocated (EpaLocation' NoComments) EpaComment]))
    
    22 22
       <<< ((EpToken "'"),(EpToken "("),(EpToken ")"))
    
    23
    -X(Hole) mismatch
    
    24
    -  >>> HoleKind
    
    25
    -  <<< EpToken "_"
    
    23
    +X(Hole) match = HoleKind
    
    26 24
     
    
    27 25
     Extension fields @GhcRn
    
    28 26
     -----------------------
    
    ... ... @@ -50,9 +48,7 @@ X(UntypedSplice) mismatch
    50 48
       <<< HsUntypedSpliceResult (GenLocated (EpAnn AnnListItem) (HsType (GhcPass 'Renamed)))
    
    51 49
     X(ExplicitList) match = NoExtField
    
    52 50
     X(ExplicitTuple) match = NoExtField
    
    53
    -X(Hole) mismatch
    
    54
    -  >>> HoleKind
    
    55
    -  <<< NoExtField
    
    51
    +X(Hole) match = HoleKind
    
    56 52
     
    
    57 53
     Extension fields @GhcTc
    
    58 54
     -----------------------
    

  • testsuite/tests/printer/Makefile
    ... ... @@ -832,6 +832,11 @@ PprLetIn:
    832 832
     	$(CHECK_PPR)   $(LIBDIR) PprLetIn.hs
    
    833 833
     	$(CHECK_EXACT) $(LIBDIR) PprLetIn.hs
    
    834 834
     
    
    835
    +.PHONY: PprInfixHole
    
    836
    +PprInfixHole:
    
    837
    +	$(CHECK_PPR)   $(LIBDIR) PprInfixHole.hs
    
    838
    +	$(CHECK_EXACT) $(LIBDIR) PprInfixHole.hs
    
    839
    +
    
    835 840
     .PHONY: CaseAltComments
    
    836 841
     CaseAltComments:
    
    837 842
     	$(CHECK_PPR)   $(LIBDIR) CaseAltComments.hs
    

  • testsuite/tests/printer/PprInfixHole.hs
    1
    +{-# LANGUAGE PartialTypeSignatures #-}
    
    2
    +module PprInfixHole where
    
    3
    +
    
    4
    +f1 a b = a `_` b
    
    5
    +f2 a b = a ` _ ` b
    
    6
    +
    
    7
    +t1 :: Int `_` Bool
    
    8
    +t2 :: Int ` _ ` Bool
    
    9
    +t1 = Left 0
    
    10
    +t2 = Left 0

  • testsuite/tests/printer/all.T
    ... ... @@ -199,6 +199,7 @@ test('ListTuplePuns', extra_files(['ListTuplePuns.hs']), ghci_script, ['ListTupl
    199 199
     test('AnnotationNoListTuplePuns', [ignore_stderr, req_ppr_deps], makefile_test, ['AnnotationNoListTuplePuns'])
    
    200 200
     test('Test24533', [ignore_stderr, req_ppr_deps], makefile_test, ['Test24533'])
    
    201 201
     test('PprLetIn', [ignore_stderr, req_ppr_deps], makefile_test, ['PprLetIn'])
    
    202
    +test('PprInfixHole', [ignore_stderr, req_ppr_deps], makefile_test, ['PprInfixHole'])
    
    202 203
     test('CaseAltComments', [ignore_stderr, req_ppr_deps], makefile_test, ['CaseAltComments'])
    
    203 204
     test('MatchPatComments', [ignore_stderr, req_ppr_deps], makefile_test, ['MatchPatComments'])
    
    204 205
     test('Test24748', [ignore_stderr, req_ppr_deps], makefile_test, ['Test24748'])
    

  • utils/check-exact/ExactPrint.hs
    ... ... @@ -2844,6 +2844,14 @@ instance ExactPrint (GRHS GhcPs (LocatedA (HsCmd GhcPs))) where
    2844 2844
     
    
    2845 2845
     -- ---------------------------------------------------------------------
    
    2846 2846
     
    
    2847
    +exactHole :: (Monad m, Monoid w) => HoleKind -> EP w m HoleKind
    
    2848
    +exactHole (HoleVar n) = do
    
    2849
    +  n' <- markAnnotated n
    
    2850
    +  return (HoleVar n')
    
    2851
    +exactHole HoleError =
    
    2852
    +  -- TODO: Adapt 'HoleError' to include the 'SourceText':
    
    2853
    +  error "Cannot exact print HoleError"
    
    2854
    +
    
    2847 2855
     instance ExactPrint (HsExpr GhcPs) where
    
    2848 2856
       getAnnotationEntry _ = NoEntryVal
    
    2849 2857
       setAnnotationAnchor a _ _ _s = a
    
    ... ... @@ -2856,14 +2864,9 @@ instance ExactPrint (HsExpr GhcPs) where
    2856 2864
           then markAnnotated n
    
    2857 2865
           else return n
    
    2858 2866
         return (HsVar x n')
    
    2859
    -  exact (HsHole (HoleVar n)) = do
    
    2860
    -    let pun_RDR = "pun-right-hand-side"
    
    2861
    -    n' <- if (showPprUnsafe n /= pun_RDR)
    
    2862
    -      then markAnnotated n
    
    2863
    -      else return n
    
    2864
    -    return (HsHole (HoleVar n'))
    
    2865
    -  -- TODO: Adapt 'HoleError' to include the 'SourceText':
    
    2866
    -  exact (HsHole HoleError) = error "Cannot exact print HoleError"
    
    2867
    +  exact (HsHole h) = do
    
    2868
    +    h' <- exactHole h
    
    2869
    +    return (HsHole h')
    
    2867 2870
       exact x@(HsOverLabel src l) = do
    
    2868 2871
         printStringAdvanceA "#" >> return ()
    
    2869 2872
         case src of
    
    ... ... @@ -3927,9 +3930,9 @@ instance ExactPrint (HsBndrVar GhcPs) where
    3927 3930
       exact (HsBndrVar x n) = do
    
    3928 3931
         n' <- markAnnotated n
    
    3929 3932
         return (HsBndrVar x n')
    
    3930
    -  exact (HsBndrWildCard t) = do
    
    3931
    -    t' <- markEpToken t
    
    3932
    -    return (HsBndrWildCard t')
    
    3933
    +  exact (HsBndrWildCard h) = do
    
    3934
    +    h' <- exactHole h
    
    3935
    +    return (HsBndrWildCard h')
    
    3933 3936
     
    
    3934 3937
     -- ---------------------------------------------------------------------
    
    3935 3938
     
    
    ... ... @@ -4034,7 +4037,9 @@ instance ExactPrint (HsType GhcPs) where
    4034 4037
       exact (HsTyLit an lit) = do
    
    4035 4038
         lit' <- withPpr lit
    
    4036 4039
         return (HsTyLit an lit')
    
    4037
    -  exact t@(HsWildCardTy _) = printStringAdvance "_" >> return t
    
    4040
    +  exact (HsWildCardTy h) = do
    
    4041
    +    h' <- exactHole h
    
    4042
    +    return (HsWildCardTy h')
    
    4038 4043
       exact x = error $ "missing match for HsType:" ++ showAst x
    
    4039 4044
     
    
    4040 4045
     -- ---------------------------------------------------------------------
    

  • utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
    ... ... @@ -320,7 +320,7 @@ ppCtor sDocContext dat subdocs con@ConDeclH98{con_args = con_args'} =
    320 320
             tv, tvk :: HsType GhcRn
    
    321 321
             tv = case bvar of
    
    322 322
               HsBndrVar _ n -> HsTyVar noAnn NotPromoted (fmap noUserRdr n)
    
    323
    -          HsBndrWildCard _ -> HsWildCardTy noExtField
    
    323
    +          HsBndrWildCard h -> HsWildCardTy h
    
    324 324
             tvk = case bkind of
    
    325 325
               HsBndrNoKind _   -> tv
    
    326 326
               HsBndrKind _ lty -> HsKindSig noAnn (reL tv) lty
    

  • utils/haddock/haddock-api/src/Haddock/Convert.hs
    ... ... @@ -122,7 +122,7 @@ tyThingToLHsDecl prr t = case t of
    122 122
     
    
    123 123
                 cvt' :: HsBndrVar GhcRn -> HsType GhcRn
    
    124 124
                 cvt' (HsBndrVar _ nm)   = HsTyVar noAnn NotPromoted (fmap noUserRdr nm)
    
    125
    -            cvt' (HsBndrWildCard _) = HsWildCardTy noExtField
    
    125
    +            cvt' (HsBndrWildCard h) = HsWildCardTy h
    
    126 126
     
    
    127 127
                 -- \| Convert a LHsTyVarBndr to an equivalent LHsType.
    
    128 128
                 hsLTyVarBndrToType :: LHsTyVarBndr flag GhcRn -> LHsType GhcRn
    

  • utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
    ... ... @@ -326,10 +326,10 @@ addClassContext _ _ sig = sig -- E.g. a MinimalSig is fine
    326 326
     
    
    327 327
     lHsQTyVarsToTypes :: LHsQTyVars GhcRn -> [LHsTypeArg GhcRn]
    
    328 328
     lHsQTyVarsToTypes tvs =
    
    329
    -  [ HsValArg noExtField $ noLocA (case hsLTyVarName tv of
    
    330
    -      Nothing -> HsWildCardTy noExtField
    
    331
    -      Just nm -> HsTyVar noAnn NotPromoted (noLocA $ noUserRdr nm))
    
    332
    -  | tv <- hsq_explicit tvs
    
    329
    +  [ HsValArg noExtField $ noLocA (case hsBndrVar (unLoc tvb) of
    
    330
    +      HsBndrVar _ nm   -> HsTyVar noAnn NotPromoted (fmap noUserRdr nm)
    
    331
    +      HsBndrWildCard h -> HsWildCardTy h)
    
    332
    +  | tvb <- hsq_explicit tvs
    
    333 333
       ]
    
    334 334
     
    
    335 335
     hsQTvExplicitBinders :: LHsQTyVars DocNameI -> [LHsTyVarBndr (HsBndrVis DocNameI) DocNameI]