Commit 2d4f9ad8 authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot
Browse files

Ensure that coreView/tcView are able to inline

Previously an import cycle between Type and TyCoRep meant that several
functions in TyCoRep ended up SOURCE import coreView. This is quite
unfortunate as coreView is intended to be fused into a larger pattern
match and not incur an extra call.

Fix this with a bit of restructuring:

 * Move the functions in `TyCoRep` which depend upon things in `Type`
   into `Type`
 * Fold contents of `Kind` into `Type` and turn `Kind` into a simple
   wrapper re-exporting kind-ish things from `Type`
 * Clean up the redundant imports that popped up as a result

Closes #17441.

Metric Decrease:
    T4334
parent 535d0edc
......@@ -23,7 +23,8 @@ import GhcPrelude
import {-# SOURCE #-} GHC.Hs.Expr( HsExpr, pprExpr )
import BasicTypes ( IntegralLit(..),FractionalLit(..),negateIntegralLit,
negateFractionalLit,SourceText(..),pprWithSourceText )
negateFractionalLit,SourceText(..),pprWithSourceText,
PprPrec(..), topPrec )
import Type
import Outputable
import FastString
......
......@@ -27,6 +27,7 @@ module PatSyn (
import GhcPrelude
import Type
import TyCoPpr
import Name
import Outputable
import Unique
......
......@@ -46,12 +46,12 @@ import PprCore
import ErrUtils
import Coercion
import SrcLoc
import Kind
import Type
import RepType
import TyCoRep -- checks validity of types/coercions
import TyCoSubst
import TyCoFVs
import TyCoPpr ( pprTyVar )
import TyCon
import CoAxiom
import BasicTypes
......
......@@ -27,7 +27,7 @@ import IdInfo
import Demand
import DataCon
import TyCon
import Type
import TyCoPpr
import Coercion
import DynFlags
import BasicTypes
......
......@@ -49,6 +49,7 @@ import MkId
import Module
import ConLike
import DataCon
import TyCoPpr( pprWithTYPE )
import TysWiredIn
import PrelNames
import BasicTypes
......
......@@ -536,7 +536,6 @@ Library
InstEnv
TyCon
CoAxiom
Kind
Type
TyCoRep
TyCoFVs
......
......@@ -38,12 +38,12 @@ import PrimOp
import CoreFVs
import Type
import RepType
import Kind ( isLiftedTypeKind )
import DataCon
import TyCon
import Util
import VarSet
import TysPrim
import TyCoPpr ( pprType )
import ErrUtils
import Unique
import FastString
......
......@@ -63,7 +63,7 @@ import GhcPrelude
import {-# SOURCE #-} TysWiredIn ( coercibleTyCon, heqTyCon
, liftedRepDataConTyCon, tupleTyConName )
import {-# SOURCE #-} TyCoRep ( isRuntimeRepTy )
import {-# SOURCE #-} Type ( isRuntimeRepTy )
import DynFlags
import TyCon hiding ( pprPromotionQuote )
......@@ -964,7 +964,7 @@ defaultRuntimeRepVars ty = go False emptyFsEnv ty
go in_kind _ ty@(IfaceFreeTyVar tv)
-- See Note [Defaulting RuntimeRep variables], about free vars
| in_kind && TyCoRep.isRuntimeRepTy (tyVarKind tv)
| in_kind && Type.isRuntimeRepTy (tyVarKind tv)
= IfaceTyConApp liftedRep IA_Nil
| otherwise
= ty
......
......@@ -39,7 +39,8 @@ import PrelNames ( pluginTyConName, frontendPluginTyConName )
import HscTypes
import GHCi.RemoteTypes ( HValue )
import Type ( Type, eqType, mkTyConTy, pprTyThingCategory )
import Type ( Type, eqType, mkTyConTy )
import TyCoPpr ( pprTyThingCategory )
import TyCon ( TyCon )
import Name ( Name, nameModule_maybe )
import Id ( idType )
......
......@@ -321,6 +321,7 @@ import TcType
import Id
import TysPrim ( alphaTyVars )
import TyCon
import TyCoPpr ( pprForAll )
import Class
import DataCon
import Name hiding ( varName )
......
......@@ -21,15 +21,14 @@ module PprTyThing (
import GhcPrelude
import Type ( ArgFlag(..), TyThing(..), mkTyVarBinders, pprUserForAll )
import Type ( Type, ArgFlag(..), TyThing(..), mkTyVarBinders, tidyOpenType )
import IfaceSyn ( ShowSub(..), ShowHowMuch(..), AltPpr(..)
, showToHeader, pprIfaceDecl )
import CoAxiom ( coAxiomTyCon )
import HscTypes( tyThingParent_maybe )
import MkIface ( tyThingToIfaceDecl )
import Type ( tidyOpenType )
import FamInstEnv( FamInst(..), FamFlavor(..) )
import Type( Type, pprTypeApp, pprSigmaType )
import TyCoPpr ( pprUserForAll, pprTypeApp, pprSigmaType )
import Name
import VarEnv( emptyTidyEnv )
import Outputable
......
......@@ -70,7 +70,6 @@ import BasicTypes
-- compiler/types
import Type ( funTyCon )
import Kind ( Kind )
import Class ( FunDep )
-- compiler/parser
......
......@@ -32,6 +32,7 @@ module RnNames (
import GhcPrelude
import DynFlags
import TyCoPpr
import GHC.Hs
import TcEnv
import RnEnv
......
......@@ -46,6 +46,7 @@ import DynFlags
import CoreSyn
import qualified CoreSubst
import PprCore
import TyCoPpr ( pprParendType )
import CoreFVs
import CoreUtils
import CoreArity
......
......@@ -92,6 +92,7 @@ import TcOrigin
import CoreSyn
import TyCoPpr
import OccName
import FV
import VarSet
......
......@@ -34,9 +34,9 @@ import Util
import RdrName
import DataCon ( dataConName )
import Maybes
import Type
import TyCoRep
import TyCoFVs
import TyCoPpr ( pprWithExplicitKindsWhen )
import TcMType
import Name
import Panic
......
......@@ -33,6 +33,7 @@ import InstEnv
import VarSet
import VarEnv
import TyCoFVs
import TyCoPpr( pprWithExplicitKindsWhen )
import FV
import Outputable
import ErrUtils( Validity(..), allValid )
......
......@@ -54,6 +54,7 @@ import FunDeps
import TcMType
import Type
import TyCoRep
import TyCoPpr ( debugPprType )
import TcType
import HscTypes
import Class( Class )
......
......@@ -35,6 +35,7 @@ import Inst
import FamInstEnv
import TcHsType
import TyCoRep
import TyCoPpr ( pprTyVars )
import RnNames( extendGlobalRdrEnvRn )
import RnBinds
......
......@@ -36,6 +36,7 @@ import Constraint
import Predicate
import TcType
import TyCon
import TyCoPpr (pprTyVars)
import Type
import TcSimplify
import TcValidity (validDerivPred)
......
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