Commit 255418da authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot

Modules: type-checker (#13009)

Update Haddock submodule
parent 3d2991f8
Pipeline #17767 failed with stages
in 310 minutes and 37 seconds
......@@ -16,26 +16,26 @@
/includes/ @bgamari @simonmar @osa1
# The compiler
/compiler/parser/ @int-index
/compiler/hsSyn/ @simonpj @rae
/compiler/typecheck/ @simonpj @rae
/compiler/rename/ @simonpj @rae
/compiler/types/ @simonpj @rae
/compiler/deSugar/ @simonpj @rae
/compiler/typecheck/TcDeriv* @RyanGlScott
/compiler/nativeGen/ @simonmar @bgamari @AndreasK
/compiler/llvmGen/ @angerman
/compiler/codeGen/ @simonmar @osa1
/compiler/cmm/ @simonmar @osa1
/compiler/ghci/ @simonmar
/compiler/simplCore/CallArity.hs @nomeata
/compiler/utils/UnVarGraph.hs @nomeata
/compiler/simplCore/Exitify.hs @nomeata
/compiler/simplStg/StgCse.hs @nomeata
/compiler/simplStg/StgLiftLams.hs @sgraf
/compiler/cmm/CmmSwitch.hs @nomeata
/compiler/stranal/DmdAnal.hs @simonpj @sgraf
/compiler/hsSyn/Convert.hs @rae
/compiler/parser/ @int-index
/compiler/GHC/Hs/ @simonpj @rae
/compiler/GHC/Tc/ @simonpj @rae
/compiler/GHC/Rename/ @simonpj @rae
/compiler/GHC/Types/ @simonpj @rae
/compiler/GHC/HsToCore/ @simonpj @rae
/compiler/GHC/Tc/Deriv/ @RyanGlScott
/compiler/GHC/CmmToAsm/ @simonmar @bgamari @AndreasK
/compiler/GHC/CmmToLlvm/ @angerman
/compiler/GHC/StgToCmm/ @simonmar @osa1
/compiler/GHC/Cmm/ @simonmar @osa1
/compiler/ghci/ @simonmar
/compiler/GHC/Core/Op/CallArity.hs @nomeata
/compiler/utils/UnVarGraph.hs @nomeata
/compiler/GHC/Core/Op/Exitify.hs @nomeata
/compiler/GHC/Stg/CSE.hs @nomeata
/compiler/GHC/Stg/Lift.hs @sgraf
/compiler/GHC/Cmm/Switch.hs @nomeata
/compiler/GHC/Core/Op/DmdAnal.hs @simonpj @sgraf
/compiler/GHC/ThToHs.hs @rae
# Core libraries
/libraries/base/ @hvr
......
......@@ -308,16 +308,16 @@ import GHC.Driver.Make
import GHC.Driver.Hooks
import GHC.Driver.Pipeline ( compileOne' )
import GHC.Driver.Monad
import TcRnMonad ( finalSafeMode, fixSafeInstances, initIfaceTcRn )
import GHC.Iface.Load ( loadSysInterface )
import TcRnTypes
import GHC.Tc.Utils.Monad ( finalSafeMode, fixSafeInstances, initIfaceTcRn )
import GHC.Iface.Load ( loadSysInterface )
import GHC.Tc.Types
import GHC.Core.Predicate
import GHC.Driver.Packages
import GHC.Types.Name.Set
import GHC.Types.Name.Reader
import GHC.Hs
import GHC.Core.Type hiding( typeKind )
import TcType
import GHC.Tc.Utils.TcType
import GHC.Types.Id
import TysPrim ( alphaTyVars )
import GHC.Core.TyCon
......@@ -357,9 +357,9 @@ import Lexer
import ApiAnnotation
import qualified GHC.LanguageExtensions as LangExt
import GHC.Types.Name.Env
import TcRnDriver
import Inst
import FamInst
import GHC.Tc.Module
import GHC.Tc.Utils.Instantiate
import GHC.Tc.Instance.Family
import FileCleanup
import Data.Foldable
......@@ -1322,7 +1322,7 @@ getNameToInstancesIndex visible_mods mods_to_load = do
; (pkg_fie, home_fie) <- tcGetFamInstEnvs
-- We use Data.Sequence.Seq because we are creating left associated
-- mappends.
-- cls_index and fam_index below are adapted from TcRnDriver.lookupInsts
-- cls_index and fam_index below are adapted from GHC.Tc.Module.lookupInsts
; let cls_index = Map.fromListWith mappend
[ (n, Seq.singleton ispec)
| ispec <- instEnvElts ie_local ++ instEnvElts ie_global
......
......@@ -368,7 +368,7 @@ instance Ord r => DefinerOfRegs r r where
instance (Ord r, UserOfRegs r CmmReg) => UserOfRegs r CmmExpr where
-- The (Ord r) in the context is necessary here
-- See Note [Recursive superclasses] in TcInstDcls
-- See Note [Recursive superclasses] in GHC.Tc.TyCl.Instance
foldRegsUsed dflags f !z e = expr z e
where expr z (CmmLit _) = z
expr z (CmmLoad addr _) = foldRegsUsed dflags f z addr
......
......@@ -348,7 +348,7 @@ instance UserOfRegs GlobalReg (CmmNode e x) where
instance (Ord r, UserOfRegs r CmmReg) => UserOfRegs r ForeignTarget where
-- The (Ord r) in the context is necessary here
-- See Note [Recursive superclasses] in TcInstDcls
-- See Note [Recursive superclasses] in GHC.Tc.TyCl.Instance
foldRegsUsed _ _ !z (PrimTarget _) = z
foldRegsUsed dflags f !z (ForeignTarget e _) = foldRegsUsed dflags f z e
......
......@@ -537,7 +537,7 @@ substitutions until the next run of the simplifier.
case (df @Int) of (co :: a ~# b) -> blah
Which is very exotic, and I think never encountered; but see
Note [Equality superclasses in quantified constraints]
in TcCanonical
in GHC.Tc.Solver.Canonical
Note [Core case invariants]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -191,7 +191,7 @@ Note [Newtype classes and eta expansion]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NB: this nasty special case is no longer required, because
for newtype classes we don't use the class-op rule mechanism
at all. See Note [Single-method classes] in TcInstDcls. SLPJ May 2013
at all. See Note [Single-method classes] in GHC.Tc.TyCl.Instance. SLPJ May 2013
-------- Old out of date comments, just for interest -----------
We have to be careful when eta-expanding through newtypes. In general
......
......@@ -222,7 +222,7 @@ we should make sure that the first and third args match the instance
header.
Having the same variables for class and tycon is also used in checkValidRoles
(in TcTyClsDecls) when checking a class's roles.
(in GHC.Tc.TyCl) when checking a class's roles.
************************************************************************
......
......@@ -207,7 +207,7 @@ pprCoAxiom ax@(CoAxiom { co_ax_tc = tc, co_ax_branches = branches })
pprCoAxBranchUser :: TyCon -> CoAxBranch -> SDoc
-- Used when printing injectivity errors (FamInst.reportInjectivityErrors)
-- and inaccessible branches (GHC.Tc.Validity.inaccessibleCoAxBranch)
-- This happens in error messages: don't print the RHS of a data
-- family axiom, which is meaningless to a user
pprCoAxBranchUser tc br
......@@ -2524,7 +2524,7 @@ buildCoercion orig_ty1 orig_ty2 = go orig_ty1 orig_ty2
%* *
%************************************************************************
The function below morally belongs in TcFlatten, but it is used also in
The function below morally belongs in GHC.Tc.Solver.Flatten, but it is used also in
FamInstEnv, and so lives here.
Note [simplifyArgsWorker]
......@@ -2838,7 +2838,7 @@ simplifyArgsWorker orig_ki_binders orig_inner_ki orig_fvs
kind_co = liftCoSubst Nominal lc final_kind
go acc_xis acc_cos lc (binder:binders) inner_ki (role:roles) ((xi,co):args)
= -- By Note [Flattening] in TcFlatten invariant (F2),
= -- By Note [Flattening] in GHC.Tc.Solver.Flatten invariant (F2),
-- tcTypeKind(xi) = tcTypeKind(ty). But, it's possible that xi will be
-- used as an argument to a function whose kind is different, if
-- earlier arguments have been flattened to new types. We thus
......@@ -2898,7 +2898,7 @@ simplifyArgsWorker orig_ki_binders orig_inner_ki orig_fvs
-- This debug information is commented out because leaving it in
-- causes a ~2% increase in allocations in T9872d.
-- That's independent of the analogous case in flatten_args_fast
-- in TcFlatten:
-- in GHC.Tc.Solver.Flatten:
-- each of these causes a 2% increase on its own, so commenting them
-- both out gives a 4% decrease in T9872d.
{-
......
......@@ -240,7 +240,7 @@ data CoAxBranch
, cab_cvs :: [CoVar] -- Bound coercion variables
-- Always empty, for now.
-- See Note [Constraints in patterns]
-- in TcTyClsDecls
-- in GHC.Tc.TyCl
, cab_roles :: [Role] -- See Note [CoAxBranch roles]
, cab_lhs :: [Type] -- Type patterns to match against
, cab_rhs :: Type -- Right-hand side of the equality
......@@ -427,7 +427,7 @@ TyCon rep_tc:
- This eta reduction happens for data instances as well
as newtype instances. Here we want to eta-reduce the data family axiom.
- This eta-reduction is done in TcInstDcls.tcDataFamInstDecl.
- This eta-reduction is done in GHC.Tc.TyCl.Instance.tcDataFamInstDecl.
But for a /type/ family
- cab_lhs has the exact arity of the family tycon
......
......@@ -13,7 +13,7 @@ import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.Subst
import GHC.Core.Coercion
import GHC.Core.Type as Type hiding( substTyVarBndr, substTy )
import TcType ( exactTyCoVarsOfType )
import GHC.Tc.Utils.TcType ( exactTyCoVarsOfType )
import GHC.Core.TyCon
import GHC.Core.Coercion.Axiom
import GHC.Types.Var.Set
......
......@@ -863,7 +863,7 @@ conditions hold:
of last equation and check whether it is overlapped by any of previous
equations. Since it is overlapped by the first equation we conclude
that pair of last two equations does not violate injectivity
annotation. (Check done in TcValidity.checkValidCoAxiom#gather_conflicts)
annotation. (Check done in GHC.Tc.Validity.checkValidCoAxiom#gather_conflicts)
A special case of B is when RHSs unify with an empty substitution ie. they
are identical.
......@@ -898,7 +898,7 @@ conditions hold:
injective. "Injective position" means either an argument to a type
constructor or argument to a type family on injective position.
There are subtleties here. See Note [Coverage condition for injective type families]
in FamInst.
in GHC.Tc.Instance.Family.
Check (1) must be done for all family instances (transitively) imported. Other
checks (2-4) should be done just for locally written equations, as they are checks
......@@ -1189,7 +1189,7 @@ findBranch branches target_tys
apartnessCheck :: [Type] -- ^ /flattened/ target arguments. Make sure
-- they're flattened! See Note [Flattening].
-- (NB: This "flat" is a different
-- "flat" than is used in TcFlatten.)
-- "flat" than is used in GHC.Tc.Solver.Flatten.)
-> CoAxBranch -- ^ the candidate equation we wish to use
-- Precondition: this matches the target
-> Bool -- ^ True <=> equation can fire
......@@ -1445,7 +1445,7 @@ normalise_type ty
go_app_tys :: Type -- function
-> [Type] -- args
-> NormM (Coercion, Type)
-- cf. TcFlatten.flatten_app_ty_args
-- cf. GHC.Tc.Solver.Flatten.flatten_app_ty_args
go_app_tys (AppTy ty1 ty2) tys = go_app_tys ty1 (ty2 : tys)
go_app_tys fun_ty arg_tys
= do { (fun_co, nfun) <- go fun_ty
......@@ -1476,7 +1476,7 @@ normalise_args :: Kind -- of the function
-- and the res_co :: kind(f orig_args) ~ kind(f xis)
-- NB: The xis might *not* have the same kinds as the input types,
-- but the resulting application *will* be well-kinded
-- cf. TcFlatten.flatten_args_slow
-- cf. GHC.Tc.Solver.Flatten.flatten_args_slow
normalise_args fun_ki roles args
= do { normed_args <- zipWithM normalise1 roles args
; let (xis, cos, res_co) = simplifyArgsWorker ki_binders inner_ki fvs roles normed_args
......
......@@ -4,7 +4,7 @@
\section[InstEnv]{Utilities for typechecking instance declarations}
The bits common to TcInstDcls and TcDeriv.
The bits common to GHC.Tc.TyCl.Instance and GHC.Tc.Deriv.
-}
{-# LANGUAGE CPP, DeriveDataTypeable #-}
......@@ -33,7 +33,7 @@ module GHC.Core.InstEnv (
import GhcPrelude
import TcType -- InstEnv is really part of the type checker,
import GHC.Tc.Utils.TcType -- InstEnv is really part of the type checker,
-- and depends on TcType in many ways
import GHC.Core ( IsOrphan(..), isOrphan, chooseOrphanAnchor )
import GHC.Types.Module
......@@ -453,7 +453,7 @@ classInstances (InstEnvs { ie_global = pkg_ie, ie_local = home_ie, ie_visible =
Nothing -> []
-- | Checks for an exact match of ClsInst in the instance environment.
-- We use this when we do signature checking in TcRnDriver
-- We use this when we do signature checking in GHC.Tc.Module
memberInstEnv :: InstEnv -> ClsInst -> Bool
memberInstEnv inst_env ins_item@(ClsInst { is_cls_nm = cls_nm } ) =
maybe False (\(ClsIE items) -> any (identicalDFunType ins_item) items)
......@@ -732,7 +732,7 @@ type ClsInstLookupResult
, [ClsInst] -- These don't match but do unify
, [InstMatch] ) -- Unsafe overlapped instances under Safe Haskell
-- (see Note [Safe Haskell Overlapping Instances] in
-- TcSimplify).
-- GHC.Tc.Solver).
{-
Note [DFunInstType: instantiating types]
......@@ -835,8 +835,8 @@ lookupInstEnv :: Bool -- Check Safe Haskell overlap restrictions
-> Class -> [Type] -- What we are looking for
-> ClsInstLookupResult
-- ^ See Note [Rules for instance lookup]
-- ^ See Note [Safe Haskell Overlapping Instances] in TcSimplify
-- ^ See Note [Safe Haskell Overlapping Instances Implementation] in TcSimplify
-- ^ See Note [Safe Haskell Overlapping Instances] in GHC.Tc.Solver
-- ^ See Note [Safe Haskell Overlapping Instances Implementation] in GHC.Tc.Solver
lookupInstEnv check_overlap_safe
(InstEnvs { ie_global = pkg_ie
, ie_local = home_ie
......
......@@ -35,7 +35,7 @@ import GHC.Types.Literal
import GHC.Core.DataCon
import TysWiredIn
import TysPrim
import TcType ( isFloatingTy )
import GHC.Tc.Utils.TcType ( isFloatingTy )
import GHC.Types.Var as Var
import GHC.Types.Var.Env
import GHC.Types.Var.Set
......@@ -440,7 +440,7 @@ interactiveInScope :: HscEnv -> [Var]
interactiveInScope hsc_env
= tyvars ++ ids
where
-- C.f. TcRnDriver.setInteractiveContext, Desugar.deSugarExpr
-- C.f. GHC.Tc.Module.setInteractiveContext, Desugar.deSugarExpr
ictxt = hsc_IC hsc_env
(cls_insts, _fam_insts) = ic_instances ictxt
te1 = mkTypeEnvWithImplicits (ic_tythings ictxt)
......@@ -1491,7 +1491,7 @@ Here 'cls' appears free in b's kind, which would usually be illegal
#in this case (Alg cls *) = *, so all is well. Currently we allow
this, and make Lint expand synonyms where necessary to make it so.
c.f. TcUnify.occCheckExpand and GHC.Core.Utils.coreAltsType which deal
c.f. GHC.Tc.Utils.Unify.occCheckExpand and GHC.Core.Utils.coreAltsType which deal
with the same problem. A single systematic solution eludes me.
-}
......@@ -1499,7 +1499,7 @@ with the same problem. A single systematic solution eludes me.
lintTySynFamApp :: Bool -> Type -> TyCon -> [Type] -> LintM LintedKind
-- The TyCon is a type synonym or a type family (not a data family)
-- See Note [Linting type synonym applications]
-- c.f. TcValidity.check_syn_tc_app
-- c.f. GHC.Tc.Validity.check_syn_tc_app
lintTySynFamApp report_unsat ty tc tys
| report_unsat -- Report unsaturated only if report_unsat is on
, tys `lengthLessThan` tyConArity tc
......
......@@ -534,7 +534,7 @@ version:
We had to revert this patch because it made GHC itself slower.
Why? It delayed inlining of /all/ functions with RULES, and that was
very bad in TcFlatten.flatten_ty_con_app
very bad in GHC.Tc.Solver.Flatten.flatten_ty_con_app
* It delayed inlining of liftM
* That delayed the unravelling of the recursion in some dictionary
......
......@@ -1100,7 +1100,7 @@ inline 'f' in '$wf'.
Note [DFuns should not be loop breakers]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's particularly bad to make a DFun into a loop breaker. See
Note [How instance declarations are translated] in TcInstDcls
Note [How instance declarations are translated] in GHC.Tc.TyCl.Instance
We give DFuns a higher score than ordinary CONLIKE things because
if there's a choice we want the DFun to be the non-loop breaker. Eg
......@@ -2914,7 +2914,7 @@ from making it a join point.
If it is recursive, and uselessly marked INLINE, this will stop us
making it a join point, which is annoying. But occasionally
(notably in class methods; see Note [Instances and loop breakers] in
TcInstDcls) we mark recursive things as INLINE but the recursion
GHC.Tc.TyCl.Instance) we mark recursive things as INLINE but the recursion
unravels; so ignoring INLINE pragmas on recursive things isn't good
either.
......
......@@ -3554,7 +3554,7 @@ simplStableUnfolding env top_lvl mb_cont id unf rhs_ty
-- Refresh the boring-ok flag, in case expr'
-- has got small. This happens, notably in the inlinings
-- for dfuns for single-method classes; see
-- Note [Single-method classes] in TcInstDcls.
-- Note [Single-method classes] in GHC.Tc.TyCl.Instance.
-- A test case is #4138
-- But retain a previous boring_ok of True; e.g. see
-- the way it is set in calcUnfoldingGuidanceWithArity
......
......@@ -16,7 +16,7 @@ module GHC.Core.Op.Specialise ( specProgram, specUnfolding ) where
import GhcPrelude
import GHC.Types.Id
import TcType hiding( substTy )
import GHC.Tc.Utils.TcType hiding( substTy )
import GHC.Core.Type hiding( substTy, extendTvSubstList )
import GHC.Core.Predicate
import GHC.Types.Module( Module, HasModule(..) )
......
......@@ -295,12 +295,12 @@ would be a top-level declaration with an unboxed type.
This means that when typechecking an occurrence of P in an expression,
we must remember that the builder has this void argument. This is
done by TcPatSyn.patSynBuilderOcc.
done by GHC.Tc.TyCl.PatSyn.patSynBuilderOcc.
Note [Pattern synonyms and the data type Type]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The type of a pattern synonym is of the form (See Note
[Pattern synonym signatures] in TcSigs):
[Pattern synonym signatures] in GHC.Tc.Gen.Sig):
forall univ_tvs. req => forall ex_tvs. prov => ...
......
......@@ -51,7 +51,7 @@ data Pred
| EqPred EqRel Type Type
| IrredPred PredType
| ForAllPred [TyVar] [PredType] PredType
-- ForAllPred: see Note [Quantified constraints] in TcCanonical
-- ForAllPred: see Note [Quantified constraints] in GHC.Tc.Solver.Canonical
-- NB: There is no TuplePred case
-- Tuple predicates like (Eq a, Ord b) are just treated
-- as ClassPred, as if we had a tuple class with two superclasses
......@@ -144,7 +144,7 @@ Predicates on PredType
{-
Note [Evidence for quantified constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The superclass mechanism in TcCanonical.makeSuperClasses risks
The superclass mechanism in GHC.Tc.Solver.Canonical.makeSuperClasses risks
taking a quantified constraint like
(forall a. C a => a ~ b)
and generate superclass evidence
......@@ -153,7 +153,7 @@ and generate superclass evidence
This is a funny thing: neither isPredTy nor isCoVarType are true
of it. So we are careful not to generate it in the first place:
see Note [Equality superclasses in quantified constraints]
in TcCanonical.
in GHC.Tc.Solver.Canonical.
-}
isEvVarType :: Type -> Bool
......
......@@ -34,19 +34,19 @@ import GHC.Core -- All of it
import GHC.Types.Module ( Module, ModuleSet, elemModuleSet )
import GHC.Core.Subst
import GHC.Core.SimpleOpt ( exprIsLambda_maybe )
import GHC.Core.FVs ( exprFreeVars, exprsFreeVars, bindFreeVars
, rulesFreeVarsDSet, exprsOrphNames, exprFreeVarsList )
import GHC.Core.Utils ( exprType, eqExpr, mkTick, mkTicks
, stripTicksTopT, stripTicksTopE
, isJoinBind )
import GHC.Core.Ppr ( pprRules )
import GHC.Core.FVs ( exprFreeVars, exprsFreeVars, bindFreeVars
, rulesFreeVarsDSet, exprsOrphNames, exprFreeVarsList )
import GHC.Core.Utils ( exprType, eqExpr, mkTick, mkTicks
, stripTicksTopT, stripTicksTopE
, isJoinBind )
import GHC.Core.Ppr ( pprRules )
import GHC.Core.Type as Type
( Type, TCvSubst, extendTvSubst, extendCvSubst
, mkEmptyTCvSubst, substTy )
import TcType ( tcSplitTyConApp_maybe )
import TysWiredIn ( anyTypeOfKind )
import GHC.Tc.Utils.TcType ( tcSplitTyConApp_maybe )
import TysWiredIn ( anyTypeOfKind )
import GHC.Core.Coercion as Coercion
import GHC.Core.Op.Tidy ( tidyRules )
import GHC.Core.Op.Tidy ( tidyRules )
import GHC.Types.Id
import GHC.Types.Id.Info ( RuleInfo( RuleInfo ) )
import GHC.Types.Var
......@@ -972,7 +972,7 @@ match_ty :: RuleMatchEnv
-> Type -- Template
-> Type -- Target
-> Maybe RuleSubst
-- Matching Core types: use the matcher in TcType.
-- Matching Core types: use the matcher in GHC.Tc.Utils.TcType.
-- Notice that we treat newtypes as opaque. For example, suppose
-- we have a specialised version of a function at a newtype, say
-- newtype T = MkT Int
......
......@@ -775,7 +775,7 @@ almost_devoid_co_var_of_types (ty:tys) cv
-- See @Note [When does a tycon application need an explicit kind signature?]@.
injectiveVarsOfType :: Bool -- ^ Should we look under injective type families?
-- See Note [Coverage condition for injective type families]
-- in FamInst.
-- in GHC.Tc.Instance.Family.
-> Type -> FV
injectiveVarsOfType look_under_tfs = go
where
......@@ -810,7 +810,7 @@ injectiveVarsOfType look_under_tfs = go
-- See @Note [When does a tycon application need an explicit kind signature?]@.
injectiveVarsOfTypes :: Bool -- ^ look under injective type families?
-- See Note [Coverage condition for injective type families]
-- in FamInst.
-- in GHC.Tc.Instance.Family.
-> [Type] -> FV
injectiveVarsOfTypes look_under_tfs = mapUnionFV (injectiveVarsOfType look_under_tfs)
......@@ -933,7 +933,7 @@ types/kinds are fully settled and zonked.
--
-- It is also meant to be stable: that is, variables should not
-- be reordered unnecessarily. This is specified in Note [ScopedSort]
-- See also Note [Ordering of implicit variables] in GHC.Rename.Types
-- See also Note [Ordering of implicit variables] in GHC.Rename.HsType
scopedSort :: [TyCoVar] -> [TyCoVar]
scopedSort = go [] []
......
......@@ -314,7 +314,7 @@ pprTypeApp tc tys
------------------
-- | Display all kind information (with @-fprint-explicit-kinds@) when the
-- provided 'Bool' argument is 'True'.
-- See @Note [Kind arguments in error messages]@ in TcErrors.
-- See @Note [Kind arguments in error messages]@ in GHC.Tc.Errors.
pprWithExplicitKindsWhen :: Bool -> SDoc -> SDoc
pprWithExplicitKindsWhen b
= updSDocContext $ \ctx ->
......
......@@ -121,7 +121,7 @@ The Class and its associated TyCon have the same Name.
-- | A global typecheckable-thing, essentially anything that has a name.
-- Not to be confused with a 'TcTyThing', which is also a typecheckable
-- thing but in the *local* context. See 'TcEnv' for how to retrieve
-- thing but in the *local* context. See 'GHC.Tc.Utils.Env' for how to retrieve
-- a 'TyThing' given a 'Name'.
data TyThing
= AnId Id
......@@ -356,7 +356,7 @@ promote MkT as well.
How does this work?
* In TcValidity.checkConstraintsOK we reject kinds that
* In GHC.Tc.Validity.checkConstraintsOK we reject kinds that
have constraints other than (a~b) and (a~~b).
* In Inst.tcInstInvisibleTyBinder we instantiate a call
......@@ -380,7 +380,7 @@ How does this work?
in TysPrim for a primer on these equality types.)
* How do we prevent a MkT having an illegal constraint like
Eq a? We check for this at use-sites; see TcHsType.tcTyVar,
Eq a? We check for this at use-sites; see GHC.Tc.Gen.HsType.tcTyVar,
specifically dc_theta_illegal_constraint.
* Notice that nothing special happens if
......@@ -663,7 +663,7 @@ are truly unrelated.
-- | A type labeled 'KnotTied' might have knot-tied tycons in it. See
-- Note [Type checking recursive type and class declarations] in
-- TcTyClsDecls
-- GHC.Tc.TyCl
type KnotTied ty = ty
{- **********************************************************************
......@@ -856,7 +856,7 @@ Here Foo's TyConBinders are
and its kind prints as
Foo :: forall a -> forall b. (a -> b -> Type) -> Type
See also Note [Required, Specified, and Inferred for types] in TcTyClsDecls
See also Note [Required, Specified, and Inferred for types] in GHC.Tc.TyCl
---- Printing -----
......@@ -892,7 +892,7 @@ We could change this decision, but Required, Named TyCoBinders are rare
anyway. (Most are Anons.)
However the type of a term can (just about) have a required quantifier;
see Note [Required quantifiers in the type of a term] in TcExpr.
see Note [Required quantifiers in the type of a term] in GHC.Tc.Gen.Expr.
-}
......@@ -1603,7 +1603,7 @@ equality types story] in TysPrim for background on equality constraints.
For unboxed equalities:
- Generate a CoercionHole, a mutable variable just like a unification
variable
- Wrap the CoercionHole in a Wanted constraint; see TcRnTypes.TcEvDest
- Wrap the CoercionHole in a Wanted constraint; see GHC.Tc.Utils.TcEvDest
- Use the CoercionHole in a Coercion, via HoleCo
- Solve the constraint later
- When solved, fill in the CoercionHole by side effect, instead of
......@@ -1650,7 +1650,7 @@ Note [CoercionHoles and coercion free variables]
Why does a CoercionHole contain a CoVar, as well as reference to
fill in? Because we want to treat that CoVar as a free variable of
the coercion. See #14584, and Note [What prevents a
constraint from floating] in TcSimplify, item (4):
constraint from floating] in GHC.Tc.Solver, item (4):
forall k. [W] co1 :: t1 ~# t2 |> co2
[W] co2 :: k ~# *
......
......@@ -311,7 +311,7 @@ See also Note [Wrappers for data instance tycons] in GHC.Types.Id.Make
data type with some axioms that connect it to other data types.
* The tyConTyVars of the representation tycon are the tyvars that the
user wrote in the patterns. This is important in TcDeriv, where we
user wrote in the patterns. This is important in GHC.Tc.Deriv, where we
bring these tyvars into scope before type-checking the deriving
clause. This fact is arranged for in TcInstDecls.tcDataFamInstDecl.
......@@ -355,7 +355,7 @@ might happen, say, with the following declaration:
data T a b c where
MkT :: b -> T Int b c
Data and class tycons have their roles inferred (see inferRoles in TcTyDecls),
Data and class tycons have their roles inferred (see inferRoles in GHC.Tc.TyCl.Utils),
as do vanilla synonym tycons. Family tycons have all parameters at role N,
though it is conceivable that we could relax this restriction. (->)'s and
tuples' parameters are at role R. Each primitive tycon declares its roles;
......@@ -405,9 +405,9 @@ must be True.
See also:
* [Injectivity annotation] in GHC.Hs.Decls
* [Renaming injectivity annotation] in GHC.Rename.Source
* [Renaming injectivity annotation] in GHC.Rename.Module
* [Verifying injectivity annotation] in GHC.Core.FamInstEnv
* [Type inference for type families with injectivity] in TcInteract
* [Type inference for type families with injectivity] in GHC.Tc.Solver.Interact
************************************************************************
* *
......@@ -830,7 +830,7 @@ data TyCon
tyConKind :: Kind, -- ^ Kind of this TyCon
tyConArity :: Arity, -- ^ Arity
-- tyConTyVars connect an associated family TyCon
-- with its parent class; see TcValidity.checkConsistentFamInst
-- with its parent class; see GHC.Tc.Validity.checkConsistentFamInst
famTcResVar :: Maybe Name, -- ^ Name of result type variable, used
-- for pretty-printing with --show-iface
......@@ -897,7 +897,7 @@ data TyCon
}
-- | These exist only during type-checking. See Note [How TcTyCons work]
-- in TcTyClsDecls
-- in GHC.Tc.TyCl
| TcTyCon {
tyConUnique :: Unique,
tyConName :: Name,
......@@ -938,7 +938,7 @@ where
* required_tvs the same as tyConTyVars
* tyConArity = length required_tvs
See also Note [How TcTyCons work] in TcTyClsDecls
See also Note [How TcTyCons work] in GHC.Tc.TyCl
-}
-- | Represents right-hand-sides of 'TyCon's for algebraic types
......@@ -1297,7 +1297,7 @@ so the coercion tycon CoT must have
kind: T ~ []
and arity: 0
This eta-reduction is implemented in BuildTyCl.mkNewTyConRhs.
This eta-reduction is implemented in GHC.Tc.TyCl.Build.mkNewTyConRhs.
************************************************************************
......@@ -1331,7 +1331,7 @@ tyConRepName_maybe _ = Nothing