Skip to content

Commit eb90042

Browse files
committed
Fix build with GHC 9
1 parent f4faed5 commit eb90042

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

Diff for: ghcide/src/Development/IDE/GHC/Compat/Core.hs

+16-4
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ module Development.IDE.GHC.Compat.Core (
190190
SrcLoc.RealSrcSpan,
191191
pattern RealSrcSpan,
192192
SrcLoc.RealSrcLoc,
193-
SrcLoc.SrcLoc(..),
193+
pattern RealSrcLoc,
194+
SrcLoc.SrcLoc(SrcLoc.UnhelpfulLoc),
194195
BufSpan,
195196
SrcLoc.leftmost_smallest,
196197
SrcLoc.containsSpan,
@@ -511,7 +512,7 @@ import GHC.Types.TyThing.Ppr
511512
#else
512513
import GHC.Types.Name.Set
513514
#endif
514-
import GHC.Types.SrcLoc (BufSpan, SrcSpan (UnhelpfulSpan))
515+
import GHC.Types.SrcLoc (BufPos, BufSpan, SrcSpan (UnhelpfulSpan), SrcLoc(UnhelpfulLoc))
515516
import qualified GHC.Types.SrcLoc as SrcLoc
516517
import GHC.Types.Unique.Supply
517518
import GHC.Types.Var (Var (varName), setTyVarUnique,
@@ -637,10 +638,11 @@ import Var (Var (varName), setTyVarUnique,
637638
#if MIN_VERSION_ghc(8,10,0)
638639
import Coercion (coercionKind)
639640
import Predicate
640-
import SrcLoc (SrcSpan (UnhelpfulSpan))
641+
import SrcLoc (SrcSpan (UnhelpfulSpan), SrcLoc (UnhelpfulLoc))
641642
#else
642643
import SrcLoc (RealLocated,
643-
SrcSpan (UnhelpfulSpan))
644+
SrcSpan (UnhelpfulSpan),
645+
SrcLoc (UnhelpfulLoc))
644646
#endif
645647
#endif
646648

@@ -651,6 +653,7 @@ import System.FilePath
651653

652654
#if !MIN_VERSION_ghc(9,0,0)
653655
type BufSpan = ()
656+
type BufPos = ()
654657
#endif
655658

656659
pattern RealSrcSpan :: SrcLoc.RealSrcSpan -> Maybe BufSpan -> SrcLoc.SrcSpan
@@ -662,6 +665,15 @@ pattern RealSrcSpan x y <- ((,Nothing) -> (SrcLoc.RealSrcSpan x, y)) where
662665
#endif
663666
{-# COMPLETE RealSrcSpan, UnhelpfulSpan #-}
664667

668+
pattern RealSrcLoc :: SrcLoc.RealSrcLoc -> Maybe BufPos-> SrcLoc.SrcLoc
669+
#if MIN_VERSION_ghc(9,0,0)
670+
pattern RealSrcLoc x y = SrcLoc.RealSrcLoc x y
671+
#else
672+
pattern RealSrcLoc x y <- ((,Nothing) -> (SrcLoc.RealSrcLoc x, y)) where
673+
RealSrcLoc x _ = SrcLoc.RealSrcLoc x
674+
#endif
675+
{-# COMPLETE RealSrcLoc, UnhelpfulLoc #-}
676+
665677

666678
pattern AvailTC :: Name -> [Name] -> [FieldLabel] -> Avail.AvailInfo
667679
#if __GLASGOW_HASKELL__ >= 902

Diff for: ghcide/src/Development/IDE/Plugin/Completions/Logic.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ mkCompl
210210
T.intercalate sectionSeparator docs'
211211
pprLineCol :: SrcLoc -> T.Text
212212
pprLineCol (UnhelpfulLoc fs) = T.pack $ unpackFS fs
213-
pprLineCol (RealSrcLoc loc) =
213+
pprLineCol (RealSrcLoc loc _) =
214214
"line " <> ppr(srcLocLine loc) <> ", column " <> ppr(srcLocCol loc)
215215

216216

0 commit comments

Comments
 (0)