From 8e966858bcb56b83488bd22dc49864107c9476d8 Mon Sep 17 00:00:00 2001 From: Shayne Fletcher Date: Tue, 22 Oct 2024 11:47:03 -0400 Subject: [PATCH] updates for compatibility with GHC HEAD --- src/GHC/Util/Brackets.hs | 6 ------ src/GHC/Util/FreeVars.hs | 5 ----- src/Hint/Pattern.hs | 2 +- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/GHC/Util/Brackets.hs b/src/GHC/Util/Brackets.hs index 020b60c6..e543a7fd 100644 --- a/src/GHC/Util/Brackets.hs +++ b/src/GHC/Util/Brackets.hs @@ -36,8 +36,6 @@ instance Brackets (LocatedA (HsExpr GhcPs)) where isAtom (L _ x) = case x of HsVar{} -> True HsUnboundVar{} -> True - -- Technically atomic, but lots of people think it shouldn't be - HsRecSel{} -> False -- Only relevant for OverloadedRecordDot extension HsGetField{} -> True HsOverLabel{} -> True @@ -61,12 +59,10 @@ instance Brackets (LocatedA (HsExpr GhcPs)) where _ -> False where isNegativeLit (HsInt _ i) = il_neg i - isNegativeLit (HsRat _ f _) = fl_neg f isNegativeLit (HsFloatPrim _ f) = fl_neg f isNegativeLit (HsDoublePrim _ f) = fl_neg f isNegativeLit (HsIntPrim _ x) = x < 0 isNegativeLit (HsInt64Prim _ x) = x < 0 - isNegativeLit (HsInteger _ x _) = x < 0 isNegativeLit _ = False isNegativeOverLit OverLit {ol_val=HsIntegral i} = il_neg i isNegativeOverLit OverLit {ol_val=HsFractional f} = fl_neg f @@ -133,8 +129,6 @@ instance Brackets (LocatedA (Pat GhcPs)) where isSignedLit HsInt{} = True isSignedLit HsIntPrim{} = True isSignedLit HsInt64Prim{} = True - isSignedLit HsInteger{} = True - isSignedLit HsRat{} = True isSignedLit HsFloatPrim{} = True isSignedLit HsDoublePrim{} = True isSignedLit _ = False diff --git a/src/GHC/Util/FreeVars.hs b/src/GHC/Util/FreeVars.hs index f9605652..315150c3 100644 --- a/src/GHC/Util/FreeVars.hs +++ b/src/GHC/Util/FreeVars.hs @@ -128,7 +128,6 @@ instance FreeVars (LocatedA (HsExpr GhcPs)) where freeVars (L _ (HsUntypedBracket _ (ExpBr _ e))) = freeVars e freeVars (L _ (HsUntypedBracket _ (VarBr _ _ v))) = Set.fromList [occName (unLoc v)] - freeVars (L _ HsRecSel{}) = mempty -- Variable pointing to a record selector. freeVars (L _ HsOverLabel{}) = mempty -- Overloaded label. The id of the in-scope fromLabel. freeVars (L _ HsIPVar{}) = mempty -- Implicit parameter. freeVars (L _ HsOverLit{}) = mempty -- Overloaded literal. @@ -172,10 +171,6 @@ instance FreeVars (LocatedA (HsFieldBind (LocatedA (FieldOcc GhcPs)) (LocatedA ( freeVars o@(L _ (HsFieldBind _ x _ True)) = Set.singleton $ occName $ unLoc $ foLabel $ unLoc x -- a pun freeVars o@(L _ (HsFieldBind _ _ x _)) = freeVars x -instance FreeVars (LocatedA (HsFieldBind (LocatedA (AmbiguousFieldOcc GhcPs)) (LocatedA (HsExpr GhcPs)))) where - freeVars (L _ (HsFieldBind _ x _ True)) = Set.singleton $ rdrNameOcc $ ambiguousFieldOccRdrName $ unLoc x -- a pun - freeVars (L _ (HsFieldBind _ _ x _)) = freeVars x - instance FreeVars (LocatedA (HsFieldBind (LocatedAn NoEpAnns (FieldLabelStrings GhcPs)) (LocatedA (HsExpr GhcPs)))) where freeVars (L _ (HsFieldBind _ _ x _)) = freeVars x diff --git a/src/Hint/Pattern.hs b/src/Hint/Pattern.hs index 6b6d787f..8da7b0d2 100644 --- a/src/Hint/Pattern.hs +++ b/src/Hint/Pattern.hs @@ -69,7 +69,7 @@ import Data.Either import Refact.Types hiding (RType(Pattern, Match), SrcSpan) import Refact.Types qualified as R (RType(Pattern, Match), SrcSpan) -import GHC.Hs +import GHC.Hs hiding (asPattern) import GHC.Types.SrcLoc import GHC.Types.Name.Reader import GHC.Types.Name.Occurrence