Skip to content

Commit 7cf5f3d

Browse files
committed
Merge branch '9.6' into 9.8
2 parents 9cd0acb + a4f5a71 commit 7cf5f3d

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

.github/workflows/build-test-deploy.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- '.github/workflows/*.yml'
1313
branches:
1414
- 'master'
15+
- '9.6'
1516
pull_request:
1617
branches:
1718
- 'master'
@@ -29,8 +30,8 @@ jobs:
2930
strategy:
3031
fail-fast: false
3132
matrix:
32-
ghc: ['8.10.7']
33-
cabal: ['3.4.0.0']
33+
ghc: ['9.6.3']
34+
cabal: ['3.10.2.1']
3435

3536
steps:
3637
- uses: actions/checkout@v2
@@ -120,7 +121,7 @@ jobs:
120121
with:
121122
context: .
122123
build-args: |
123-
"HASKELL_VERSION=8.10.7"
124+
"HASKELL_VERSION=9.6.4"
124125
"PROPR_VERSION=1.0.0"
125126
push: ${{ github.event_name != 'pull_request' }}
126127
tags: ${{ steps.meta.outputs.tags }}

src/PropR/Check.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import qualified Data.Set as Set
2222
import Debug.Trace (trace, traceShow)
2323
import GHC.Data.FastString (fsLit)
2424
import GHC
25-
import GHC.Plugins (Outputable (ppr), occName, showSDocUnsafe, mkVarOcc, mkRdrUnqual, DoPmc(..))
25+
import GHC.Plugins (Outputable (ppr), occName, showSDocUnsafe, mkVarOcc, mkRdrUnqual)
2626
import GHC.Data.Bag (emptyBag, listToBag, unionManyBags, unitBag)
2727
import GHC.Types.Basic (Origin (..), PromotionFlag (..))
2828
import GHC.Types.SourceText (IntegralLit (..), SourceText (..))
@@ -80,8 +80,8 @@ checkPackages = ["base", "check-helpers"]
8080
-- | Looks up the given Name in a LHsExpr
8181
baseFun :: RdrName -> LHsExpr GhcPs -> LHsBind GhcPs
8282
baseFun nm val =
83-
-- DoPmc or SkipPmc?
84-
noLocA $ FunBind NoExtField (noLocA nm) (MG (Generated DoPmc) (noLocA [base_case]))
83+
-- Note: Generated DoPmc in 9.8
84+
noLocA $ FunBind NoExtField (noLocA nm) (MG (Generated) (noLocA [base_case]))
8585
where
8686
base_case =
8787
noLocA $

src/PropR/Plugin.hs

+6-5
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ synthPlug CompConf {..} useCache local_exprs plugRef =
9494
gbl_env <- getGlobalRdrEnv
9595
let lcl_env =
9696
case th_hole h of
97-
Just (Hole{..}) -> ctl_rdr $ ctLocEnv hole_loc
97+
-- Note: ctl_rdr in 9.8
98+
Just (Hole{..}) -> tcl_rdr $ ctLocEnv hole_loc
9899
_ -> emptyLocalRdrEnv
99100
-- A name is in scope if it's in the local or global environment
100101
inScope e_id
@@ -106,8 +107,8 @@ synthPlug CompConf {..} useCache local_exprs plugRef =
106107
inLocalRdrEnvScope e_name lcl_env
107108
else -- A global variable is in scope if it's not shadowed by a local:
108109
-- or if it's wired in.
109-
110-
not (null (lookupGRE gbl_env (LookupOccName e_occ SameNameSpace)))
110+
-- Note: lookupGRE gbl_env (LookupOccName e_occ SameNameSpace) in 9.8
111+
not (null (lookupGlobalRdrEnv gbl_env e_occ))
111112
&& isNothing (lookupLocalRdrOcc lcl_env e_occ)
112113
case holeHash defaults h >>= (cache Map.!?) . (num_calls,) of
113114
Just cached | useCache -> liftIO $ do
@@ -138,13 +139,13 @@ synthPlug CompConf {..} useCache local_exprs plugRef =
138139
isOk HoleFit {..}
139140
| GreHFCand elt <- hfCand,
140141
occ <- greOccName elt,
141-
[_] <- lookupGRE gbl_env (LookupOccName occ SameNameSpace),
142+
[_] <- lookupGlobalRdrEnv gbl_env occ,
142143
Nothing <- lookupLocalRdrOcc lcl_env occ =
143144
True
144145
isOk HoleFit {..}
145146
| GreHFCand elt <- hfCand,
146147
occ <- greOccName elt,
147-
[g@GRE {..}] <- lookupGRE gbl_env (LookupOccName occ SameNameSpace),
148+
[g@GRE {..}] <- lookupGlobalRdrEnv gbl_env occ,
148149
Just n <- lookupLocalRdrOcc lcl_env occ =
149150
nameSrcSpan n == greSrcSpan g
150151
isOk HoleFit {..} | inScope hfId = True

src/PropR/Repair.hs

+8-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ import GHC.Exts (unsafeCoerce#)
6868
import GHC.Plugins
6969
import Numeric (showHex)
7070
import GHC.Builtin.Names (mkMainModule, mkMainModule_)
71-
import GHC.Types.Error (pprDiagnostic)
7271
import PropR.Check
7372
import PropR.Configuration
7473
import PropR.Eval
@@ -89,6 +88,10 @@ import System.Process
8988
import qualified System.Timeout (timeout)
9089
import GHC.Tc.Errors.Hole.FitTypes (HoleFit (..), TypedHole (..))
9190
import Text.Read (readMaybe)
91+
-- PPrDiagnostic
92+
import GHC.Driver.Errors.Ppr ()
93+
import GHC.Driver.Errors.Types (GhcMessage)
94+
import GHC.Types.Error (diagnosticMessage, defaultDiagnosticOpts, DecoratedSDoc(..))
9295

9396
-- | Runs the whole compiler chain to get the fits for a hole, i.e. possible
9497
-- replacement-elements for the holes
@@ -141,6 +144,10 @@ getHoleFits' cc@CompConf {..} plugRef exprs = do
141144
liftIO $ logOut ll ovnd
142145
liftIO $ logStr ll "The errors were:"
143146
let toB msg = listToBag [msg]
147+
-- Not needed in 9.8:
148+
pprDiagnostic :: GhcMessage -> [SDoc]
149+
pprDiagnostic msg = unDecorated $
150+
diagnosticMessage (defaultDiagnosticOpts @GhcMessage) msg
144151
liftIO $ mapM_ (logOut ll . pprDiagnostic) oerrs
145152
-- We try the default defaults and some other defaults
146153
let different_defaults =

0 commit comments

Comments
 (0)