diff options
Diffstat (limited to 'compiler/GHC/Parser')
-rw-r--r-- | compiler/GHC/Parser/HaddockLex.x | 6 | ||||
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 13 |
2 files changed, 9 insertions, 10 deletions
diff --git a/compiler/GHC/Parser/HaddockLex.x b/compiler/GHC/Parser/HaddockLex.x index e215769f9e..682ede39a4 100644 --- a/compiler/GHC/Parser/HaddockLex.x +++ b/compiler/GHC/Parser/HaddockLex.x @@ -148,7 +148,7 @@ lexStringLiteral identParser (L l sl@(StringLiteral _ fs _)) RealSrcSpan span _ -> [(RealSrcSpan span' Strict.Nothing, tok) | (span', tok) <- alexScanTokens (realSrcSpanStart span) bs] UnhelpfulSpan reason -> [(UnhelpfulSpan reason, tok) | (_, tok) <- alexScanTokens fakeLoc bs] - fakeLoc = mkRealSrcLoc (mkFastString "") 0 0 + fakeLoc = mkRealSrcLoc nilFS 0 0 -- | Lex identifiers from a docstring. lexHsDoc :: P (LocatedN RdrName) -- ^ A precise identifier parser @@ -169,7 +169,7 @@ lexHsDoc identParser doc = plausibleIdents (L (UnhelpfulSpan reason) (HsDocStringChunk s)) = [(UnhelpfulSpan reason, tok) | (_, tok) <- alexScanTokens fakeLoc s] -- preserve the original reason - fakeLoc = mkRealSrcLoc (mkFastString "") 0 0 + fakeLoc = mkRealSrcLoc nilFS 0 0 validateIdentWith :: P (LocatedN RdrName) -> SrcSpan -> ByteString -> Maybe (Located RdrName) validateIdentWith identParser mloc str0 = @@ -191,7 +191,7 @@ validateIdentWith identParser mloc str0 = buffer = stringBufferFromByteString str0 realSrcLc = case mloc of RealSrcSpan loc _ -> realSrcSpanStart loc - UnhelpfulSpan _ -> mkRealSrcLoc (mkFastString "") 0 0 + UnhelpfulSpan _ -> mkRealSrcLoc nilFS 0 0 pstate = initParserState pflags buffer realSrcLc in case unP identParser pstate of POk _ name -> Just $ case mloc of diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index 02a4723f6f..8e08a8c874 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -965,8 +965,7 @@ mkRuleTyVarBndrs = fmap cvt_one checkRuleTyVarBndrNames :: [LHsTyVarBndr flag GhcPs] -> P () checkRuleTyVarBndrNames = mapM_ (check . fmap hsTyVarName) where check (L loc (Unqual occ)) = - -- TODO: don't use string here, OccName has a Unique/FastString - when ((occNameString occ ==) `any` ["forall","family","role"]) + when (occNameFS occ `elem` [fsLit "forall",fsLit "family",fsLit "role"]) (addFatalError $ mkPlainErrorMsgEnvelope (locA loc) $ (PsErrParseErrorOnInput occ)) check _ = panic "checkRuleTyVarBndrNames" @@ -1009,7 +1008,7 @@ checkTyClHdr is_cls ty -- workaround to define '*' despite StarIsType go _ (HsParTy an (L l (HsStarTy _ isUni))) acc ops' cps' fix = do { addPsMessage (locA l) PsWarnStarBinder - ; let name = mkOccName tcClsName (starSym isUni) + ; let name = mkOccNameFS tcClsName (starSym isUni) ; let a' = newAnns l an ; return (L a' (Unqual name), acc, fix , (reverse ops') ++ cps') } @@ -2776,7 +2775,7 @@ mkExport (L lc cconv) (L le (StringLiteral esrc entity _), v, ty) -- want z-encoding (e.g. names with z's in them shouldn't be doubled) -- mkExtName :: RdrName -> CLabelString -mkExtName rdrNm = mkFastString (occNameString (rdrNameOcc rdrNm)) +mkExtName rdrNm = occNameFS (rdrNameOcc rdrNm) -------------------------------------------------------------------------------- -- Help with module system imports/exports @@ -3142,9 +3141,9 @@ token_location_widenR (TokenLoc (EpaDelta _ _)) _ = ----------------------------------------------------------------------------- -- Token symbols -starSym :: Bool -> String -starSym True = "★" -starSym False = "*" +starSym :: Bool -> FastString +starSym True = fsLit "★" +starSym False = fsLit "*" ----------------------------------------- -- Bits and pieces for RecordDotSyntax. |