Commit e91ddddd authored by Krzysztof Gogolewski's avatar Krzysztof Gogolewski Committed by Marge Bot

Misc cleanup

* Include funTyCon in exposedPrimTyCons.
  Every single place using exposedPrimTyCons was adding funTyCon
  manually.
* Remove unused synTyConResKind and ieLWrappedName
* Add recordSelectorTyCon_maybe
* In exprType, panic instead of giving a trace message and dummy output.
  This prevents #18767 reoccurring.
* Fix compilation error in fragile concprog001 test (part of #18732)
parent a94db588
......@@ -190,6 +190,7 @@ exposedPrimTyCons
, word64PrimTyCon
, tYPETyCon
, funTyCon
#include "primop-vector-tycons.hs-incl"
]
......
......@@ -133,8 +133,7 @@ knownKeyNames
-- See Note [One-tuples] (Wrinkle: Make boxed one-tuple names have known keys)
-- in GHC.Builtin.Types.
tupleTyConName BoxedTuple 1 : tupleDataConName Boxed 1 :
concat [ wired_tycon_kk_names funTyCon
, concatMap wired_tycon_kk_names primTyCons
concat [ concatMap wired_tycon_kk_names primTyCons
, concatMap wired_tycon_kk_names wiredInTyCons
, concatMap wired_tycon_kk_names typeNatTyCons
, map idName wiredInIds
......@@ -264,14 +263,14 @@ ghcPrimExports
= map (avail . idName) ghcPrimIds ++
map (avail . idName . primOpId) allThePrimOps ++
[ AvailTC n [n] []
| tc <- funTyCon : exposedPrimTyCons, let n = tyConName tc ]
| tc <- exposedPrimTyCons, let n = tyConName tc ]
ghcPrimDeclDocs :: DeclDocMap
ghcPrimDeclDocs = DeclDocMap $ Map.fromList $ mapMaybe findName primOpDocs
where
names = map idName ghcPrimIds ++
map (idName . primOpId) allThePrimOps ++
map tyConName (funTyCon : exposedPrimTyCons)
map tyConName exposedPrimTyCons
findName (nameStr, doc)
| Just name <- find ((nameStr ==) . getOccString) names
= Just (name, mkHsDocString doc)
......
......@@ -81,7 +81,6 @@ module GHC.Core.Type (
filterOutInvisibleTypes, filterOutInferredTypes,
partitionInvisibleTypes, partitionInvisibles,
tyConArgFlags, appTyArgFlags,
synTyConResKind,
-- ** Analyzing types
TyCoMapper(..), mapTyCo, mapTyCoX,
......@@ -2891,13 +2890,6 @@ tyConsOfType ty
go_tc tc = unitUniqSet tc
go_ax ax = go_tc $ coAxiomTyCon ax
-- | Find the result 'Kind' of a type synonym,
-- after applying it to its 'arity' number of type variables
-- Actually this function works fine on data types too,
-- but they'd always return '*', so we never need to ask
synTyConResKind :: TyCon -> Kind
synTyConResKind tycon = piResultTys (tyConKind tycon) (mkTyVarTys (tyConTyVars tycon))
-- | Retrieve the free variables in this type, splitting them based
-- on whether they are used visibly or invisibly. Invisible ones come
-- first.
......
......@@ -97,7 +97,6 @@ import GHC.Core.Multiplicity
import GHC.Types.Unique
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Builtin.Types.Prim
import GHC.Data.FastString
import GHC.Data.Maybe
import GHC.Data.List.SetOps( minusList )
......@@ -139,7 +138,7 @@ exprType e@(App _ _)
= case collectArgs e of
(fun, args) -> applyTypeToArgs e (exprType fun) args
exprType other = pprTrace "exprType" (pprCoreExpr other) alphaTy
exprType other = pprPanic "exprType" (pprCoreExpr other)
coreAltType :: CoreAlt -> Type
-- ^ Returns the type of the alternatives right hand side
......
......@@ -2880,7 +2880,7 @@ dynamic_flags_deps = [
, make_dep_flag defFlag "funfolding-keeness-factor"
(floatSuffix (\_ d -> d))
"-funfolding-keeness-factor is no longer respected as of GHC 8.12"
"-funfolding-keeness-factor is no longer respected as of GHC 9.0"
, make_ord_flag defFlag "fmax-worker-args"
(intSuffix (\n d -> d {maxWorkerArgs = n}))
......
......@@ -311,9 +311,6 @@ ieWrappedName (IEType (L _ n)) = n
lieWrappedName :: LIEWrappedName name -> name
lieWrappedName (L _ n) = ieWrappedName n
ieLWrappedName :: LIEWrappedName name -> Located name
ieLWrappedName (L l n) = L l (ieWrappedName n)
replaceWrappedName :: IEWrappedName name1 -> name2 -> IEWrappedName name2
replaceWrappedName (IEName (L l _)) n = IEName (L l n)
replaceWrappedName (IEPattern (L l _)) n = IEPattern (L l n)
......
......@@ -593,9 +593,9 @@ lookupParents rdr
where
lookupParent :: GlobalRdrElt -> RnM (RecSelParent, GlobalRdrElt)
lookupParent gre = do { id <- tcLookupId (gre_name gre)
; if isRecordSelector id
then return (recordSelectorTyCon id, gre)
else failWithTc (notSelector (gre_name gre)) }
; case recordSelectorTyCon_maybe id of
Just rstc -> return (rstc, gre)
Nothing -> failWithTc (notSelector (gre_name gre)) }
fieldNotInType :: RecSelParent -> RdrName -> SDoc
......
......@@ -350,7 +350,7 @@ mkPrimTypeableTodos
-- Note [Built-in syntax and the OrigNameCache] in "GHC.Iface.Env" for more.
ghcPrimTypeableTyCons :: [TyCon]
ghcPrimTypeableTyCons = concat
[ [ runtimeRepTyCon, vecCountTyCon, vecElemTyCon, funTyCon ]
[ [ runtimeRepTyCon, vecCountTyCon, vecElemTyCon ]
, map (tupleTyCon Unboxed) [0..mAX_TUPLE_SIZE]
, map sumTyCon [2..mAX_SUM_SIZE]
, primTyCons
......
......@@ -46,6 +46,7 @@ module GHC.Types.Id (
-- ** Taking an Id apart
idName, idType, idMult, idScaledType, idUnique, idInfo, idDetails,
recordSelectorTyCon,
recordSelectorTyCon_maybe,
-- ** Modifying an Id
setIdName, setIdUnique, GHC.Types.Id.setIdType, setIdMult,
......@@ -438,10 +439,15 @@ That is what is happening in, say tidy_insts in GHC.Iface.Tidy.
-- | If the 'Id' is that for a record selector, extract the 'sel_tycon'. Panic otherwise.
recordSelectorTyCon :: Id -> RecSelParent
recordSelectorTyCon id
= case Var.idDetails id of
RecSelId { sel_tycon = parent } -> parent
= case recordSelectorTyCon_maybe id of
Just parent -> parent
_ -> panic "recordSelectorTyCon"
recordSelectorTyCon_maybe :: Id -> Maybe RecSelParent
recordSelectorTyCon_maybe id
= case Var.idDetails id of
RecSelId { sel_tycon = parent } -> Just parent
_ -> Nothing
isRecordSelector :: Id -> Bool
isNaughtyRecordSelector :: Id -> Bool
......
......@@ -5,7 +5,7 @@ import Control.Concurrent.MVar
import System.IO.Unsafe
import Utilities
import Converter
import GHC.Data.Stream
import Stream
import Data.Ratio
import Trit
......
module Converter (rationalToGray, grayToSignIO, signToGray, Gray, startF, startC) where
import GHC.Data.Stream
import Stream
import Data.Ratio
import Control.Concurrent
import Control.Concurrent.MVar
......
......@@ -3,7 +3,7 @@ module Thread (threadTesting1) where
import Control.Concurrent
import Control.Concurrent.MVar
import GHC.Data.Stream
import Stream
import Converter
threadTesting1 :: Gray -> Gray -> IO Int
......
......@@ -2,7 +2,7 @@ module Trit (Trit, rationalToTrit, getIntegral, getFraction, getFraction',
neg, addTrits, subTrits, shiftLeft, shiftRight, multiply
) where
import GHC.Data.Stream
import Stream
import Utilities
import Data.Ratio
......
module Utilities (toBinary, fl) where
import GHC.Data.Stream
import Stream
import Data.Ratio
-- Convert from an Integer to its signed-digit representation
......
......@@ -16,4 +16,4 @@ test('concprog001', [extra_files(['Arithmetic.hs', 'Converter.hs', 'Mult.hs', 'S
when(fast(), skip), only_ways(['threaded2']),
fragile(16604),
run_timeout_multiplier(2)],
multimod_compile_and_run, ['Mult', '-package ghc'])
multimod_compile_and_run, ['Mult', ''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment