Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
-
8adfc222
by sheaf at 2025-08-28T19:47:17-04:00
-
b9f585ab
by Oleg Grenrus at 2025-08-29T03:00:22-04:00
-
52ba0a3d
by fendor at 2025-08-29T03:00:23-04:00
12 changed files:
- .gitlab-ci.yml
- compiler/GHC/Core/Opt/Monad.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Env/Types.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Plugins.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Types/Evidence.hs
- configure.ac
- + testsuite/tests/typecheck/should_compile/T26350.hs
- testsuite/tests/typecheck/should_compile/all.T
Changes:
... | ... | @@ -104,6 +104,7 @@ workflow: |
104 | 104 | # which versions of GHC to allow bootstrap with
|
105 | 105 | .bootstrap_matrix : &bootstrap_matrix
|
106 | 106 | matrix:
|
107 | + # If you update this version, be sure to also update 'MinBootGhcVersion' in configure.ac
|
|
107 | 108 | - GHC_VERSION: 9.10.1
|
108 | 109 | DOCKER_IMAGE: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12-ghc9_10:$DOCKER_REV"
|
109 | 110 | - GHC_VERSION: 9.12.2
|
... | ... | @@ -16,7 +16,7 @@ module GHC.Core.Opt.Monad ( |
16 | 16 | mapDynFlagsCoreM, dropSimplCount,
|
17 | 17 | |
18 | 18 | -- ** Reading from the monad
|
19 | - getHscEnv, getModule,
|
|
19 | + getModule,
|
|
20 | 20 | initRuleEnv, getExternalRuleBase,
|
21 | 21 | getDynFlags, getPackageFamInstEnv,
|
22 | 22 | getInteractiveContext,
|
... | ... | @@ -243,8 +243,8 @@ liftIOWithCount what = liftIO what >>= (\(count, x) -> addSimplCount count >> re |
243 | 243 | ************************************************************************
|
244 | 244 | -}
|
245 | 245 | |
246 | -getHscEnv :: CoreM HscEnv
|
|
247 | -getHscEnv = read cr_hsc_env
|
|
246 | +instance HasHscEnv CoreM where
|
|
247 | + getHscEnv = read cr_hsc_env
|
|
248 | 248 | |
249 | 249 | getHomeRuleBase :: CoreM RuleBase
|
250 | 250 | getHomeRuleBase = read cr_rule_base
|
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | module GHC.Driver.Env
|
3 | 3 | ( Hsc(..)
|
4 | 4 | , HscEnv (..)
|
5 | + , HasHscEnv (..)
|
|
5 | 6 | , hsc_mod_graph
|
6 | 7 | , setModuleGraph
|
7 | 8 | , hscUpdateFlags
|
... | ... | @@ -49,7 +50,7 @@ import GHC.Driver.Errors ( printOrThrowDiagnostics ) |
49 | 50 | import GHC.Driver.Errors.Types ( GhcMessage )
|
50 | 51 | import GHC.Driver.Config.Logger (initLogFlags)
|
51 | 52 | import GHC.Driver.Config.Diagnostic (initDiagOpts, initPrintConfig)
|
52 | -import GHC.Driver.Env.Types ( Hsc(..), HscEnv(..) )
|
|
53 | +import GHC.Driver.Env.Types ( Hsc(..), HscEnv(..), HasHscEnv (..) )
|
|
53 | 54 | |
54 | 55 | import GHC.Runtime.Context
|
55 | 56 | import GHC.Runtime.Interpreter.Types (Interp)
|
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | module GHC.Driver.Env.Types
|
4 | 4 | ( Hsc(..)
|
5 | 5 | , HscEnv(..)
|
6 | + , HasHscEnv(..)
|
|
6 | 7 | ) where
|
7 | 8 | |
8 | 9 | import GHC.Driver.Errors.Types ( GhcMessage )
|
... | ... | @@ -34,6 +35,9 @@ newtype Hsc a = Hsc (HscEnv -> Messages GhcMessage -> IO (a, Messages GhcMessage |
34 | 35 | deriving (Functor, Applicative, Monad, MonadIO)
|
35 | 36 | via ReaderT HscEnv (StateT (Messages GhcMessage) IO)
|
36 | 37 | |
38 | +instance HasHscEnv Hsc where
|
|
39 | + getHscEnv = Hsc $ \e w -> return (e, w)
|
|
40 | + |
|
37 | 41 | instance HasDynFlags Hsc where
|
38 | 42 | getDynFlags = Hsc $ \e w -> return (hsc_dflags e, w)
|
39 | 43 | |
... | ... | @@ -109,3 +113,5 @@ data HscEnv |
109 | 113 | -- ^ LLVM configuration cache.
|
110 | 114 | }
|
111 | 115 | |
116 | +class HasHscEnv m where
|
|
117 | + getHscEnv :: m HscEnv |
... | ... | @@ -368,9 +368,6 @@ clearDiagnostics = Hsc $ \_ _ -> return ((), emptyMessages) |
368 | 368 | logDiagnostics :: Messages GhcMessage -> Hsc ()
|
369 | 369 | logDiagnostics w = Hsc $ \_ w0 -> return ((), w0 `unionMessages` w)
|
370 | 370 | |
371 | -getHscEnv :: Hsc HscEnv
|
|
372 | -getHscEnv = Hsc $ \e w -> return (e, w)
|
|
373 | - |
|
374 | 371 | handleWarnings :: Hsc ()
|
375 | 372 | handleWarnings = do
|
376 | 373 | diag_opts <- initDiagOpts <$> getDynFlags
|
... | ... | @@ -143,7 +143,7 @@ import Data.Maybe |
143 | 143 | |
144 | 144 | import GHC.Iface.Env ( lookupNameCache )
|
145 | 145 | import GHC.Prelude
|
146 | -import GHC.Utils.Monad ( mapMaybeM )
|
|
146 | +import GHC.Utils.Monad ( MonadIO, mapMaybeM )
|
|
147 | 147 | import GHC.ThToHs ( thRdrNameGuesses )
|
148 | 148 | import GHC.Tc.Utils.Env ( lookupGlobal )
|
149 | 149 | import GHC.Types.Name.Cache ( NameCache )
|
... | ... | @@ -178,7 +178,22 @@ instance MonadThings CoreM where |
178 | 178 | -- exactly. Qualified or unqualified TH names will be dynamically bound
|
179 | 179 | -- to names in the module being compiled, if possible. Exact TH names
|
180 | 180 | -- will be bound to the name they represent, exactly.
|
181 | -thNameToGhcName :: TH.Name -> CoreM (Maybe Name)
|
|
181 | +--
|
|
182 | +-- 'thNameToGhcName' can be used in 'CoreM', 'Hsc' and 'TcM' monads.
|
|
183 | +--
|
|
184 | +-- 'thNameToGhcName' is recommended way to lookup 'Name's in GHC plugins.
|
|
185 | +--
|
|
186 | +-- @
|
|
187 | +-- {-# LANGUAGE TemplateHaskellQuotes #-}
|
|
188 | +--
|
|
189 | +-- getNames :: Hsc (Maybe Name, Maybe Name)
|
|
190 | +-- getNames = do
|
|
191 | +-- class_Eq <- thNameToGhcName ''Eq
|
|
192 | +-- fun_eq <- thNameToGhcName '(==)
|
|
193 | +-- return (classEq, fun_eq)
|
|
194 | +-- @
|
|
195 | +--
|
|
196 | +thNameToGhcName :: (MonadIO m, HasHscEnv m) => TH.Name -> m (Maybe Name)
|
|
182 | 197 | thNameToGhcName th_name = do
|
183 | 198 | hsc_env <- getHscEnv
|
184 | 199 | liftIO $ thNameToGhcNameIO (hsc_NC hsc_env) th_name
|
... | ... | @@ -2641,8 +2641,8 @@ runBc hsc_env this_mod mbs (BcM m) |
2641 | 2641 | instance HasDynFlags BcM where
|
2642 | 2642 | getDynFlags = hsc_dflags <$> getHscEnv
|
2643 | 2643 | |
2644 | -getHscEnv :: BcM HscEnv
|
|
2645 | -getHscEnv = BcM $ \env st -> return (bcm_hsc_env env, st)
|
|
2644 | +instance HasHscEnv BcM where
|
|
2645 | + getHscEnv = BcM $ \env st -> return (bcm_hsc_env env, st)
|
|
2646 | 2646 | |
2647 | 2647 | getProfile :: BcM Profile
|
2648 | 2648 | getProfile = targetProfile <$> getDynFlags
|
... | ... | @@ -430,7 +430,7 @@ tcApp rn_expr exp_res_ty |
430 | 430 | -- Step 5.2: typecheck the arguments, and monomorphise
|
431 | 431 | -- any un-unified instantiation variables
|
432 | 432 | ; tc_args <- tcValArgs DoQL inst_args
|
433 | - -- Step 5.3: zonk to expose the polymophism hidden under
|
|
433 | + -- Step 5.3: zonk to expose the polymorphism hidden under
|
|
434 | 434 | -- QuickLook instantiation variables in `app_res_rho`
|
435 | 435 | ; app_res_rho <- liftZonkM $ zonkTcType app_res_rho
|
436 | 436 | -- Step 5.4: subsumption check against the expected type
|
... | ... | @@ -206,9 +206,15 @@ instance Monoid HsWrapper where |
206 | 206 | (<.>) :: HsWrapper -> HsWrapper -> HsWrapper
|
207 | 207 | WpHole <.> c = c
|
208 | 208 | c <.> WpHole = c
|
209 | -WpCast c1 <.> WpCast c2 = WpCast (c1 `mkTransCo` c2)
|
|
209 | +WpCast c1 <.> WpCast c2 = WpCast (c2 `mkTransCo` c1)
|
|
210 | 210 | -- If we can represent the HsWrapper as a cast, try to do so: this may avoid
|
211 | 211 | -- unnecessary eta-expansion (see 'mkWpFun').
|
212 | + --
|
|
213 | + -- NB: <.> behaves like function composition:
|
|
214 | + --
|
|
215 | + -- WpCast c1 <.> WpCast c2 :: coercionLKind c2 ~> coercionRKind c1
|
|
216 | + --
|
|
217 | + -- This is thus the same as WpCast (c2 ; c1) and not WpCast (c1 ; c2).
|
|
212 | 218 | c1 <.> c2 = c1 `WpCompose` c2
|
213 | 219 | |
214 | 220 | -- | Smart constructor to create a 'WpFun' 'HsWrapper', which avoids introducing
|
... | ... | @@ -219,7 +219,7 @@ if test "$WithGhc" = "" |
219 | 219 | then
|
220 | 220 | AC_MSG_ERROR([GHC is required.])
|
221 | 221 | fi
|
222 | -MinBootGhcVersion="9.8"
|
|
222 | +MinBootGhcVersion="9.10"
|
|
223 | 223 | FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[$MinBootGhcVersion],
|
224 | 224 | [AC_MSG_ERROR([GHC version $MinBootGhcVersion or later is required to compile GHC.])])
|
225 | 225 |
1 | +{-# LANGUAGE DeepSubsumption #-}
|
|
2 | +{-# LANGUAGE TypeFamilies #-}
|
|
3 | +{-# LANGUAGE TypeOperators #-}
|
|
4 | + |
|
5 | +{-# OPTIONS_GHC -dcore-lint #-}
|
|
6 | + |
|
7 | +module T26350 where
|
|
8 | + |
|
9 | +import Control.Arrow (first)
|
|
10 | + |
|
11 | +infix 6 .-.
|
|
12 | + |
|
13 | +class AffineSpace p where
|
|
14 | + type Diff p
|
|
15 | + (.-.) :: p -> p -> Diff p
|
|
16 | + |
|
17 | +affineCombo :: (AffineSpace p, v ~ Diff p) => p -> (p,v) -> (v,v)
|
|
18 | +affineCombo z l = first (.-. z) l |
... | ... | @@ -862,6 +862,7 @@ test('DeepSubsumption06', normal, compile, ['-XHaskell98']) |
862 | 862 | test('DeepSubsumption07', normal, compile, ['-XHaskell2010'])
|
863 | 863 | test('DeepSubsumption08', normal, compile, [''])
|
864 | 864 | test('DeepSubsumption09', normal, compile, [''])
|
865 | +test('T26350', normal, compile, [''])
|
|
865 | 866 | test('T26225', normal, compile, [''])
|
866 | 867 | test('T26225b', normal, compile, [''])
|
867 | 868 | test('T21765', normal, compile, [''])
|