{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MonadComprehensions #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE OverloadedStrings #-}

{-# OPTIONS_GHC -fno-warn-orphans #-} -- instance Diagnostic TcRnMessage
{-# LANGUAGE InstanceSigs #-}

module GHC.Tc.Errors.Ppr
  ( pprTypeDoesNotHaveFixedRuntimeRep
  , pprScopeError
  --
  , tidySkolemInfo
  , tidySkolemInfoAnon
  --
  , pprHsDocContext
  , inHsDocContext
  , TcRnMessageOpts(..)
  , pprTyThingUsedWrong
  , pprUntouchableVariable

  --
  , mismatchMsg_ExpectedActuals

  -- | Useful when overriding message printing.
  , messageWithInfoDiagnosticMessage
  , messageWithHsDocContext
  )
  where

import GHC.Prelude

import qualified GHC.Internal.TH.Syntax as TH
-- In stage1: import "ghc-boot-th-next" qualified GHC.Internal.TH.Syntax as TH
-- In stage2: import "ghc-boot-th"      qualified GHC.Internal.TH.Syntax as TH
--            which resolves to
--            import "ghc-internal"     qualified GHC.Internal.TH.Syntax as TH
import qualified GHC.Internal.TH.Ppr as TH

import GHC.Builtin.Names
import GHC.Builtin.Types ( boxedRepDataConTyCon, tYPETyCon, filterCTuple, pretendNameIsInScope )

import GHC.Types.Name.Reader
import GHC.Unit.Module.ModIface
import GHC.Unit.Module.Warnings

import GHC.Core.Coercion
import GHC.Core.Unify     ( tcMatchTys )
import GHC.Core.TyCon
import GHC.Core.Class
import GHC.Core.DataCon
import GHC.Core.Coercion.Axiom (CoAxBranch, coAxiomTyCon, coAxiomSingleBranch)
import GHC.Core.ConLike
import GHC.Core.FamInstEnv ( FamInst(..), famInstAxiom, pprFamInst )
import GHC.Core.InstEnv
import GHC.Core.TyCo.Rep (Type(..))
import GHC.Core.TyCo.Ppr (pprWithInvisibleBitsWhen, pprSourceTyCon,
                          pprTyVars, pprWithTYPE, pprTyVar, pprTidiedType)
import GHC.Core.PatSyn ( patSynName, pprPatSynType )
import GHC.Core.Predicate
import GHC.Core.Type
import GHC.Core.FVs( orphNamesOfTypes )
import GHC.CoreToIface

import GHC.Driver.Flags
import GHC.Driver.Backend
import GHC.Hs

import GHC.Tc.Errors.Types
import GHC.Tc.Types.BasicTypes
import GHC.Tc.Types.Constraint
import GHC.Tc.Types.Origin hiding ( Position(..) )
import GHC.Tc.Types.Rank (Rank(..))
import GHC.Tc.Types.TH
import GHC.Tc.Utils.TcType

import GHC.Types.DefaultEnv (ClassDefaults(ClassDefaults, cd_types, cd_module))
import GHC.Types.Error
import GHC.Types.Error.Codes
import GHC.Types.Hint
import GHC.Types.Hint.Ppr () -- Outputable GhcHint
import GHC.Types.Basic
import GHC.Types.Id
import GHC.Types.Id.Info ( RecSelParent(..) )
import GHC.Types.Name
import GHC.Types.Name.Env
import GHC.Types.Name.Set
import GHC.Types.SourceFile
import GHC.Types.SrcLoc
import GHC.Types.TyThing
import GHC.Types.TyThing.Ppr ( pprTyThingInContext )
import GHC.Types.Unique.Set ( nonDetEltsUniqSet )
import GHC.Types.Var
import GHC.Types.Var.Set
import GHC.Types.Var.Env
import GHC.Types.Fixity (defaultFixity)

import GHC.Iface.Errors.Types
import GHC.Iface.Errors.Ppr
import GHC.Iface.Syntax

import GHC.Unit.State
import GHC.Unit.Module

import GHC.Data.Bag
import GHC.Data.FastString
import GHC.Data.List.SetOps ( nubOrdBy )
import GHC.Data.Maybe
import GHC.Data.Pair
import GHC.Settings.Constants (mAX_TUPLE_SIZE, mAX_CTUPLE_SIZE)
import GHC.Utils.Misc
import GHC.Utils.Outputable
import GHC.Utils.Panic

import qualified GHC.LanguageExtensions as LangExt

import GHC.Data.BooleanFormula (pprBooleanFormulaNice)

import Data.List.NonEmpty (NonEmpty(..))
import qualified Data.List.NonEmpty as NE
import Data.Foldable ( fold )
import Data.Function (on)
import Data.List ( groupBy, sortBy, tails
                 , partition, unfoldr )
import Data.Ord ( comparing )
import Data.Bifunctor


defaultTcRnMessageOpts :: TcRnMessageOpts
defaultTcRnMessageOpts :: TcRnMessageOpts
defaultTcRnMessageOpts = TcRnMessageOpts { tcOptsShowContext :: Bool
tcOptsShowContext = Bool
True
                                         , tcOptsIfaceOpts :: IfaceMessageOpts
tcOptsIfaceOpts = forall opts.
HasDefaultDiagnosticOpts (DiagnosticOpts opts) =>
DiagnosticOpts opts
defaultDiagnosticOpts @IfaceMessage }

instance HasDefaultDiagnosticOpts TcRnMessageOpts where
  defaultOpts :: TcRnMessageOpts
defaultOpts = TcRnMessageOpts
defaultTcRnMessageOpts

instance Diagnostic TcRnMessage where
  type DiagnosticOpts TcRnMessage = TcRnMessageOpts
  diagnosticMessage :: DiagnosticOpts TcRnMessage -> TcRnMessage -> DecoratedSDoc
diagnosticMessage DiagnosticOpts TcRnMessage
opts = \case
    TcRnUnknownMessage (UnknownDiagnostic DiagnosticOpts TcRnMessage -> DiagnosticOpts a
f a
m)
      -> DiagnosticOpts a -> a -> DecoratedSDoc
forall a. Diagnostic a => DiagnosticOpts a -> a -> DecoratedSDoc
diagnosticMessage (DiagnosticOpts TcRnMessage -> DiagnosticOpts a
f DiagnosticOpts TcRnMessage
opts) a
m
    TcRnMessageWithInfo UnitState
unit_state TcRnMessageDetailed
msg_with_info
      -> case TcRnMessageDetailed
msg_with_info of
           TcRnMessageDetailed ErrInfo
err_info TcRnMessage
msg
             -> UnitState -> ErrInfo -> Bool -> DecoratedSDoc -> DecoratedSDoc
messageWithInfoDiagnosticMessage UnitState
unit_state ErrInfo
err_info
                  (TcRnMessageOpts -> Bool
tcOptsShowContext DiagnosticOpts TcRnMessage
TcRnMessageOpts
opts)
                  (DiagnosticOpts TcRnMessage -> TcRnMessage -> DecoratedSDoc
forall a. Diagnostic a => DiagnosticOpts a -> a -> DecoratedSDoc
diagnosticMessage DiagnosticOpts TcRnMessage
opts TcRnMessage
msg)
    TcRnWithHsDocContext HsDocContext
ctxt TcRnMessage
msg
      -> TcRnMessageOpts -> HsDocContext -> DecoratedSDoc -> DecoratedSDoc
messageWithHsDocContext DiagnosticOpts TcRnMessage
TcRnMessageOpts
opts HsDocContext
ctxt (DiagnosticOpts TcRnMessage -> TcRnMessage -> DecoratedSDoc
forall a. Diagnostic a => DiagnosticOpts a -> a -> DecoratedSDoc
diagnosticMessage DiagnosticOpts TcRnMessage
opts TcRnMessage
msg)
    TcRnSolverReport SolverReportWithCtxt
msg DiagnosticReason
_
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ SolverReportWithCtxt -> SDoc
pprSolverReportWithCtxt SolverReportWithCtxt
msg
    TcRnSolverDepthError Type
ty SubGoalDepth
depth -> SDoc -> DecoratedSDoc
mkSimpleDecorated SDoc
msg
      where
        msg :: SDoc
msg =
          [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Reduction stack overflow; size =" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SubGoalDepth -> SDoc
forall a. Outputable a => a -> SDoc
ppr SubGoalDepth
depth
               , SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"When simplifying the following type:")
                    Arity
2 (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty) ]
    TcRnRedundantConstraints [TyVar]
redundants (SkolemInfoAnon
info, Bool
show_info)
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
         [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Redundant constraint" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [TyVar] -> SDoc
forall a. [a] -> SDoc
plural [TyVar]
redundants SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
colon
           SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [TyVar] -> SDoc
pprEvVarTheta [TyVar]
redundants
         SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ if Bool
show_info then [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"In" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SkolemInfoAnon -> SDoc
forall a. Outputable a => a -> SDoc
ppr SkolemInfoAnon
info else SDoc
forall doc. IsOutput doc => doc
empty
    TcRnInaccessibleCode Implication
implic SolverReportWithCtxt
contra
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
         SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Inaccessible code in")
           Arity
2 (SkolemInfoAnon -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Implication -> SkolemInfoAnon
ic_info Implication
implic))
         SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ SolverReportWithCtxt -> SDoc
pprSolverReportWithCtxt SolverReportWithCtxt
contra
    TcRnInaccessibleCoAxBranch TyCon
fam_tc CoAxBranch
cur_branch
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Type family instance equation is overlapped:" SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
          Arity -> SDoc -> SDoc
nest Arity
2 (TyCon -> CoAxBranch -> SDoc
pprCoAxBranchUser TyCon
fam_tc CoAxBranch
cur_branch)
    TcRnTypeDoesNotHaveFixedRuntimeRep Type
ty FixedRuntimeRepProvenance
prov (ErrInfo SDoc
extra SDoc
supplementary)
      -> [SDoc] -> DecoratedSDoc
mkDecorated [Type -> FixedRuntimeRepProvenance -> SDoc
pprTypeDoesNotHaveFixedRuntimeRep Type
ty FixedRuntimeRepProvenance
prov, SDoc
extra, SDoc
supplementary]
    TcRnImplicitLift Name
id_or_name ErrInfo{SDoc
errInfoContext :: SDoc
errInfoSupplementary :: SDoc
errInfoSupplementary :: ErrInfo -> SDoc
errInfoContext :: ErrInfo -> SDoc
..}
      -> [SDoc] -> DecoratedSDoc
mkDecorated ([SDoc] -> DecoratedSDoc) -> [SDoc] -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           ( [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The variable" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
id_or_name) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
             [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is implicitly lifted in the TH quotation"
           ) SDoc -> [SDoc] -> [SDoc]
forall a. a -> [a] -> [a]
: [SDoc
errInfoContext, SDoc
errInfoSupplementary]
    TcRnUnusedPatternBinds HsBind (GhcPass 'Renamed)
bind
      -> [SDoc] -> DecoratedSDoc
mkDecorated [SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"This pattern-binding binds no variables:") Arity
2 (HsBind (GhcPass 'Renamed) -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsBind (GhcPass 'Renamed)
bind)]
    TcRnDodgyImports (DodgyImportsEmptyParent GlobalRdrElt
gre)
      -> [SDoc] -> DecoratedSDoc
mkDecorated [SDoc -> GlobalRdrElt -> IE (GhcPass 'Renamed) -> SDoc
forall ie. Outputable ie => SDoc -> GlobalRdrElt -> ie -> SDoc
dodgy_msg ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"import") GlobalRdrElt
gre (GlobalRdrElt -> IE (GhcPass 'Renamed)
dodgy_msg_insert GlobalRdrElt
gre)]
    TcRnDodgyImports (DodgyImportsHiding ImportLookupReason
reason)
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
         ImportLookupReason -> SDoc
pprImportLookup ImportLookupReason
reason
    TcRnDodgyExports GlobalRdrElt
gre
      -> [SDoc] -> DecoratedSDoc
mkDecorated [SDoc -> GlobalRdrElt -> IE (GhcPass 'Renamed) -> SDoc
forall ie. Outputable ie => SDoc -> GlobalRdrElt -> ie -> SDoc
dodgy_msg ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"export") GlobalRdrElt
gre (GlobalRdrElt -> IE (GhcPass 'Renamed)
dodgy_msg_insert GlobalRdrElt
gre)]
    TcRnMissingImportList IE GhcPs
ie
      -> [SDoc] -> DecoratedSDoc
mkDecorated [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The import item" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (IE GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
ppr IE GhcPs
ie) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
                       [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"does not have an explicit import list"
                     ]
    TcRnMessage
TcRnUnsafeDueToPlugin
      -> [SDoc] -> DecoratedSDoc
mkDecorated [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Use of plugins makes the module unsafe"]
    TcRnModMissingRealSrcSpan Module
mod
      -> [SDoc] -> DecoratedSDoc
mkDecorated [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Module does not have a RealSrcSpan:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Module -> SDoc
forall a. Outputable a => a -> SDoc
ppr Module
mod]
    TcRnIdNotExportedFromModuleSig Name
name Module
mod
      -> [SDoc] -> DecoratedSDoc
mkDecorated [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The identifier" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> OccName -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Name -> OccName
forall name. HasOccName name => name -> OccName
occName Name
name) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
                       [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"does not exist in the signature for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Module -> SDoc
forall a. Outputable a => a -> SDoc
ppr Module
mod
                     ]
    TcRnIdNotExportedFromLocalSig Name
name
      -> [SDoc] -> DecoratedSDoc
mkDecorated [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The identifier" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> OccName -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Name -> OccName
forall name. HasOccName name => name -> OccName
occName Name
name) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
                       [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"does not exist in the local signature."
                     ]
    TcRnShadowedName OccName
occ ShadowedNameProvenance
provenance
      -> let shadowed_locs :: [SDoc]
shadowed_locs = case ShadowedNameProvenance
provenance of
               ShadowedNameProvenanceLocal SrcLoc
n     -> [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"bound at" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SrcLoc -> SDoc
forall a. Outputable a => a -> SDoc
ppr SrcLoc
n]
               ShadowedNameProvenanceGlobal [GlobalRdrElt]
gres -> (GlobalRdrElt -> SDoc) -> [GlobalRdrElt] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map GlobalRdrElt -> SDoc
forall info. GlobalRdrEltX info -> SDoc
pprNameProvenance [GlobalRdrElt]
gres
         in SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
            [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"This binding for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (OccName -> SDoc
forall a. Outputable a => a -> SDoc
ppr OccName
occ)
             SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"shadows the existing binding" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [SDoc] -> SDoc
forall a. [a] -> SDoc
plural [SDoc]
shadowed_locs,
                   Arity -> SDoc -> SDoc
nest Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [SDoc]
shadowed_locs)]
    TcRnInvalidWarningCategory WarningCategory
cat
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Warning category" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (WarningCategory -> SDoc
forall a. Outputable a => a -> SDoc
ppr WarningCategory
cat) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is not valid",
                 [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"(user-defined category names must begin with" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"x-"),
                 [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"and contain only letters, numbers, apostrophes and dashes)" ]
    TcRnDuplicateWarningDecls LocatedN RdrName
d RdrName
rdr_name
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Multiple warning declarations for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr RdrName
rdr_name),
                 [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"also at " SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr (LocatedN RdrName -> SrcSpan
forall a e. HasLoc a => GenLocated a e -> SrcSpan
getLocA LocatedN RdrName
d)]
    TcRnSimplifierTooManyIterations Cts
simples IntWithInf
limit WantedConstraints
wc
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"solveWanteds: too many iterations"
                   SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"limit =" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> IntWithInf -> SDoc
forall a. Outputable a => a -> SDoc
ppr IntWithInf
limit))
                Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Unsolved:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> WantedConstraints -> SDoc
forall a. Outputable a => a -> SDoc
ppr WantedConstraints
wc
                        , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Simples:"  SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Cts -> SDoc
forall a. Outputable a => a -> SDoc
ppr Cts
simples
                        ])
    TcRnIllegalPatSynDecl LIdP GhcPs
rdrname
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal pattern synonym declaration for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (LocatedN RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr LIdP GhcPs
LocatedN RdrName
rdrname))
              Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Pattern synonym declarations are only valid at top level")
    TcRnLinearPatSyn Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Pattern synonyms do not support linear fields (GHC #18806):") Arity
2 (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty)
    TcRnMessage
TcRnEmptyRecordUpdate
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Empty record update"
    TcRnIllegalFieldPunning Located RdrName
fld
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal use of punning for field" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Located RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located RdrName
fld)
    TcRnIllegalWildcardsInRecord RecordFieldPart
fld_part
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal `..' in record" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> RecordFieldPart -> SDoc
pprRecordFieldPart RecordFieldPart
fld_part
    TcRnIllegalWildcardInType Maybe Name
mb_name BadAnonWildcardContext
bad
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ case BadAnonWildcardContext
bad of
          BadAnonWildcardContext
WildcardNotLastInConstraint ->
            SDoc -> Arity -> SDoc -> SDoc
hang SDoc
notAllowed Arity
2 SDoc
constraint_hint_msg
          ExtraConstraintWildcardNotAllowed SoleExtraConstraintWildcardAllowed
allow_sole ->
            case SoleExtraConstraintWildcardAllowed
allow_sole of
              SoleExtraConstraintWildcardAllowed
SoleExtraConstraintWildcardNotAllowed ->
                SDoc
notAllowed
              SoleExtraConstraintWildcardAllowed
SoleExtraConstraintWildcardAllowed ->
                SDoc -> Arity -> SDoc -> SDoc
hang SDoc
notAllowed Arity
2 SDoc
sole_msg
          BadAnonWildcardContext
WildcardsNotAllowedAtAll ->
            SDoc
notAllowed
      where
        notAllowed, what, wildcard, how :: SDoc
        notAllowed :: SDoc
notAllowed = SDoc
what SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes SDoc
wildcard SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
how
        wildcard :: SDoc
wildcard = case Maybe Name
mb_name of
          Maybe Name
Nothing   -> SDoc
pprAnonWildCard
          Just Name
name -> Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name
        what :: SDoc
what
          | Just Name
_ <- Maybe Name
mb_name
          = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Named wildcard"
          | ExtraConstraintWildcardNotAllowed {} <- BadAnonWildcardContext
bad
          = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Extra-constraint wildcard"
          | Bool
otherwise
          = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Wildcard"
        how :: SDoc
how = case BadAnonWildcardContext
bad of
          BadAnonWildcardContext
WildcardNotLastInConstraint
            -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"not allowed in a constraint"
          BadAnonWildcardContext
_ -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"not allowed"
        constraint_hint_msg :: SDoc
        constraint_hint_msg :: SDoc
constraint_hint_msg
          | Just Name
_ <- Maybe Name
mb_name
          = [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Extra-constraint wildcards must be anonymous"
                 , Arity -> SDoc -> SDoc
nest Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"e.g  f :: (Eq a, _) => blah") ]
          | Bool
otherwise
          = [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"except as the last top-level constraint of a type signature"
                 , Arity -> SDoc -> SDoc
nest Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"e.g  f :: (Eq a, _) => blah") ]
        sole_msg :: SDoc
        sole_msg :: SDoc
sole_msg =
          [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"except as the sole constraint"
               , Arity -> SDoc -> SDoc
nest Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"e.g., deriving instance _ => Eq (Foo a)") ]
    TcRnIllegalNamedWildcardInTypeArgument RdrName
rdr
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal named wildcard in a required type argument:")
                Arity
2 (SDoc -> SDoc
quotes (RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr RdrName
rdr))
    TcRnIllegalImplicitTyVarInTypeArgument RdrName
rdr
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
            SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal implicitly quantified type variable in a required type argument:")
                Arity
2 (SDoc -> SDoc
quotes (RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr RdrName
rdr))
    TcRnDuplicateFieldName RecordFieldPart
fld_part NonEmpty RdrName
dups
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Duplicate field name"
                , SDoc -> SDoc
quotes (OccName -> SDoc
forall a. Outputable a => a -> SDoc
ppr (RdrName -> OccName
rdrNameOcc (RdrName -> OccName) -> RdrName -> OccName
forall a b. (a -> b) -> a -> b
$ NonEmpty RdrName -> RdrName
forall a. NonEmpty a -> a
NE.head NonEmpty RdrName
dups))
                , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in record", RecordFieldPart -> SDoc
pprRecordFieldPart RecordFieldPart
fld_part ]
    TcRnIllegalViewPattern Pat GhcPs
pat
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal view pattern: " SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Pat GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
ppr Pat GhcPs
pat]
    TcRnCharLiteralOutOfRange Char
c
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"character literal out of range: '\\" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
c  SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
'\''
    TcRnIllegalWildcardsInConstructor Name
con
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal `{..}' notation for constructor" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
con)
                , Arity -> SDoc -> SDoc
nest Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Record wildcards may not be used for constructors with unlabelled fields.")
                , Arity -> SDoc -> SDoc
nest Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Possible fix: Remove the `{..}' and add a match for each field of the constructor.")
                ]
    TcRnIgnoringAnnotations [LAnnDecl (GhcPass 'Renamed)]
anns
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Ignoring ANN annotation" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [GenLocated SrcSpanAnnA (AnnDecl (GhcPass 'Renamed))] -> SDoc
forall a. [a] -> SDoc
plural [LAnnDecl (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (AnnDecl (GhcPass 'Renamed))]
anns SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
comma
           SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"because this is a stage-1 compiler without -fexternal-interpreter or doesn't support GHCi"
    TcRnMessage
TcRnAnnotationInSafeHaskell
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Annotations are not compatible with Safe Haskell."
                , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"See https://gitlab.haskell.org/ghc/ghc/issues/10826" ]
    TcRnInvalidTypeApplication Type
fun_ty LHsWcType (GhcPass 'Renamed)
hs_ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Cannot apply expression of type" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
fun_ty) SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"to a visible type argument" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (HsWildCardBndrs
  (GhcPass 'Renamed)
  (GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed)))
-> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsWcType (GhcPass 'Renamed)
HsWildCardBndrs
  (GhcPass 'Renamed)
  (GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed)))
hs_ty)
    TcRnMessage
TcRnTagToEnumMissingValArg
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"tagToEnum# must appear applied to one value argument"
    TcRnTagToEnumUnspecifiedResTy Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Bad call to tagToEnum# at type" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty)
              Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Specify the type by giving a type signature"
                      , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"e.g. (tagToEnum# x) :: Bool" ])
    TcRnTagToEnumResTyNotAnEnum Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Bad call to tagToEnum# at type" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty)
              Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Result type must be an enumeration type")
    TcRnTagToEnumResTyTypeData Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Bad call to tagToEnum# at type" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty)
              Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Result type cannot be headed by a `type data` type")
    TcRnMessage
TcRnArrowIfThenElsePredDependsOnResultTy
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Predicate type of `ifThenElse' depends on result type"
    TcRnIllegalHsBootOrSigDecl HsBootOrSig
boot_or_sig BadBootDecls
decls
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
what SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
whr SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
dot
        where
          what :: SDoc
what = case BadBootDecls
decls of
            BootBindsPs      {} -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"binding"
            BootBindsRn      {} -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"binding"
            BootInstanceSigs {} -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"instance body"
            BootFamInst      {} -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"family instance"
            BootSpliceDecls  {} -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"splice"
            BootForeignDecls {} -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"foreign declaration"
            BootDefaultDecls {} -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"default declaration"
            BootRuleDecls    {} -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"RULE pragma"
          whr :: SDoc
whr = case HsBootOrSig
boot_or_sig of
            HsBootOrSig
HsBoot -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"an hs-boot file"
            HsBootOrSig
Hsig   -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"a backpack signature file"
    TcRnBootMismatch HsBootOrSig
boot_or_sig BootMismatch
err ->
      SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ HsBootOrSig -> BootMismatch -> SDoc
pprBootMismatch HsBootOrSig
boot_or_sig BootMismatch
err
    TcRnRecursivePatternSynonym LHsBinds (GhcPass 'Renamed)
binds
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
            SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Recursive pattern synonym definition with following bindings:")
               Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ([SDoc] -> SDoc) -> [SDoc] -> SDoc
forall a b. (a -> b) -> a -> b
$ (GenLocated SrcSpanAnnA (HsBind (GhcPass 'Renamed)) -> SDoc)
-> [GenLocated SrcSpanAnnA (HsBind (GhcPass 'Renamed))] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated SrcSpanAnnA (HsBind (GhcPass 'Renamed)) -> SDoc
forall a idR.
CollectPass (GhcPass 'Renamed) =>
GenLocated (EpAnn a) (HsBindLR (GhcPass 'Renamed) idR) -> SDoc
pprLBind LHsBinds (GhcPass 'Renamed)
[GenLocated SrcSpanAnnA (HsBind (GhcPass 'Renamed))]
binds)
          where
            pprLoc :: a -> SDoc
pprLoc a
loc = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"defined at" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
loc)
            pprLBind :: CollectPass GhcRn => GenLocated (EpAnn a) (HsBindLR GhcRn idR) -> SDoc
            pprLBind :: forall a idR.
CollectPass (GhcPass 'Renamed) =>
GenLocated (EpAnn a) (HsBindLR (GhcPass 'Renamed) idR) -> SDoc
pprLBind (L EpAnn a
loc HsBindLR (GhcPass 'Renamed) idR
bind) = (Name -> SDoc) -> [Name] -> SDoc
forall a. (a -> SDoc) -> [a] -> SDoc
pprWithCommas Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr (CollectFlag (GhcPass 'Renamed)
-> HsBindLR (GhcPass 'Renamed) idR -> [IdP (GhcPass 'Renamed)]
forall p idR.
CollectPass p =>
CollectFlag p -> HsBindLR p idR -> [IdP p]
collectHsBindBinders CollectFlag (GhcPass 'Renamed)
forall p. CollectFlag p
CollNoDictBinders HsBindLR (GhcPass 'Renamed) idR
bind)
                                        SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
pprLoc (EpAnn a -> SrcSpan
forall a. HasLoc a => a -> SrcSpan
locA EpAnn a
loc)
    TcRnPartialTypeSigTyVarMismatch Name
n1 Name
n2 Name
fn_name LHsSigWcType (GhcPass 'Renamed)
hs_ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Couldn't match" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n1)
                   SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"with" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n2))
                Arity
2 (SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"both bound by the partial type signature:")
                        Arity
2 (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
fn_name SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> HsWildCardBndrs
  (GhcPass 'Renamed)
  (GenLocated SrcSpanAnnA (HsSigType (GhcPass 'Renamed)))
-> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsSigWcType (GhcPass 'Renamed)
HsWildCardBndrs
  (GhcPass 'Renamed)
  (GenLocated SrcSpanAnnA (HsSigType (GhcPass 'Renamed)))
hs_ty))
    TcRnPartialTypeSigBadQuantifier Name
n Name
fn_name Maybe Type
m_unif_ty LHsSigWcType (GhcPass 'Renamed)
hs_ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Can't quantify over" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n))
                Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"bound by the partial type signature:")
                             Arity
2 (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
fn_name SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> HsWildCardBndrs
  (GhcPass 'Renamed)
  (GenLocated SrcSpanAnnA (HsSigType (GhcPass 'Renamed)))
-> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsSigWcType (GhcPass 'Renamed)
HsWildCardBndrs
  (GhcPass 'Renamed)
  (GenLocated SrcSpanAnnA (HsSigType (GhcPass 'Renamed)))
hs_ty)
                        , SDoc
extra ])
      where
        extra :: SDoc
extra | Just Type
rhs_ty <- Maybe Type
m_unif_ty
              = [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n), [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"should really be", SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
rhs_ty) ]
              | Bool
otherwise
              = SDoc
forall doc. IsOutput doc => doc
empty
    TcRnMissingSignature MissingSignature
what Exported
_ ->
      SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      case MissingSignature
what of
        MissingPatSynSig PatSyn
p ->
          SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Pattern synonym with no type signature:")
            Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"pattern" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Name -> SDoc
forall a. NamedThing a => a -> SDoc
pprPrefixName (PatSyn -> Name
patSynName PatSyn
p) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> PatSyn -> SDoc
pprPatSynType PatSyn
p)
        MissingTopLevelBindingSig Name
name Type
ty ->
          SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Top-level binding with no type signature:")
            Arity
2 (Name -> SDoc
forall a. NamedThing a => a -> SDoc
pprPrefixName Name
name SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
pprSigmaType Type
ty)
        MissingTyConKindSig TyCon
tc Bool
cusks_enabled ->
          SDoc -> Arity -> SDoc -> SDoc
hang SDoc
msg
            Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"type" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Name -> SDoc
forall a. NamedThing a => a -> SDoc
pprPrefixName (TyCon -> Name
tyConName TyCon
tc) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
pprKind (TyCon -> Type
tyConKind TyCon
tc))
          where
            msg :: SDoc
msg | Bool
cusks_enabled
                = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Top-level type constructor with no standalone kind signature or CUSK:"
                | Bool
otherwise
                = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Top-level type constructor with no standalone kind signature:"

    TcRnPolymorphicBinderMissingSig Name
n Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Polymorphic local binding with no type signature:"
               , Arity -> SDoc -> SDoc
nest Arity
2 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ Name -> SDoc
forall a. NamedThing a => a -> SDoc
pprPrefixName Name
n SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty ]
    TcRnOverloadedSig TcIdSig
sig
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Overloaded signature conflicts with monomorphism restriction")
              Arity
2 (TcIdSig -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcIdSig
sig)
    TcRnTupleConstraintInst Class
_
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"You can't specify an instance for a tuple constraint"
    TcRnUserTypeError Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (Type -> SDoc
pprUserTypeErrorTy Type
ty)
    TcRnConstraintInKind Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal constraint in a kind:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
pprType Type
ty
    TcRnUnboxedTupleOrSumTypeFuncArg UnboxedTupleOrSum
tuple_or_sum Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal unboxed" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
what SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"type as function argument:"
               , Type -> SDoc
pprType Type
ty ]
        where
          what :: SDoc
what = case UnboxedTupleOrSum
tuple_or_sum of
            UnboxedTupleOrSum
UnboxedTupleType -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"tuple"
            UnboxedTupleOrSum
UnboxedSumType   -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"sum"
    TcRnLinearFuncInKind Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal linear function in a kind:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
pprType Type
ty
    TcRnForAllEscapeError Type
ty Type
kind
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat
           [ SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Quantified type's kind mentions quantified type variable")
                Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"type:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty))
           , SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"where the body of the forall has this kind:")
                Arity
2 (SDoc -> SDoc
quotes (Type -> SDoc
pprKind Type
kind)) ]
    TcRnSimplifiableConstraint Type
pred InstanceWhat
what
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat
           [ SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The constraint" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
pprType Type
pred) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"matches")
                Arity
2 (InstanceWhat -> SDoc
forall a. Outputable a => a -> SDoc
ppr InstanceWhat
what)
           , SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"This makes type inference for inner bindings fragile;")
                Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"either use MonoLocalBinds, or simplify it using the instance") ]
    TcRnArityMismatch TyThing
thing Arity
thing_arity Arity
nb_args
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
what, SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Name -> SDoc) -> Name -> SDoc
forall a b. (a -> b) -> a -> b
$ TyThing -> Name
forall a. NamedThing a => a -> Name
getName TyThing
thing), [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"should have"
                , SDoc
n_arguments SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
comma, [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"but has been given"
                , if Arity
nb_args Arity -> Arity -> Bool
forall a. Eq a => a -> a -> Bool
== Arity
0 then [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"none" else Arity -> SDoc
forall doc. IsLine doc => Arity -> doc
int Arity
nb_args
                ]
          where
            what :: SDoc
what = case TyThing
thing of
              ATyCon TyCon
tc -> TyConFlavour TyCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr (TyCon -> TyConFlavour TyCon
tyConFlavour TyCon
tc)
              TyThing
_         -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text (TyThing -> [Char]
tyThingCategory TyThing
thing)
            n_arguments :: SDoc
n_arguments | Arity
thing_arity Arity -> Arity -> Bool
forall a. Eq a => a -> a -> Bool
== Arity
0 = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"no arguments"
                        | Arity
thing_arity Arity -> Arity -> Bool
forall a. Eq a => a -> a -> Bool
== Arity
1 = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"1 argument"
                        | Bool
True          = [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [Arity -> SDoc
forall doc. IsLine doc => Arity -> doc
int Arity
thing_arity, [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"arguments"]
    TcRnIllegalInstance IllegalInstanceReason
reason ->
      SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ IllegalInstanceReason -> SDoc
pprIllegalInstance IllegalInstanceReason
reason
    TcRnVDQInTermType Maybe Type
mb_ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
             case Maybe Type
mb_ty of
               Maybe Type
Nothing -> SDoc
main_msg
               Just Type
ty -> SDoc -> Arity -> SDoc -> SDoc
hang (SDoc
main_msg SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
':') Arity
2 (Type -> SDoc
pprType Type
ty)
      where
        main_msg :: SDoc
main_msg =
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal visible, dependent quantification" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in the type of a term"
    TcRnBadQuantPredHead Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Quantified predicate must have a class or type variable head:")
              Arity
2 (Type -> SDoc
pprType Type
ty)
    TcRnIllegalTupleConstraint Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal tuple constraint:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
pprType Type
ty
    TcRnNonTypeVarArgInConstraint Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Non type-variable argument")
              Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in the constraint:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
pprType Type
ty)
    TcRnIllegalImplicitParam Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal implicit parameter" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
pprType Type
ty)
    TcRnIllegalConstraintSynonymOfKind Type
kind
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal constraint synonym of kind:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
pprKind Type
kind)
    TcRnOversaturatedVisibleKindArg Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal oversaturated visible kind argument:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
           SDoc -> SDoc
quotes (Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
'@' SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> Type -> SDoc
pprParendType Type
ty)
    TcRnForAllRankErr Rank
rank Type
ty
      -> let herald :: SDoc
herald = case Type -> ([TyVar], Type)
tcSplitForAllTyVars Type
ty of
               ([], Type
_) -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal qualified type:"
               ([TyVar], Type)
_       -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal polymorphic type:"
             extra :: SDoc
extra = case Rank
rank of
               Rank
MonoTypeConstraint -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"A constraint must be a monotype"
               Rank
_                  -> SDoc
forall doc. IsOutput doc => doc
empty
         in SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [SDoc -> Arity -> SDoc -> SDoc
hang SDoc
herald Arity
2 (Type -> SDoc
pprType Type
ty), SDoc
extra]
    TcRnMonomorphicBindings [Name]
bindings
      -> let pp_bndrs :: SDoc
pp_bndrs = [Name] -> SDoc
pprBindings [Name]
bindings
         in SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
              [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The Monomorphism Restriction applies to the binding"
                  SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [Name] -> SDoc
forall a. [a] -> SDoc
plural [Name]
bindings
                  , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
pp_bndrs ]
    TcRnOrphanInstance (Left ClsInst
cls_inst)
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Orphan class instance:")
              Arity
2 (ClsInst -> SDoc
pprInstanceHdr ClsInst
cls_inst)
    TcRnOrphanInstance (Right FamInst
fam_inst)
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Orphan family instance:")
              Arity
2 (FamInst -> SDoc
pprFamInst FamInst
fam_inst)
    TcRnFunDepConflict UnitState
unit_state NonEmpty ClsInst
sorted
      -> let herald :: SDoc
herald = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Functional dependencies conflict between instance declarations:"
         in SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
              UnitState -> SDoc -> SDoc
pprWithUnitState UnitState
unit_state (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ (SDoc -> Arity -> SDoc -> SDoc
hang SDoc
herald Arity
2 ([ClsInst] -> SDoc
pprInstances ([ClsInst] -> SDoc) -> [ClsInst] -> SDoc
forall a b. (a -> b) -> a -> b
$ NonEmpty ClsInst -> [ClsInst]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ClsInst
sorted))
    TcRnDupInstanceDecls UnitState
unit_state NonEmpty ClsInst
sorted
      -> let herald :: SDoc
herald = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Duplicate instance declarations:"
         in SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
              UnitState -> SDoc -> SDoc
pprWithUnitState UnitState
unit_state (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ (SDoc -> Arity -> SDoc -> SDoc
hang SDoc
herald Arity
2 ([ClsInst] -> SDoc
pprInstances ([ClsInst] -> SDoc) -> [ClsInst] -> SDoc
forall a b. (a -> b) -> a -> b
$ NonEmpty ClsInst -> [ClsInst]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ClsInst
sorted))
    TcRnConflictingFamInstDecls NonEmpty FamInst
sortedNE
      -> let sorted :: [FamInst]
sorted = NonEmpty FamInst -> [FamInst]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty FamInst
sortedNE
         in SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
              SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Conflicting family instance declarations:")
                 Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ TyCon -> CoAxBranch -> SDoc
pprCoAxBranchUser (CoAxiom Unbranched -> TyCon
forall (br :: BranchFlag). CoAxiom br -> TyCon
coAxiomTyCon CoAxiom Unbranched
ax) (CoAxiom Unbranched -> CoAxBranch
coAxiomSingleBranch CoAxiom Unbranched
ax)
                         | FamInst
fi <- [FamInst]
sorted
                         , let ax :: CoAxiom Unbranched
ax = FamInst -> CoAxiom Unbranched
famInstAxiom FamInst
fi ])
    TcRnFamInstNotInjective InjectivityErrReason
rea TyCon
fam_tc (CoAxBranch
eqn1 NE.:| [CoAxBranch]
rest_eqns)
      -> let (SDoc
herald, Bool
show_kinds) = case InjectivityErrReason
rea of
               InjErrRhsBareTyVar [Type]
tys ->
                 (SDoc
injectivityErrorHerald SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
                  [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"RHS of injective type family equation is a bare" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
                  [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"type variable" SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
                  [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"but these LHS type and kind patterns are not bare" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
                  [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"variables:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Type] -> SDoc
forall a. Outputable a => [a] -> SDoc
pprQuotedList [Type]
tys, Bool
False)
               InjectivityErrReason
InjErrRhsCannotBeATypeFam ->
                 (SDoc
injectivityErrorHerald SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
                   [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"RHS of injective type family equation cannot" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
                   [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"be a type family:", Bool
False)
               InjectivityErrReason
InjErrRhsOverlap ->
                  ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Type family equation right-hand sides overlap; this violates" SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
                   [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"the family's injectivity annotation:", Bool
False)
               InjErrCannotInferFromRhs VarSet
tvs HasKinds
has_kinds SuggestUndecidableInstances
_ ->
                 let show_kinds :: Bool
show_kinds = HasKinds
has_kinds HasKinds -> HasKinds -> Bool
forall a. Eq a => a -> a -> Bool
== HasKinds
YesHasKinds
                     what :: SDoc
what = if Bool
show_kinds then [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Type/kind" else [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Type"
                     body :: SDoc
body = [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ SDoc
what SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"variable" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<>
                                  VarSet -> SDoc
pluralVarSet VarSet
tvs SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> VarSet -> ([TyVar] -> SDoc) -> SDoc
pprVarSet VarSet
tvs ([TyVar] -> SDoc
forall a. Outputable a => [a] -> SDoc
pprQuotedList ([TyVar] -> SDoc) -> ([TyVar] -> [TyVar]) -> [TyVar] -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [TyVar] -> [TyVar]
scopedSort)
                                , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"cannot be inferred from the right-hand side." ]
                     in (SDoc
injectivityErrorHerald SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ SDoc
body SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"In the type family equation:", Bool
show_kinds)

         in SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ Bool -> SDoc -> SDoc
pprWithInvisibleBitsWhen Bool
show_kinds (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$
              SDoc -> Arity -> SDoc -> SDoc
hang SDoc
herald
                Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((CoAxBranch -> SDoc) -> [CoAxBranch] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (TyCon -> CoAxBranch -> SDoc
pprCoAxBranchUser TyCon
fam_tc) (CoAxBranch
eqn1 CoAxBranch -> [CoAxBranch] -> [CoAxBranch]
forall a. a -> [a] -> [a]
: [CoAxBranch]
rest_eqns)))
    TcRnBangOnUnliftedType Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Strictness flag has no effect on unlifted type" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty)
    TcRnLazyBangOnUnliftedType Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Lazy flag has no effect on unlifted type" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty)
    TcRnMultipleDefaultDeclarations TyCon
cls [LDefaultDecl (GhcPass 'Renamed)]
dup_things
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Multiple default declarations for class" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (TyCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyCon
cls))
              Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((GenLocated SrcSpanAnnA (DefaultDecl (GhcPass 'Renamed)) -> SDoc)
-> [GenLocated SrcSpanAnnA (DefaultDecl (GhcPass 'Renamed))]
-> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map LDefaultDecl (GhcPass 'Renamed) -> SDoc
GenLocated SrcSpanAnnA (DefaultDecl (GhcPass 'Renamed)) -> SDoc
pp [LDefaultDecl (GhcPass 'Renamed)]
[GenLocated SrcSpanAnnA (DefaultDecl (GhcPass 'Renamed))]
dup_things))
         where
           pp :: LDefaultDecl GhcRn -> SDoc
           pp :: LDefaultDecl (GhcPass 'Renamed) -> SDoc
pp (L SrcSpanAnnA
locn DefaultDecl {})
             = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"here was another default declaration" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr (SrcSpanAnnA -> SrcSpan
forall a. HasLoc a => a -> SrcSpan
locA SrcSpanAnnA
locn)
    TcRnBadDefaultType Type
ty [TyCon]
deflt_clss
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The default type" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is not an instance of")
              Arity
2 ((SDoc -> SDoc -> SDoc) -> [SDoc] -> SDoc
forall a. (a -> a -> a) -> [a] -> a
forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a
foldr1 (\SDoc
a SDoc
b -> SDoc
a SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"or" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
b) ((TyCon -> SDoc) -> [TyCon] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (SDoc -> SDoc
quotes(SDoc -> SDoc) -> (TyCon -> SDoc) -> TyCon -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TyCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr) [TyCon]
deflt_clss))
    TcRnMessage
TcRnPatSynBundledWithNonDataCon
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Pattern synonyms can be bundled only with datatypes."
    TcRnPatSynBundledWithWrongType Type
expected_res_ty Type
res_ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Pattern synonyms can only be bundled with matching type constructors"
               SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Couldn't match expected type of"
               SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
expected_res_ty)
               SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"with actual type of"
               SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
res_ty)
    TcRnDupeModuleExport ModuleName
mod
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Duplicate"
                , SDoc -> SDoc
quotes ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Module" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModuleName
mod)
                , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in export list" ]
    TcRnExportedModNotImported ModuleName
mod
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated
       (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> [Char] -> SDoc
formatExportItemError
           ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"module" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModuleName
mod)
           [Char]
"is not imported"
    TcRnNullExportedModule ModuleName
mod
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated
       (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> [Char] -> SDoc
formatExportItemError
           ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"module" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModuleName
mod)
           [Char]
"exports nothing"
    TcRnMissingExportList ModuleName
mod
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated
       (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> [Char] -> SDoc
formatExportItemError
           ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"module" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModuleName
mod)
           [Char]
"is missing an export list"
    TcRnExportHiddenComponents IE GhcPs
export_item
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated
       (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> [Char] -> SDoc
formatExportItemError
           (IE GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
ppr IE GhcPs
export_item)
           [Char]
"attempts to export constructors or class methods that are not visible here"
    TcRnExportHiddenDefault IE GhcPs
export_item
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated
       (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> [Char] -> SDoc
formatExportItemError
           (IE GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
ppr IE GhcPs
export_item)
           [Char]
"attempts to export a default class declaration that is not visible here"
    TcRnDuplicateExport GlobalRdrElt
gre IE GhcPs
ie1 IE GhcPs
ie2
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [ SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Name -> SDoc) -> Name -> SDoc
forall a b. (a -> b) -> a -> b
$ GlobalRdrElt -> Name
forall info. GlobalRdrEltX info -> Name
greName GlobalRdrElt
gre)
                , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is exported by", SDoc -> SDoc
quotes (IE GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
ppr IE GhcPs
ie1)
                , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"and",            SDoc -> SDoc
quotes (IE GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
ppr IE GhcPs
ie2) ]
    TcRnExportedParentChildMismatch Name
parent_name TyThing
ty_thing Name
child [Name]
parent_names
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The type constructor" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
parent_name)
                 SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is not the parent of the" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
what_is
                 SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes SDoc
thing SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
'.'
                 SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text ([Char] -> [Char]
capitalise [Char]
what_is)
                    SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"s can only be exported with their parent type constructor."
                 SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ (case [SDoc]
parents of
                       [] -> SDoc
forall doc. IsOutput doc => doc
empty
                       [SDoc
_] -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Parent:"
                       [SDoc]
_  -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Parents:") SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
fsep (SDoc -> [SDoc] -> [SDoc]
forall doc. IsLine doc => doc -> [doc] -> [doc]
punctuate SDoc
forall doc. IsLine doc => doc
comma [SDoc]
parents)
      where
        pp_category :: TyThing -> String
        pp_category :: TyThing -> [Char]
pp_category (AnId TyVar
i)
          | TyVar -> Bool
isRecordSelector TyVar
i = [Char]
"record selector"
        pp_category TyThing
i = TyThing -> [Char]
tyThingCategory TyThing
i
        what_is :: [Char]
what_is = TyThing -> [Char]
pp_category TyThing
ty_thing
        thing :: SDoc
thing = OccName -> SDoc
forall a. Outputable a => a -> SDoc
ppr (OccName -> SDoc) -> OccName -> SDoc
forall a b. (a -> b) -> a -> b
$ Name -> OccName
nameOccName Name
child
        parents :: [SDoc]
parents = (Name -> SDoc) -> [Name] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr [Name]
parent_names
    TcRnConflictingExports OccName
occ GlobalRdrElt
child_gre1 IE GhcPs
ie1 GlobalRdrElt
child_gre2 IE GhcPs
ie2
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Conflicting exports for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (OccName -> SDoc
forall a. Outputable a => a -> SDoc
ppr OccName
occ) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
colon
                , GlobalRdrElt -> IE GhcPs -> SDoc
forall {a} {info}. Outputable a => GlobalRdrEltX info -> a -> SDoc
ppr_export GlobalRdrElt
child_gre1 IE GhcPs
ie1
                , GlobalRdrElt -> IE GhcPs -> SDoc
forall {a} {info}. Outputable a => GlobalRdrEltX info -> a -> SDoc
ppr_export GlobalRdrElt
child_gre2 IE GhcPs
ie2
                ]
      where
        ppr_export :: GlobalRdrEltX info -> a -> SDoc
ppr_export GlobalRdrEltX info
gre a
ie =
          Arity -> SDoc -> SDoc
nest Arity
3 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$
            SDoc -> Arity -> SDoc -> SDoc
hang (SDoc -> SDoc
quotes (a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
ie) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"exports" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Name -> SDoc) -> Name -> SDoc
forall a b. (a -> b) -> a -> b
$ GlobalRdrEltX info -> Name
forall info. GlobalRdrEltX info -> Name
greName GlobalRdrEltX info
gre))
               Arity
2 (GlobalRdrEltX info -> SDoc
forall info. GlobalRdrEltX info -> SDoc
pprNameProvenance GlobalRdrEltX info
gre)
    TcRnDuplicateFieldExport (GlobalRdrElt
gre, IE GhcPs
ie1) NonEmpty (GlobalRdrElt, IE GhcPs)
gres_ies ->
      SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ( [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Duplicate record field"
                       , SDoc -> SDoc
quotes (OccName -> SDoc
forall a. Outputable a => a -> SDoc
ppr (OccName -> SDoc) -> OccName -> SDoc
forall a b. (a -> b) -> a -> b
$ GlobalRdrElt -> OccName
forall info. GlobalRdrEltX info -> OccName
greOccName GlobalRdrElt
gre)
                       , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in export list" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
colon ]
                SDoc -> [SDoc] -> [SDoc]
forall a. a -> [a] -> [a]
: ((GlobalRdrElt, IE GhcPs) -> SDoc)
-> [(GlobalRdrElt, IE GhcPs)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (GlobalRdrElt, IE GhcPs) -> SDoc
forall {a}. Outputable a => (GlobalRdrElt, a) -> SDoc
ppr_export ((GlobalRdrElt
gre,IE GhcPs
ie1) (GlobalRdrElt, IE GhcPs)
-> [(GlobalRdrElt, IE GhcPs)] -> [(GlobalRdrElt, IE GhcPs)]
forall a. a -> [a] -> [a]
: NonEmpty (GlobalRdrElt, IE GhcPs) -> [(GlobalRdrElt, IE GhcPs)]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (GlobalRdrElt, IE GhcPs)
gres_ies)
                )
      where
        ppr_export :: (GlobalRdrElt, a) -> SDoc
ppr_export (GlobalRdrElt
gre,a
ie) =
          Arity -> SDoc -> SDoc
nest Arity
3 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$
            SDoc -> Arity -> SDoc -> SDoc
hang ([SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ SDoc -> SDoc
quotes (a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
ie) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"exports the field" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Name -> SDoc) -> Name -> SDoc
forall a b. (a -> b) -> a -> b
$ GlobalRdrElt -> Name
forall info. GlobalRdrEltX info -> Name
greName GlobalRdrElt
gre)
                       , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"belonging to the constructor" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [ConLikeName] -> SDoc
forall a. [a] -> SDoc
plural [ConLikeName]
fld_cons SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [ConLikeName] -> SDoc
forall a. Outputable a => [a] -> SDoc
pprQuotedList [ConLikeName]
fld_cons ])
               Arity
2 (GlobalRdrElt -> SDoc
forall info. GlobalRdrEltX info -> SDoc
pprNameProvenance GlobalRdrElt
gre)
          where
            fld_cons :: [ConLikeName]
            fld_cons :: [ConLikeName]
fld_cons = UniqSet ConLikeName -> [ConLikeName]
forall elt. UniqSet elt -> [elt]
nonDetEltsUniqSet (UniqSet ConLikeName -> [ConLikeName])
-> UniqSet ConLikeName -> [ConLikeName]
forall a b. (a -> b) -> a -> b
$ RecFieldInfo -> UniqSet ConLikeName
recFieldCons (RecFieldInfo -> UniqSet ConLikeName)
-> RecFieldInfo -> UniqSet ConLikeName
forall a b. (a -> b) -> a -> b
$ HasDebugCallStack => GlobalRdrElt -> RecFieldInfo
GlobalRdrElt -> RecFieldInfo
fieldGREInfo GlobalRdrElt
gre
    TcRnAmbiguousFieldInUpdate (GlobalRdrElt
gre1, GlobalRdrElt
gre2, [GlobalRdrElt]
gres)
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
          [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Ambiguous record field" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
fld SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
dot
               , SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"It could refer to any of the following:")
                  Arity
2 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((GlobalRdrElt -> SDoc) -> [GlobalRdrElt] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map GlobalRdrElt -> SDoc
pprSugg (GlobalRdrElt
gre1 GlobalRdrElt -> [GlobalRdrElt] -> [GlobalRdrElt]
forall a. a -> [a] -> [a]
: GlobalRdrElt
gre2 GlobalRdrElt -> [GlobalRdrElt] -> [GlobalRdrElt]
forall a. a -> [a] -> [a]
: [GlobalRdrElt]
gres))
               ]
        where
          fld :: SDoc
fld = SDoc -> SDoc
quotes (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ FastString -> SDoc
forall a. Outputable a => a -> SDoc
ppr (OccName -> FastString
occNameFS (OccName -> FastString) -> OccName -> FastString
forall a b. (a -> b) -> a -> b
$ GlobalRdrElt -> OccName
forall info. GlobalRdrEltX info -> OccName
greOccName GlobalRdrElt
gre1)
          pprSugg :: GlobalRdrElt -> SDoc
pprSugg GlobalRdrElt
gre = [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ SDoc
bullet SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> GlobalRdrElt -> SDoc
pprGRE GlobalRdrElt
gre SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
comma
                             , Arity -> SDoc -> SDoc
nest Arity
2 (GlobalRdrElt -> SDoc
forall info. GlobalRdrEltX info -> SDoc
pprNameProvenance GlobalRdrElt
gre) ]
          pprGRE :: GlobalRdrElt -> SDoc
pprGRE GlobalRdrElt
gre = case GlobalRdrElt -> GREInfo
greInfo GlobalRdrElt
gre of
            IAmRecField {}
              -> let parent :: Name
parent = Parent -> Name
par_is (Parent -> Name) -> Parent -> Name
forall a b. (a -> b) -> a -> b
$ GlobalRdrElt -> Parent
forall info. GlobalRdrEltX info -> Parent
greParent GlobalRdrElt
gre
                 in [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"record field" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
fld SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"of" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
parent)
            GREInfo
_ -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"variable" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
fld
    TcRnAmbiguousRecordUpdate HsExpr (GhcPass 'Renamed)
_rupd TyCon
tc
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
          [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Ambiguous record update with parent" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
what SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
dot
               , [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"This type-directed disambiguation mechanism"
                      , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"will not be supported by -XDuplicateRecordFields in future releases of GHC." ]
               , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Consider disambiguating using module qualification instead."
               ]
        where
          what :: SDoc
          what :: SDoc
what = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"type constructor" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (RecSelParent -> SDoc
forall a. Outputable a => a -> SDoc
ppr (RecSelParent -> SDoc) -> RecSelParent -> SDoc
forall a b. (a -> b) -> a -> b
$ TyCon -> RecSelParent
RecSelData TyCon
tc)
    TcRnMissingFields ConLike
con [(FieldLabelString, Type)]
fields
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [SDoc
header, Arity -> SDoc -> SDoc
nest Arity
2 SDoc
rest]
         where
           rest :: SDoc
rest | [(FieldLabelString, Type)] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(FieldLabelString, Type)]
fields = SDoc
forall doc. IsOutput doc => doc
empty
                | Bool
otherwise   = [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat (((FieldLabelString, Type) -> SDoc)
-> [(FieldLabelString, Type)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (FieldLabelString, Type) -> SDoc
pprField [(FieldLabelString, Type)]
fields)
           header :: SDoc
header = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Fields of" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (ConLike -> SDoc
forall a. Outputable a => a -> SDoc
ppr ConLike
con) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
                    [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"not initialised" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<>
                    if [(FieldLabelString, Type)] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(FieldLabelString, Type)]
fields then SDoc
forall doc. IsOutput doc => doc
empty else SDoc
forall doc. IsLine doc => doc
colon
    TcRnFieldUpdateInvalidType [(FieldLabelString, Type)]
prs
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Record update for insufficiently polymorphic field"
                   SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [(FieldLabelString, Type)] -> SDoc
forall a. [a] -> SDoc
plural [(FieldLabelString, Type)]
prs SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
colon)
              Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ FieldLabelString -> SDoc
forall a. Outputable a => a -> SDoc
ppr FieldLabelString
f SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty | (FieldLabelString
f,Type
ty) <- [(FieldLabelString, Type)]
prs ])
    TcRnMissingStrictFields ConLike
con [(FieldLabelString, Type)]
fields
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [SDoc
header, Arity -> SDoc -> SDoc
nest Arity
2 SDoc
rest]
         where
           rest :: SDoc
rest | [(FieldLabelString, Type)] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(FieldLabelString, Type)]
fields = SDoc
forall doc. IsOutput doc => doc
empty  -- Happens for non-record constructors
                                       -- with strict fields
                | Bool
otherwise   = [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat (((FieldLabelString, Type) -> SDoc)
-> [(FieldLabelString, Type)] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (FieldLabelString, Type) -> SDoc
pprField [(FieldLabelString, Type)]
fields)

           header :: SDoc
header = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Constructor" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (ConLike -> SDoc
forall a. Outputable a => a -> SDoc
ppr ConLike
con) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
                    [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"does not have the required strict field(s)" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<>
                    if [(FieldLabelString, Type)] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(FieldLabelString, Type)]
fields then SDoc
forall doc. IsOutput doc => doc
empty else SDoc
forall doc. IsLine doc => doc
colon
    TcRnBadRecordUpdate [RdrName]
upd_flds BadRecordUpdateReason
reason
      -> case BadRecordUpdateReason
reason of
          NoConstructorHasAllFields { conflictingFields :: BadRecordUpdateReason -> [FieldLabelString]
conflictingFields = [FieldLabelString]
conflicts }
            | [FieldLabelString
fld] <- [FieldLabelString]
conflicts
            -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
                [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ SDoc
header
                     , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"No constructor in scope has the field" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (FieldLabelString -> SDoc
forall a. Outputable a => a -> SDoc
ppr FieldLabelString
fld) ]
            | Bool
otherwise
            ->
              SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
                [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ SDoc
header
                     , SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"No constructor in scope has all of the following fields:")
                        Arity
2 ([FieldLabelString] -> SDoc
forall a. Outputable a => [a] -> SDoc
pprQuotedList [FieldLabelString]
conflicts) ]
            where
              header :: SDoc
              header :: SDoc
header = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Invalid record update."
          MultiplePossibleParents (RecSelParent
par1, RecSelParent
par2, [RecSelParent]
pars) ->
            SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
              [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Ambiguous record update with field" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [RdrName] -> SDoc
forall a. [a] -> SDoc
plural [RdrName]
upd_flds)
                       Arity
2 SDoc
ppr_flds
                   , SDoc -> Arity -> SDoc -> SDoc
hang ([RdrName] -> SDoc
forall a. [a] -> SDoc
thisOrThese [RdrName]
upd_flds SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"field" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [RdrName] -> SDoc
forall a. [a] -> SDoc
plural [RdrName]
upd_flds SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
what_parent)
                       Arity
2 ([SDoc] -> SDoc
quotedListWithAnd ((RecSelParent -> SDoc) -> [RecSelParent] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map RecSelParent -> SDoc
forall a. Outputable a => a -> SDoc
ppr (RecSelParent
par1RecSelParent -> [RecSelParent] -> [RecSelParent]
forall a. a -> [a] -> [a]
:RecSelParent
par2RecSelParent -> [RecSelParent] -> [RecSelParent]
forall a. a -> [a] -> [a]
:[RecSelParent]
pars))) ]
            where
              ppr_flds, what_parent, which :: SDoc
              ppr_flds :: SDoc
ppr_flds = [SDoc] -> SDoc
quotedListWithAnd ([SDoc] -> SDoc) -> [SDoc] -> SDoc
forall a b. (a -> b) -> a -> b
$ (RdrName -> SDoc) -> [RdrName] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr [RdrName]
upd_flds
              what_parent :: SDoc
what_parent = case RecSelParent
par1 of
                RecSelData   {} -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"appear" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [RdrName] -> SDoc
forall a. [a] -> SDoc
singular [RdrName]
upd_flds
                                SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
which SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"datatypes"
                RecSelPatSyn {} -> [RdrName] -> SDoc
forall a. [a] -> SDoc
isOrAre [RdrName]
upd_flds SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"associated with"
                                SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
which SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"pattern synonyms"
              which :: SDoc
which = case [RecSelParent]
pars of
                [] -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"both"
                [RecSelParent]
_  -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"all of the"
          InvalidTyConParent TyCon
tc NonEmpty RecSelParent
pars ->
            SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
              [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"No data constructor of" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
what SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"has all of the fields:")
                      Arity
2 ([RdrName] -> SDoc
forall a. Outputable a => [a] -> SDoc
pprQuotedList [RdrName]
upd_flds)
                   , SDoc
pat_syn_msg ]
            where
              what :: SDoc
what = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"type constructor" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (RecSelParent -> SDoc
forall a. Outputable a => a -> SDoc
ppr (TyCon -> RecSelParent
RecSelData TyCon
tc))
              pat_syn_msg :: SDoc
pat_syn_msg
                | (RecSelParent -> Bool) -> NonEmpty RecSelParent -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (\case { RecSelPatSyn {} -> Bool
True; RecSelParent
_ -> Bool
False}) NonEmpty RecSelParent
pars
                = SDoc -> SDoc
note SDoc
"Type-directed disambiguation is not supported for pattern synonym record fields"
                | Bool
otherwise
                = SDoc
forall doc. IsOutput doc => doc
empty
    TcRnStaticFormNotClosed Name
name NotClosedReason
reason
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name)
             SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is used in a static form but it is not closed"
             SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"because it"
             SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep (NotClosedReason -> [SDoc]
causes NotClosedReason
reason)
         where
          causes :: NotClosedReason -> [SDoc]
          causes :: NotClosedReason -> [SDoc]
causes NotClosedReason
NotLetBoundReason = [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is not let-bound."]
          causes (NotTypeClosed VarSet
vs) =
            [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"has a non-closed type because it contains the"
            , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"type variables:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
              VarSet -> ([TyVar] -> SDoc) -> SDoc
pprVarSet VarSet
vs ([SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep ([SDoc] -> SDoc) -> ([TyVar] -> [SDoc]) -> [TyVar] -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SDoc -> [SDoc] -> [SDoc]
forall doc. IsLine doc => doc -> [doc] -> [doc]
punctuate SDoc
forall doc. IsLine doc => doc
comma ([SDoc] -> [SDoc]) -> ([TyVar] -> [SDoc]) -> [TyVar] -> [SDoc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (TyVar -> SDoc) -> [TyVar] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (SDoc -> SDoc
quotes (SDoc -> SDoc) -> (TyVar -> SDoc) -> TyVar -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TyVar -> SDoc
forall a. Outputable a => a -> SDoc
ppr))
            ]
          causes (NotClosed Name
n NotClosedReason
reason) =
            let msg :: SDoc
msg = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"uses" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"which"
             in case NotClosedReason
reason of
                  NotClosed Name
_ NotClosedReason
_ -> SDoc
msg SDoc -> [SDoc] -> [SDoc]
forall a. a -> [a] -> [a]
: NotClosedReason -> [SDoc]
causes NotClosedReason
reason
                  NotClosedReason
_   -> let ([SDoc]
xs0, [SDoc]
xs1) = Arity -> [SDoc] -> ([SDoc], [SDoc])
forall a. Arity -> [a] -> ([a], [a])
splitAt Arity
1 ([SDoc] -> ([SDoc], [SDoc])) -> [SDoc] -> ([SDoc], [SDoc])
forall a b. (a -> b) -> a -> b
$ NotClosedReason -> [SDoc]
causes NotClosedReason
reason
                          in (SDoc -> SDoc) -> [SDoc] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (SDoc
msg SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>) [SDoc]
xs0 [SDoc] -> [SDoc] -> [SDoc]
forall a. [a] -> [a] -> [a]
++ [SDoc]
xs1
    TcRnMessage
TcRnUselessTypeable
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Deriving" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
typeableClassName) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"has no effect: all types now auto-derive Typeable"
    TcRnDerivingDefaults Class
cls
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep
                     [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Both DeriveAnyClass and"
                       SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"GeneralizedNewtypeDeriving are enabled"
                     , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Defaulting to the DeriveAnyClass strategy"
                       SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"for instantiating" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Class -> SDoc
forall a. Outputable a => a -> SDoc
ppr Class
cls
                     ]
    TcRnNonUnaryTypeclassConstraint UserTypeCtxt
ctxt LHsSigType (GhcPass 'Renamed)
ct
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> SDoc
quotes (GenLocated SrcSpanAnnA (HsSigType (GhcPass 'Renamed)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsSigType (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (HsSigType (GhcPass 'Renamed))
ct)
           SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is not a unary constraint, as expected by"
           SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> UserTypeCtxt -> SDoc
pprUserTypeCtxt UserTypeCtxt
ctxt
    TcRnPartialTypeSignatures SuggestPartialTypeSignatures
_ [Type]
theta
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Found type wildcard" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
'_')
                       SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"standing for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes ([Type] -> SDoc
pprTheta [Type]
theta)
    TcRnCannotDeriveInstance Class
cls [Type]
cls_tys Maybe (DerivStrategy GhcTc)
mb_strat UsingGeneralizedNewtypeDeriving
newtype_deriving DeriveInstanceErrReason
reason
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           Class
-> [Type]
-> Maybe (DerivStrategy GhcTc)
-> UsingGeneralizedNewtypeDeriving
-> Bool
-> DeriveInstanceErrReason
-> SDoc
derivErrDiagnosticMessage Class
cls [Type]
cls_tys Maybe (DerivStrategy GhcTc)
mb_strat UsingGeneralizedNewtypeDeriving
newtype_deriving Bool
True DeriveInstanceErrReason
reason
    TcRnLookupInstance Class
cls [Type]
tys LookupInstanceErrReason
reason
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Couldn't match instance:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
           Class -> [Type] -> LookupInstanceErrReason -> SDoc
lookupInstanceErrDiagnosticMessage Class
cls [Type]
tys LookupInstanceErrReason
reason
    TcRnMessage
TcRnLazyGADTPattern
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"An existential or GADT data constructor cannot be used")
              Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"inside a lazy (~) pattern")
    TcRnMessage
TcRnArrowProcGADTPattern
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Proc patterns cannot use existential or GADT data constructors"
    TcRnMessage
TcRnTypeEqualityOutOfScope
      -> [SDoc] -> DecoratedSDoc
mkDecorated
           [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"~") SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"operator is out of scope." SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
             [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Assuming it to stand for an equality constraint."
           , SDoc -> SDoc
note (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> SDoc
quotes SDoc
"~" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
"used to be built-in syntax but now is a regular type operator" SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
                      SDoc
"exported from Data.Type.Equality and Prelude." SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
                      SDoc
"If you are using a custom Prelude, consider re-exporting it"
           , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"This will become an error in a future GHC release." ]
    TcRnMessage
TcRnTypeEqualityRequiresOperators
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
            [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
fsep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The use of" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"~")
                                     SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"without TypeOperators",
                   [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"will become an error in a future GHC release." ]
    TcRnIllegalTypeOperator SDoc
overall_ty RdrName
op
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal operator" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr RdrName
op) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in type" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (SDoc -> SDoc
forall a. Outputable a => a -> SDoc
ppr SDoc
overall_ty)
    TcRnIllegalTypeOperatorDecl RdrName
name
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal declaration of a type or class operator" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr RdrName
name)
    TcRnMessage
TcRnGADTMonoLocalBinds
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
            [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
fsep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Pattern matching on GADTs without MonoLocalBinds"
                 , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is fragile." ]
    TcRnIncorrectNameSpace Name
name Bool
_
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
what SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"does not live in" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
other_ns
        where
          -- the other (opposite) namespace
          other_ns :: SDoc
other_ns | NameSpace -> Bool
isValNameSpace NameSpace
ns = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"the type-level namespace"
                   | Bool
otherwise         = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"the term-level namespace"
          ns :: NameSpace
ns = Name -> NameSpace
nameNameSpace Name
name
          what :: SDoc
what = NameSpace -> SDoc
pprNameSpace NameSpace
ns SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name)
    TcRnNotInScope NotInScopeError
err RdrName
name [ImportError]
imp_errs [GhcHint]
_
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           RdrName -> NotInScopeError -> SDoc
pprScopeError RdrName
name NotInScopeError
err SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((ImportError -> SDoc) -> [ImportError] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map ImportError -> SDoc
forall a. Outputable a => a -> SDoc
ppr [ImportError]
imp_errs)
    TcRnTermNameInType RdrName
name [GhcHint]
_
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> SDoc
quotes (RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr RdrName
name) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
             ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is a term-level binding") SDoc -> SDoc -> SDoc
$+$
             ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
" and can not be used at the type level.")
    TcRnUntickedPromotedThing UntickedPromotedThing
thing
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
         [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Unticked promoted" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
what
           where
             what :: SDoc
             what :: SDoc
what = case UntickedPromotedThing
thing of
               UntickedPromotedThing
UntickedExplicitList -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"list" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
dot
               UntickedConstructor LexicalFixity
fixity Name
nm ->
                 let con :: SDoc
con      = LexicalFixity -> Name -> SDoc
pprUntickedConstructor LexicalFixity
fixity Name
nm
                     bare_sym :: Bool
bare_sym = LexicalFixity -> Name -> Bool
isBareSymbol LexicalFixity
fixity Name
nm
                 in [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"constructor:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
con SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> if Bool
bare_sym then SDoc
forall doc. IsOutput doc => doc
empty else SDoc
forall doc. IsLine doc => doc
dot
    TcRnIllegalBuiltinSyntax SDoc
what RdrName
rdr_name
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal", SDoc
what, [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"of built-in syntax:", RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr RdrName
rdr_name]
    TcRnWarnDefaulting [Ct]
tidy_wanteds Maybe TyVar
tidy_tv Type
default_ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep ([SDoc] -> SDoc) -> [SDoc] -> SDoc
forall a b. (a -> b) -> a -> b
$ [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Defaulting" ]
                     [SDoc] -> [SDoc] -> [SDoc]
forall a. [a] -> [a] -> [a]
++
                     (case Maybe TyVar
tidy_tv of
                         Maybe TyVar
Nothing -> []
                         Just TyVar
tv -> [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"the type variable"
                                    , SDoc -> SDoc
quotes (TyVar -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyVar
tv)])
                     [SDoc] -> [SDoc] -> [SDoc]
forall a. [a] -> [a] -> [a]
++
                     [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"to type"
                     , SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
default_ty)
                     , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in the following constraint" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [Ct] -> SDoc
forall a. [a] -> SDoc
plural [Ct]
tidy_wanteds ])
             Arity
2
             ([Ct] -> SDoc
pprWithArising [Ct]
tidy_wanteds)
    TcRnWarnClashingDefaultImports TyCon
cls Maybe [Type]
Nothing NonEmpty ClassDefaults
imports
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Clashing imported defaults for class" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (TyCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyCon
cls) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
colon)
              Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ([SDoc] -> SDoc) -> [SDoc] -> SDoc
forall a b. (a -> b) -> a -> b
$ ClassDefaults -> SDoc
defaultTypesAndImport (ClassDefaults -> SDoc) -> [ClassDefaults] -> [SDoc]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty ClassDefaults -> [ClassDefaults]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ClassDefaults
imports)
    TcRnWarnClashingDefaultImports TyCon
cls (Just [Type]
local) NonEmpty ClassDefaults
imports
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Imported defaults for class" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (TyCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyCon
cls) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
colon)
                    Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ([SDoc] -> SDoc) -> [SDoc] -> SDoc
forall a b. (a -> b) -> a -> b
$ ClassDefaults -> SDoc
defaultTypesAndImport (ClassDefaults -> SDoc) -> [ClassDefaults] -> [SDoc]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty ClassDefaults -> [ClassDefaults]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ClassDefaults
imports)
               , SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"are not subsumed by the local `default` declaration")
                    Arity
2 (SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ (Type -> SDoc) -> [Type] -> SDoc
forall a. (a -> SDoc) -> [a] -> SDoc
pprWithCommas Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr [Type]
local)
               ]

    TcRnForeignImportPrimExtNotSet ForeignImport (GhcPass 'Renamed)
_decl
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"`foreign import prim' requires GHCForeignImportPrim."

    TcRnForeignImportPrimSafeAnn ForeignImport (GhcPass 'Renamed)
_decl
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The safe/unsafe annotation should not be used with `foreign import prim'."

    TcRnForeignFunctionImportAsValue ForeignImport (GhcPass 'Renamed)
_decl
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"`value' imports cannot have function types"

    TcRnFunPtrImportWithoutAmpersand ForeignImport (GhcPass 'Renamed)
_decl
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"possible missing & in foreign import of FunPtr"

    TcRnIllegalForeignDeclBackend Either
  (ForeignExport (GhcPass 'Renamed))
  (ForeignImport (GhcPass 'Renamed))
_decl Backend
_backend ExpectedBackends
expectedBknds
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
         [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
fsep ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal foreign declaration: requires one of these back ends:" SDoc -> [SDoc] -> [SDoc]
forall a. a -> [a] -> [a]
:
               SDoc -> [SDoc] -> [SDoc]
commafyWith ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"or") ((Backend -> SDoc) -> ExpectedBackends -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text ([Char] -> SDoc) -> (Backend -> [Char]) -> Backend -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Backend -> [Char]
backendDescription) ExpectedBackends
expectedBknds))

    TcRnUnsupportedCallConv Either
  (ForeignExport (GhcPass 'Renamed))
  (ForeignImport (GhcPass 'Renamed))
_decl UnsupportedCallConvention
unsupportedCC
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           case UnsupportedCallConvention
unsupportedCC of
             UnsupportedCallConvention
StdCallConvUnsupported ->
               [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"the 'stdcall' calling convention is unsupported on this platform,"
               SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"treating as ccall"
             UnsupportedCallConvention
PrimCallConvUnsupported ->
               [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The `prim' calling convention can only be used with `foreign import'"
             UnsupportedCallConvention
JavaScriptCallConvUnsupported ->
               [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The `javascript' calling convention is unsupported on this platform"

    TcRnIllegalForeignType Maybe ArgOrResult
mArgOrResult IllegalForeignTypeReason
reason
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> Arity -> SDoc -> SDoc
hang SDoc
msg Arity
2 SDoc
extra
      where
        arg_or_res :: SDoc
arg_or_res = case Maybe ArgOrResult
mArgOrResult of
          Maybe ArgOrResult
Nothing -> SDoc
forall doc. IsOutput doc => doc
empty
          Just ArgOrResult
Arg -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"argument"
          Just ArgOrResult
Result -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"result"
        msg :: SDoc
msg = [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Unacceptable", SDoc
arg_or_res
                   , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"type in foreign declaration:"]
        extra :: SDoc
extra =
          case IllegalForeignTypeReason
reason of
            TypeCannotBeMarshaled Type
ty TypeCannotBeMarshaledReason
why ->
              let innerMsg :: SDoc
innerMsg = SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"cannot be marshalled in a foreign call"
               in case TypeCannotBeMarshaledReason
why of
                TypeCannotBeMarshaledReason
NotADataType ->
                  SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is not a data type"
                NewtypeDataConNotInScope TyCon
_ [] ->
                  SDoc -> Arity -> SDoc -> SDoc
hang SDoc
innerMsg Arity
2 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"because its data constructor is not in scope"
                NewtypeDataConNotInScope TyCon
tc [Type]
_ ->
                  SDoc -> Arity -> SDoc -> SDoc
hang SDoc
innerMsg Arity
2 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$
                    [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"because the data constructor for"
                    SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (TyCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyCon
tc) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is not in scope"
                TypeCannotBeMarshaledReason
UnliftedFFITypesNeeded ->
                  SDoc
innerMsg SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"UnliftedFFITypes is required to marshal unlifted types"
                TypeCannotBeMarshaledReason
NotABoxedMarshalableTyCon -> SDoc
innerMsg
                TypeCannotBeMarshaledReason
ForeignLabelNotAPtr ->
                  SDoc
innerMsg SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"A foreign-imported address (via &foo) must have type (Ptr a) or (FunPtr a)"
                TypeCannotBeMarshaledReason
NotSimpleUnliftedType ->
                  SDoc
innerMsg SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"foreign import prim only accepts simple unlifted types"
                TypeCannotBeMarshaledReason
NotBoxedKindAny ->
                  [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Expected kind" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Type") SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"or" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"UnliftedType") SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
comma SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
                  [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"but" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"has kind" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr (HasDebugCallStack => Type -> Type
Type -> Type
typeKind Type
ty))
            ForeignDynNotPtr Type
expected Type
ty ->
              [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Expected: Ptr/FunPtr" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
pprParendType Type
expected SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
comma, [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"  Actual:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty ]
            IllegalForeignTypeReason
SafeHaskellMustBeInIO ->
              [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Safe Haskell is on, all FFI imports must be in the IO monad"
            IllegalForeignTypeReason
IOResultExpected ->
              [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"IO result type expected"
            IllegalForeignTypeReason
UnexpectedNestedForall ->
              [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Unexpected nested forall"
            IllegalForeignTypeReason
LinearTypesNotAllowed ->
              [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Linear types are not supported in FFI declarations, see #18472"
            IllegalForeignTypeReason
OneArgExpected ->
              [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"One argument expected"
            IllegalForeignTypeReason
AtLeastOneArgExpected ->
              [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"At least one argument expected"
    TcRnInvalidCIdentifier FastString
target
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [SDoc -> SDoc
quotes (FastString -> SDoc
forall a. Outputable a => a -> SDoc
ppr FastString
target) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is not a valid C identifier"]
    TcRnExpectedValueId TcTyThing
thing
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           TcTyThing -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcTyThing
thing SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"used where a value identifier was expected"
    TcRnRecSelectorEscapedTyVar OccName
lbl
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Cannot use record selector" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (OccName -> SDoc
forall a. Outputable a => a -> SDoc
ppr OccName
lbl) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"as a function due to escaped type variables"
    TcRnPatSynNotBidirectional Name
name
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"non-bidirectional pattern synonym"
           SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"used in an expression"
    TcRnIllegalDerivingItem LHsSigType (GhcPass 'Renamed)
hs_ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal deriving item" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (GenLocated SrcSpanAnnA (HsSigType (GhcPass 'Renamed)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsSigType (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (HsSigType (GhcPass 'Renamed))
hs_ty)
    TcRnIllegalDefaultClass LHsSigType (GhcPass 'Renamed)
hs_ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> SDoc
quotes (GenLocated SrcSpanAnnA (HsSigType (GhcPass 'Renamed)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsSigType (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (HsSigType (GhcPass 'Renamed))
hs_ty) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is not a class"
    TcRnIllegalNamedDefault LDefaultDecl (GhcPass 'Renamed)
hs_decl
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal use of default class name:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (GenLocated SrcSpanAnnA (DefaultDecl (GhcPass 'Renamed)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LDefaultDecl (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (DefaultDecl (GhcPass 'Renamed))
hs_decl)
    TcRnUnexpectedAnnotation HsType (GhcPass 'Renamed)
ty HsBang
bang
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           let err :: [Char]
err = case HsBang
bang of
                 HsBang SrcUnpackedness
SrcUnpack   SrcStrictness
_       -> [Char]
"UNPACK"
                 HsBang SrcUnpackedness
SrcNoUnpack SrcStrictness
_       -> [Char]
"NOUNPACK"
                 HsBang SrcUnpackedness
NoSrcUnpack SrcStrictness
SrcLazy -> [Char]
"laziness"
                 HsBang SrcUnpackedness
_           SrcStrictness
_       -> [Char]
"strictness"
            in [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Unexpected" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
err SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"annotation:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> HsType (GhcPass 'Renamed) -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsType (GhcPass 'Renamed)
ty SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
               [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
err SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"annotation cannot appear nested inside a type"
    TcRnIllegalRecordSyntax Either (HsType GhcPs) (HsType (GhcPass 'Renamed))
either_ty_ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Record syntax is illegal here:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> (HsType GhcPs -> SDoc)
-> (HsType (GhcPass 'Renamed) -> SDoc)
-> Either (HsType GhcPs) (HsType (GhcPass 'Renamed))
-> SDoc
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either HsType GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsType (GhcPass 'Renamed) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Either (HsType GhcPs) (HsType (GhcPass 'Renamed))
either_ty_ty

    TcRnInvalidVisibleKindArgument LHsType (GhcPass 'Renamed)
arg Type
ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Cannot apply function of kind" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ty)
             SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"to visible kind argument" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsType (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (HsType (GhcPass 'Renamed))
arg)
    TcRnTooManyBinders Type
ki [LHsTyVarBndr (HsBndrVis (GhcPass 'Renamed)) (GhcPass 'Renamed)]
bndrs
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Not a function kind:")
              Arity
4 (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
ki) SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"but extra binders found:")
              Arity
4 ([SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
fsep ((GenLocated
   SrcSpanAnnA
   (HsTyVarBndr (HsBndrVis (GhcPass 'Renamed)) (GhcPass 'Renamed))
 -> SDoc)
-> [GenLocated
      SrcSpanAnnA
      (HsTyVarBndr (HsBndrVis (GhcPass 'Renamed)) (GhcPass 'Renamed))]
-> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated
  SrcSpanAnnA
  (HsTyVarBndr (HsBndrVis (GhcPass 'Renamed)) (GhcPass 'Renamed))
-> SDoc
forall a. Outputable a => a -> SDoc
ppr [LHsTyVarBndr (HsBndrVis (GhcPass 'Renamed)) (GhcPass 'Renamed)]
[GenLocated
   SrcSpanAnnA
   (HsTyVarBndr (HsBndrVis (GhcPass 'Renamed)) (GhcPass 'Renamed))]
bndrs))
    TcRnDifferentNamesForTyVar Name
n1 Name
n2
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Different names for the same type variable:") Arity
2 SDoc
info
         where
           info :: SDoc
info | Name -> OccName
nameOccName Name
n1 OccName -> OccName -> Bool
forall a. Eq a => a -> a -> Bool
/= Name -> OccName
nameOccName Name
n2
                = SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n1) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"and" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n2)
                | Bool
otherwise -- Same OccNames! See C2 in
                            -- Note [Swizzling the tyvars before generaliseTcTyCon]
                = [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n1) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"bound at" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SrcLoc -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Name -> SrcLoc
forall a. NamedThing a => a -> SrcLoc
getSrcLoc Name
n1)
                       , SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n2) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"bound at" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SrcLoc -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Name -> SrcLoc
forall a. NamedThing a => a -> SrcLoc
getSrcLoc Name
n2) ]

    TcRnDisconnectedTyVar Name
n
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Scoped type variable only appears non-injectively in declaration header:")
              Arity
2 (SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"bound at" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SrcLoc -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Name -> SrcLoc
forall a. NamedThing a => a -> SrcLoc
getSrcLoc Name
n))

    TcRnInvalidReturnKind DataSort
data_sort AllowedDataResKind
allowed_kind Type
kind Maybe SuggestUnliftedTypes
_suggested_ext
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ DataSort -> SDoc
ppDataSort DataSort
data_sort SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
                 [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"has non-" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<>
                 SDoc
allowed_kind_tycon
               , (if Bool
is_data_family then [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"and non-variable" else SDoc
forall doc. IsOutput doc => doc
empty) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
                 [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"return kind" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
kind)
               ]
         where
          is_data_family :: Bool
is_data_family =
            case DataSort
data_sort of
              DataDeclSort{}     -> Bool
False
              DataInstanceSort{} -> Bool
False
              DataSort
DataFamilySort     -> Bool
True
          allowed_kind_tycon :: SDoc
allowed_kind_tycon =
            case AllowedDataResKind
allowed_kind of
              AllowedDataResKind
AnyTYPEKind  -> TyCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyCon
tYPETyCon
              AllowedDataResKind
AnyBoxedKind -> TyCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyCon
boxedRepDataConTyCon
              AllowedDataResKind
LiftedKind   -> Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
liftedTypeKind
    TcRnClassKindNotConstraint Type
_kind
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Kind signature on a class must end with" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr Type
constraintKind SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"unobscured by type families"
    TcRnUnpromotableThing Name
name PromotionErr
err
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           (SDoc -> Arity -> SDoc -> SDoc
hang (PromotionErr -> SDoc
pprPECategory PromotionErr
err SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"cannot be used here")
                        Arity
2 (SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens SDoc
reason))
        where
          reason :: SDoc
reason = case PromotionErr
err of
                     ConstrainedDataConPE [Type]
theta
                                    -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"it has an unpromotable context"
                                       SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes ([Type] -> SDoc
pprTheta [Type]
theta)

                     PromotionErr
FamDataConPE   -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"it comes from a data family instance"
                     PromotionErr
PatSynPE       -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"pattern synonyms cannot be promoted"
                     PromotionErr
RecDataConPE   -> SDoc
same_rec_group_msg
                     PromotionErr
ClassPE        -> SDoc
same_rec_group_msg
                     PromotionErr
TyConPE        -> SDoc
same_rec_group_msg
                     PromotionErr
TermVariablePE -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"term variables cannot be promoted"
                     PromotionErr
TypeVariablePE -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"type variables bound in a kind signature cannot be used in the type"
          same_rec_group_msg :: SDoc
same_rec_group_msg = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"it is defined and used in the same recursive group"
    TcRnIllegalTermLevelUse Name
name TermLevelUseErr
err
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal term-level use of the" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
             [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text (TermLevelUseErr -> [Char]
teCategory TermLevelUseErr
err) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name)
    TcRnMatchesHaveDiffNumArgs HsMatchContextRn
argsContext (MatchArgMatches LocatedA (Match (GhcPass 'Renamed) body)
match1 NonEmpty (LocatedA (Match (GhcPass 'Renamed) body))
bad_matches)
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ HsMatchContext (LocatedN Name) -> SDoc
forall fn. Outputable fn => HsMatchContext fn -> SDoc
pprMatchContextNouns HsMatchContextRn
HsMatchContext (LocatedN Name)
argsContext SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
                   [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"have different numbers of arguments"
                 , Arity -> SDoc -> SDoc
nest Arity
2 (SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr (LocatedA (Match (GhcPass 'Renamed) body) -> SrcSpan
forall a e. HasLoc a => GenLocated a e -> SrcSpan
getLocA LocatedA (Match (GhcPass 'Renamed) body)
match1))
                 , Arity -> SDoc -> SDoc
nest Arity
2 (SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr (LocatedA (Match (GhcPass 'Renamed) body) -> SrcSpan
forall a e. HasLoc a => GenLocated a e -> SrcSpan
getLocA (NonEmpty (LocatedA (Match (GhcPass 'Renamed) body))
-> LocatedA (Match (GhcPass 'Renamed) body)
forall a. NonEmpty a -> a
NE.head NonEmpty (LocatedA (Match (GhcPass 'Renamed) body))
bad_matches)))])
    TcRnCannotBindScopedTyVarInPatSig NonEmpty (Name, TyVar)
sig_tvs
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"You cannot bind scoped type variable"
                  SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [(Name, TyVar)] -> SDoc
forall a. [a] -> SDoc
plural (NonEmpty (Name, TyVar) -> [(Name, TyVar)]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (Name, TyVar)
sig_tvs)
                 SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Name] -> SDoc
forall a. Outputable a => [a] -> SDoc
pprQuotedList (((Name, TyVar) -> Name) -> [(Name, TyVar)] -> [Name]
forall a b. (a -> b) -> [a] -> [b]
map (Name, TyVar) -> Name
forall a b. (a, b) -> a
fst ([(Name, TyVar)] -> [Name]) -> [(Name, TyVar)] -> [Name]
forall a b. (a -> b) -> a -> b
$ NonEmpty (Name, TyVar) -> [(Name, TyVar)]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (Name, TyVar)
sig_tvs))
              Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in a pattern binding signature")
    TcRnCannotBindTyVarsInPatBind NonEmpty (Name, TyVar)
_offenders
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Binding type variables is not allowed in pattern bindings"
    TcRnTooManyTyArgsInConPattern ConLike
con_like Arity
expected_number Arity
actual_number
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Too many type arguments in constructor pattern for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (ConLike -> SDoc
forall a. Outputable a => a -> SDoc
ppr ConLike
con_like) SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
           [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Expected no more than" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Arity -> SDoc
forall a. Outputable a => a -> SDoc
ppr Arity
expected_number SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
semi SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"got" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Arity -> SDoc
forall a. Outputable a => a -> SDoc
ppr Arity
actual_number
    TcRnMultipleInlinePragmas TyVar
poly_id LocatedA InlinePragma
fst_inl_prag NonEmpty (LocatedA InlinePragma)
inl_prags
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Multiple INLINE pragmas for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> TyVar -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyVar
poly_id)
             Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Ignoring all but the first"
                      SDoc -> [SDoc] -> [SDoc]
forall a. a -> [a] -> [a]
: (LocatedA InlinePragma -> SDoc)
-> [LocatedA InlinePragma] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map LocatedA InlinePragma -> SDoc
forall {a} {a}.
(Outputable a, Outputable a) =>
GenLocated a a -> SDoc
pp_inl (LocatedA InlinePragma
fst_inl_prag LocatedA InlinePragma
-> [LocatedA InlinePragma] -> [LocatedA InlinePragma]
forall a. a -> [a] -> [a]
: NonEmpty (LocatedA InlinePragma) -> [LocatedA InlinePragma]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (LocatedA InlinePragma)
inl_prags)))
         where
           pp_inl :: GenLocated a a -> SDoc
pp_inl (L a
loc a
prag) = a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
prag SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
loc)
    TcRnUnexpectedPragmas TyVar
poly_id NonEmpty (LSig (GhcPass 'Renamed))
bad_sigs
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
           SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Discarding unexpected pragmas for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> TyVar -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyVar
poly_id)
              Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed)) -> SDoc)
-> [GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (SrcSpanAnnA -> SDoc
forall a. Outputable a => a -> SDoc
ppr (SrcSpanAnnA -> SDoc)
-> (GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed)) -> SrcSpanAnnA)
-> GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))
-> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed)) -> SrcSpanAnnA
forall l e. GenLocated l e -> l
getLoc) ([GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))] -> [SDoc])
-> [GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))] -> [SDoc]
forall a b. (a -> b) -> a -> b
$ NonEmpty (GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed)))
-> [GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed))]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (LSig (GhcPass 'Renamed))
NonEmpty (GenLocated SrcSpanAnnA (Sig (GhcPass 'Renamed)))
bad_sigs))
    TcRnNonOverloadedSpecialisePragma LIdP (GhcPass 'Renamed)
fun_name
       -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
            [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"SPECIALISE pragma for non-overloaded function"
              SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (LocatedN Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr LIdP (GhcPass 'Renamed)
LocatedN Name
fun_name)
    TcRnSpecialiseNotVisible Name
name
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
         [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"You cannot SPECIALISE" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name)
           SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"because its definition is not visible in this module"
    TcRnPragmaWarning
      { pragma_warning_info :: TcRnMessage -> PragmaWarningInfo
pragma_warning_info = PragmaWarningInstance{TyVar
pwarn_dfunid :: TyVar
pwarn_dfunid :: PragmaWarningInfo -> TyVar
pwarn_dfunid, CtOrigin
pwarn_ctorig :: CtOrigin
pwarn_ctorig :: PragmaWarningInfo -> CtOrigin
pwarn_ctorig}
      , WarningTxt (GhcPass 'Renamed)
pragma_warning_msg :: WarningTxt (GhcPass 'Renamed)
pragma_warning_msg :: TcRnMessage -> WarningTxt (GhcPass 'Renamed)
pragma_warning_msg }
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"In the use of")
                 Arity
2 (TyVar -> SDoc
pprDFunId TyVar
pwarn_dfunid)
            , CtOrigin -> SDoc
forall a. Outputable a => a -> SDoc
ppr CtOrigin
pwarn_ctorig
            , WarningTxt (GhcPass 'Renamed) -> SDoc
forall p. WarningTxt p -> SDoc
pprWarningTxtForMsg WarningTxt (GhcPass 'Renamed)
pragma_warning_msg
         ]
    TcRnPragmaWarning
      { pragma_warning_info :: TcRnMessage -> PragmaWarningInfo
pragma_warning_info = PragmaWarningDefault{TyCon
pwarn_class :: TyCon
pwarn_class :: PragmaWarningInfo -> TyCon
pwarn_class, ModuleName
pwarn_impmod :: ModuleName
pwarn_impmod :: PragmaWarningInfo -> ModuleName
pwarn_impmod}
      , WarningTxt (GhcPass 'Renamed)
pragma_warning_msg :: TcRnMessage -> WarningTxt (GhcPass 'Renamed)
pragma_warning_msg :: WarningTxt (GhcPass 'Renamed)
pragma_warning_msg }
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"In the use of class"
                    SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> TyCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyCon
pwarn_class
                    SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"defaults imported from"
                    SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModuleName
pwarn_impmod SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
colon ]
            , WarningTxt (GhcPass 'Renamed) -> SDoc
forall p. WarningTxt p -> SDoc
pprWarningTxtForMsg WarningTxt (GhcPass 'Renamed)
pragma_warning_msg
         ]
    TcRnPragmaWarning {PragmaWarningInfo
pragma_warning_info :: TcRnMessage -> PragmaWarningInfo
pragma_warning_info :: PragmaWarningInfo
pragma_warning_info, WarningTxt (GhcPass 'Renamed)
pragma_warning_msg :: TcRnMessage -> WarningTxt (GhcPass 'Renamed)
pragma_warning_msg :: WarningTxt (GhcPass 'Renamed)
pragma_warning_msg}
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"In the use of"
                SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> NameSpace -> SDoc
pprNonVarNameSpace (OccName -> NameSpace
occNameSpace OccName
occ_name)
                SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (OccName -> SDoc
forall a. Outputable a => a -> SDoc
ppr OccName
occ_name)
                , SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens SDoc
imp_msg SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
colon ]
          , WarningTxt (GhcPass 'Renamed) -> SDoc
forall p. WarningTxt p -> SDoc
pprWarningTxtForMsg WarningTxt (GhcPass 'Renamed)
pragma_warning_msg ]
          where
            occ_name :: OccName
occ_name = PragmaWarningInfo -> OccName
pwarn_occname PragmaWarningInfo
pragma_warning_info
            imp_mod :: ModuleName
imp_mod = PragmaWarningInfo -> ModuleName
pwarn_impmod PragmaWarningInfo
pragma_warning_info
            imp_msg :: SDoc
imp_msg  = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"imported from" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModuleName
imp_mod SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
extra
            extra :: SDoc
extra | PragmaWarningName {pwarn_declmod :: PragmaWarningInfo -> ModuleName
pwarn_declmod = ModuleName
decl_mod} <- PragmaWarningInfo
pragma_warning_info
                  , ModuleName
imp_mod ModuleName -> ModuleName -> Bool
forall a. Eq a => a -> a -> Bool
/= ModuleName
decl_mod = [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
", but defined in" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModuleName
decl_mod
                  | Bool
otherwise = SDoc
forall doc. IsOutput doc => doc
empty
    TcRnDifferentExportWarnings Name
name NonEmpty SrcSpan
locs
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"exported with different error messages",
                                   [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"at" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((SrcSpan -> SDoc) -> [SrcSpan] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr ([SrcSpan] -> [SDoc]) -> [SrcSpan] -> [SDoc]
forall a b. (a -> b) -> a -> b
$ (SrcSpan -> SrcSpan -> Ordering) -> [SrcSpan] -> [SrcSpan]
forall a. (a -> a -> Ordering) -> [a] -> [a]
sortBy SrcSpan -> SrcSpan -> Ordering
leftmost_smallest ([SrcSpan] -> [SrcSpan]) -> [SrcSpan] -> [SrcSpan]
forall a b. (a -> b) -> a -> b
$ NonEmpty SrcSpan -> [SrcSpan]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty SrcSpan
locs)]
    TcRnIncompleteExportWarnings Name
name NonEmpty SrcSpan
locs
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"will not have its export warned about",
                                   [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"missing export warning at" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((SrcSpan -> SDoc) -> [SrcSpan] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr ([SrcSpan] -> [SDoc]) -> [SrcSpan] -> [SDoc]
forall a b. (a -> b) -> a -> b
$ (SrcSpan -> SrcSpan -> Ordering) -> [SrcSpan] -> [SrcSpan]
forall a. (a -> a -> Ordering) -> [a] -> [a]
sortBy SrcSpan -> SrcSpan -> Ordering
leftmost_smallest ([SrcSpan] -> [SrcSpan]) -> [SrcSpan] -> [SrcSpan]
forall a b. (a -> b) -> a -> b
$ NonEmpty SrcSpan -> [SrcSpan]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty SrcSpan
locs)]
    TcRnIllegalHsigDefaultMethods Name
name NonEmpty (LHsBind (GhcPass 'Renamed))
meths
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal default method" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [GenLocated SrcSpanAnnA (HsBind (GhcPass 'Renamed))] -> SDoc
forall a. [a] -> SDoc
plural (NonEmpty (GenLocated SrcSpanAnnA (HsBind (GhcPass 'Renamed)))
-> [GenLocated SrcSpanAnnA (HsBind (GhcPass 'Renamed))]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (LHsBind (GhcPass 'Renamed))
NonEmpty (GenLocated SrcSpanAnnA (HsBind (GhcPass 'Renamed)))
meths) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in class definition of" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in hsig file"
    TcRnHsigFixityMismatch TyThing
real_thing Fixity
real_fixity Fixity
sig_fixity
      ->
      let ppr_fix :: Fixity -> SDoc
ppr_fix Fixity
f = Fixity -> SDoc
forall a. Outputable a => a -> SDoc
ppr Fixity
f SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> if Fixity
f Fixity -> Fixity -> Bool
forall a. Eq a => a -> a -> Bool
== Fixity
defaultFixity then SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"default") else SDoc
forall doc. IsOutput doc => doc
empty
      in SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [TyThing -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyThing
real_thing SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"has conflicting fixities in the module",
              [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"and its hsig file",
              [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Main module:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Fixity -> SDoc
ppr_fix Fixity
real_fixity,
              [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Hsig file:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Fixity -> SDoc
ppr_fix Fixity
sig_fixity]
    TcRnHsigShapeMismatch (HsigShapeSortMismatch AvailInfo
info1 AvailInfo
info2)
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
            [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"While merging export lists, could not combine"
            SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> AvailInfo -> SDoc
forall a. Outputable a => a -> SDoc
ppr AvailInfo
info1 SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"with" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> AvailInfo -> SDoc
forall a. Outputable a => a -> SDoc
ppr AvailInfo
info2
            SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"one is a type, the other is a plain identifier")
    TcRnHsigShapeMismatch (HsigShapeNotUnifiable Name
name1 Name
name2 Bool
notHere)
      ->
      let extra :: SDoc
extra = if Bool
notHere
                  then [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Neither name variable originates from the current signature."
                  else SDoc
forall doc. IsOutput doc => doc
empty
      in SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"While merging export lists, could not unify"
        SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name1 SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"with" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name2 SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ SDoc
extra
    TcRnHsigMissingModuleExport OccName
occ UnitState
unit_state Module
impl_mod
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
            SDoc -> SDoc
quotes (OccName -> SDoc
forall a. Outputable a => a -> SDoc
ppr OccName
occ)
        SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is exported by the hsig file, but not exported by the implementing module"
        SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (UnitState -> SDoc -> SDoc
pprWithUnitState UnitState
unit_state (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ Module -> SDoc
forall a. Outputable a => a -> SDoc
ppr Module
impl_mod)
    TcRnBadGenericMethod Name
clas Name
op
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Class", SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
clas),
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"has a generic-default signature without a binding", SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
op)]
    TcRnWarningMinimalDefIncomplete ClassMinimalDef
mindef
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The MINIMAL pragma does not require:"
          , Arity -> SDoc -> SDoc
nest Arity
2 (ClassMinimalDef -> SDoc
forall a. Outputable a => BooleanFormula a -> SDoc
pprBooleanFormulaNice ClassMinimalDef
mindef)
          , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"but there is no default implementation." ]
    TcRnDefaultMethodForPragmaLacksBinding TyVar
sel_id Sig (GhcPass 'Renamed)
prag
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Sig (GhcPass 'Renamed) -> SDoc
forall (p :: Pass). IsPass p => Sig (GhcPass p) -> SDoc
hsSigDoc Sig (GhcPass 'Renamed)
prag SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"for default method"
          SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (TyVar -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyVar
sel_id)
          SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"lacks an accompanying binding"
    TcRnIgnoreSpecialisePragmaOnDefMethod Name
sel_name
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Ignoring SPECIALISE pragmas on default method"
          SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
sel_name)
    TcRnBadMethodErr{Name
badMethodErrClassName :: Name
badMethodErrClassName :: TcRnMessage -> Name
badMethodErrClassName, Name
badMethodErrMethodName :: Name
badMethodErrMethodName :: TcRnMessage -> Name
badMethodErrMethodName}
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Class", SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
badMethodErrClassName),
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"does not have a method", SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
badMethodErrMethodName)]
    TcRnMessage
TcRnIllegalTypeData
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal type-level data declaration"
    TcRnTypeDataForbids TypeDataForbids
feature
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        TypeDataForbids -> SDoc
forall a. Outputable a => a -> SDoc
ppr TypeDataForbids
feature SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"are not allowed in type data declarations."

    TcRnIllegalNewtype DataCon
con Bool
show_linear_types IllegalNewtypeReason
reason
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [SDoc
msg, SDoc
additional]
        where
          (SDoc
msg,SDoc
additional) =
            case IllegalNewtypeReason
reason of
              DoesNotHaveSingleField Arity
n_flds ->
                ([SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [
                  [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"A newtype constructor must have exactly one field",
                  Arity -> SDoc -> SDoc
nest Arity
2 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$
                    [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"but" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (DataCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr DataCon
con) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"has" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Arity -> SDoc
speakN Arity
n_flds
                ],
                DataCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr DataCon
con SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Bool -> DataCon -> Type
dataConDisplayType Bool
show_linear_types DataCon
con))
              IllegalNewtypeReason
IsNonLinear ->
                ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"A newtype constructor must be linear",
                DataCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr DataCon
con SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Bool -> DataCon -> Type
dataConDisplayType Bool
True DataCon
con))
              IllegalNewtypeReason
IsGADT ->
                ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"A newtype must not be a GADT",
                DataCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr DataCon
con SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Bool -> SDoc -> SDoc
pprWithInvisibleBitsWhen Bool
sneaky_eq_spec
                                       (Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Type -> SDoc) -> Type -> SDoc
forall a b. (a -> b) -> a -> b
$ Bool -> DataCon -> Type
dataConDisplayType Bool
show_linear_types DataCon
con))
              IllegalNewtypeReason
HasConstructorContext ->
                ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"A newtype constructor must not have a context in its type",
                DataCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr DataCon
con SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Bool -> DataCon -> Type
dataConDisplayType Bool
show_linear_types DataCon
con))
              IllegalNewtypeReason
HasExistentialTyVar ->
                ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"A newtype constructor must not have existential type variables",
                DataCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr DataCon
con SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Type -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Bool -> DataCon -> Type
dataConDisplayType Bool
show_linear_types DataCon
con))
              IllegalNewtypeReason
HasStrictnessAnnotation ->
                ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"A newtype constructor must not have a strictness annotation", SDoc
forall doc. IsOutput doc => doc
empty)

          -- Is the data con a "covert" GADT?  See Note [isCovertGadtDataCon]
          -- in GHC.Core.DataCon
          sneaky_eq_spec :: Bool
sneaky_eq_spec = DataCon -> Bool
isCovertGadtDataCon DataCon
con
    TcRnOrPatBindsVariables NonEmpty (IdP (GhcPass 'Renamed))
bndrs -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"An or-pattern may not bind term or type variables such as"
        SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [SDoc] -> SDoc
quotedListWithOr ((Name -> SDoc) -> [Name] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr (NonEmpty Name -> [Name]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (IdP (GhcPass 'Renamed))
NonEmpty Name
bndrs))
    TcRnUnsatisfiedMinimalDef ClassMinimalDef
mindef
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"No explicit implementation for"
              ,Arity -> SDoc -> SDoc
nest Arity
2 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ ClassMinimalDef -> SDoc
forall a. Outputable a => BooleanFormula a -> SDoc
pprBooleanFormulaNice ClassMinimalDef
mindef
             ]
    TcRnMisplacedInstSig Name
name LHsSigType (GhcPass 'Renamed)
hs_ty
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal type signature in instance declaration:")
                  Arity
2 (SDoc -> Arity -> SDoc -> SDoc
hang (Name -> SDoc
forall a. NamedThing a => a -> SDoc
pprPrefixName Name
name)
                        Arity
2 (SDoc
dcolon SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> GenLocated SrcSpanAnnA (HsSigType (GhcPass 'Renamed)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsSigType (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (HsSigType (GhcPass 'Renamed))
hs_ty))
             ]
    TcRnMessage
TcRnNoRebindableSyntaxRecordDot -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"RebindableSyntax is required if OverloadedRecordUpdate is enabled."
    TcRnMessage
TcRnNoFieldPunsRecordDot -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"For this to work enable NamedFieldPuns"
    TcRnIllegalStaticExpression HsExpr GhcPs
e -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal static expression:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> HsExpr GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsExpr GhcPs
e
    TcRnListComprehensionDuplicateBinding Name
n -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Duplicate binding in parallel list comprehension for:"
          SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n))
    TcRnEmptyStmtsGroup EmptyStatementGroupErrReason
cause -> SDoc -> DecoratedSDoc
mkSimpleDecorated  (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ case EmptyStatementGroupErrReason
cause of
      EmptyStatementGroupErrReason
EmptyStmtsGroupInParallelComp ->
        [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Empty statement group in parallel comprehension"
      EmptyStatementGroupErrReason
EmptyStmtsGroupInTransformListComp ->
        [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Empty statement group preceding 'group' or 'then'"
      EmptyStmtsGroupInDoNotation HsDoFlavour
ctxt ->
        [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Empty" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> HsDoFlavour -> SDoc
pprHsDoFlavour HsDoFlavour
ctxt
      EmptyStatementGroupErrReason
EmptyStmtsGroupInArrowNotation ->
        [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Empty 'do' block in an arrow command"
    TcRnLastStmtNotExpr HsStmtContextRn
ctxt (UnexpectedStatement StmtLR GhcPs GhcPs body
stmt) ->
      SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$ SDoc -> Arity -> SDoc -> SDoc
hang SDoc
last_error Arity
2 (StmtLR GhcPs GhcPs body -> SDoc
forall a. Outputable a => a -> SDoc
ppr StmtLR GhcPs GhcPs body
stmt)
      where
        last_error :: SDoc
last_error =
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The last statement in" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> HsStmtContext (LocatedN Name) -> SDoc
forall fn. Outputable fn => HsStmtContext fn -> SDoc
pprAStmtContext HsStmtContextRn
HsStmtContext (LocatedN Name)
ctxt
          SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"must be an expression"
    TcRnUnexpectedStatementInContext HsStmtContextRn
ctxt (UnexpectedStatement StmtLR GhcPs GhcPs body
stmt) Maybe Extension
_ -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
       [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Unexpected" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> StmtLR GhcPs GhcPs body -> SDoc
forall (p :: Pass) body. IsPass p => Stmt (GhcPass p) body -> SDoc
pprStmtCat StmtLR GhcPs GhcPs body
stmt SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"statement"
                       , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> HsStmtContext (LocatedN Name) -> SDoc
forall fn. Outputable fn => HsStmtContext fn -> SDoc
pprAStmtContext HsStmtContextRn
HsStmtContext (LocatedN Name)
ctxt ]
    TcRnMessage
TcRnIllegalTupleSection -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal tuple section"
    TcRnIllegalImplicitParameterBindings Either
  (HsLocalBindsLR GhcPs GhcPs)
  (HsLocalBindsLR (GhcPass 'Renamed) GhcPs)
eBinds -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        (HsLocalBindsLR GhcPs GhcPs -> SDoc)
-> (HsLocalBindsLR (GhcPass 'Renamed) GhcPs -> SDoc)
-> Either
     (HsLocalBindsLR GhcPs GhcPs)
     (HsLocalBindsLR (GhcPass 'Renamed) GhcPs)
-> SDoc
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either HsLocalBindsLR GhcPs GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
msg HsLocalBindsLR (GhcPass 'Renamed) GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
msg Either
  (HsLocalBindsLR GhcPs GhcPs)
  (HsLocalBindsLR (GhcPass 'Renamed) GhcPs)
eBinds
      where
        msg :: a -> SDoc
msg a
binds = SDoc -> Arity -> SDoc -> SDoc
hang
          ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Implicit-parameter bindings illegal in an mdo expression")
          Arity
2 (a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
binds)
    TcRnSectionWithoutParentheses HsExpr GhcPs
expr -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"A section must be enclosed in parentheses")
         Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"thus:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> (SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (HsExpr GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsExpr GhcPs
expr)))
    TcRnMissingRoleAnnotation Name
name [Role]
roles -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Missing role annotation" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
colon)
         Arity
2 ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"type role" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep ((Role -> SDoc) -> [Role] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map Role -> SDoc
forall a. Outputable a => a -> SDoc
ppr [Role]
roles))

    TcRnIllformedTypePattern Pat (GhcPass 'Renamed)
p
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
          SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Ill-formed type pattern:") Arity
2 (Pat (GhcPass 'Renamed) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Pat (GhcPass 'Renamed)
p)
    TcRnMessage
TcRnIllegalTypePattern
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal type pattern." SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"A type pattern must be checked against a visible forall."
    TcRnIllformedTypeArgument LHsExpr (GhcPass 'Renamed)
e
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
          SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Ill-formed type argument:") Arity
2 (GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsExpr (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))
e)
    TcRnIllegalTypeExpr TypeSyntax
syntax -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> TypeSyntax -> SDoc
pprTypeSyntaxName TypeSyntax
syntax
           , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Type syntax may only be used in a required type argument,"
           , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"i.e. to instantiate a visible forall." ]

    TcRnCapturedTermName RdrName
tv_name Either [GlobalRdrElt] Name
shadowed_term_names
      -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
        [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"The type variable" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr RdrName
tv_name) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"is implicitly quantified," SDoc -> SDoc -> SDoc
$+$
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"even though another variable of the same name is in scope:" SDoc -> SDoc -> SDoc
$+$
          Arity -> SDoc -> SDoc
nest Arity
2 SDoc
var_names SDoc -> SDoc -> SDoc
$+$
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"This is not compatible with the RequiredTypeArguments extension."
        where
          var_names :: SDoc
var_names = case Either [GlobalRdrElt] Name
shadowed_term_names of
              Left [GlobalRdrElt]
gbl_names -> [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((GlobalRdrElt -> SDoc) -> [GlobalRdrElt] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (\GlobalRdrElt
name -> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Name -> SDoc) -> Name -> SDoc
forall a b. (a -> b) -> a -> b
$ GlobalRdrElt -> Name
forall info. GlobalRdrEltX info -> Name
greName GlobalRdrElt
name) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> GlobalRdrElt -> SDoc
forall info. GlobalRdrEltX info -> SDoc
pprNameProvenance GlobalRdrElt
name) [GlobalRdrElt]
gbl_names)
              Right Name
lcl_name -> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
lcl_name) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"defined at"
                SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SrcLoc -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Name -> SrcLoc
nameSrcLoc Name
lcl_name)
    TcRnBindingOfExistingName RdrName
name -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal binding of an existing name:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr (RdrName -> RdrName
filterCTuple RdrName
name)
    TcRnMultipleFixityDecls SrcSpan
loc RdrName
rdr_name -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Multiple fixity declarations for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr RdrName
rdr_name),
            [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"also at " SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr SrcSpan
loc]
    TcRnMessage
TcRnIllegalPatternSynonymDecl -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal pattern synonym declaration"
    TcRnIllegalClassBinding DeclSort
dsort HsBindLR GhcPs GhcPs
bind -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ SDoc
what SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"not allowed in" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
decl_sort
              , Arity -> SDoc -> SDoc
nest Arity
2 (HsBindLR GhcPs GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsBindLR GhcPs GhcPs
bind) ]
      where
        decl_sort :: SDoc
decl_sort = case DeclSort
dsort of
          DeclSort
ClassDeclSort -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"class declaration:"
          DeclSort
InstanceDeclSort -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"instance declaration:"
        what :: SDoc
what = case HsBindLR GhcPs GhcPs
bind of
                  PatBind {}    -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Pattern bindings (except simple variables)"
                  PatSynBind {} -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Pattern synonyms"
                                   -- Associated pattern synonyms are not implemented yet
                  HsBindLR GhcPs GhcPs
_ -> [Char] -> SDoc -> SDoc
forall a. HasCallStack => [Char] -> SDoc -> a
pprPanic [Char]
"rnMethodBind" (HsBindLR GhcPs GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsBindLR GhcPs GhcPs
bind)
    TcRnMessage
TcRnOrphanCompletePragma -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Orphan COMPLETE pragmas not supported" SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"A COMPLETE pragma must mention at least one data constructor" SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"or pattern synonym defined in the same module."
    TcRnEmptyCase HsMatchContextRn
ctxt -> SDoc -> DecoratedSDoc
mkSimpleDecorated SDoc
message
      where
        pp_ctxt :: SDoc
pp_ctxt = case HsMatchContextRn
ctxt of
          HsMatchContextRn
CaseAlt                                -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"case expression"
          LamAlt HsLamVariant
LamCase                         -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"\\case expression"
          ArrowMatchCtxt (ArrowLamAlt HsLamVariant
LamSingle) -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"kappa abstraction"
          ArrowMatchCtxt (ArrowLamAlt HsLamVariant
LamCase)   -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"\\case command"
          ArrowMatchCtxt HsArrowMatchContext
ArrowCaseAlt            -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"case command"
          HsMatchContextRn
_                                      -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"(unexpected)"
                                                    SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> HsMatchContext (LocatedN Name) -> SDoc
forall fn. Outputable fn => HsMatchContext fn -> SDoc
pprMatchContextNoun HsMatchContextRn
HsMatchContext (LocatedN Name)
ctxt

        message :: SDoc
message = case HsMatchContextRn
ctxt of
          LamAlt HsLamVariant
LamCases -> SDoc
lcases_msg SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"expression"
          ArrowMatchCtxt (ArrowLamAlt HsLamVariant
LamCases) -> SDoc
lcases_msg SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"command"
          HsMatchContextRn
_ -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Empty list of alternatives in" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
pp_ctxt

        lcases_msg :: SDoc
lcases_msg =
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Empty list of alternatives is not allowed in \\cases"
    TcRnNonStdGuards (NonStandardGuards [LStmtLR (GhcPass 'Renamed) (GhcPass 'Renamed) body]
guards) -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"accepting non-standard pattern guards" SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
      Arity -> SDoc -> SDoc
nest Arity
4 ([GenLocated SrcSpanAnnA (Stmt (GhcPass 'Renamed) body)] -> SDoc
forall a. Outputable a => [a] -> SDoc
interpp'SP [LStmtLR (GhcPass 'Renamed) (GhcPass 'Renamed) body]
[GenLocated SrcSpanAnnA (Stmt (GhcPass 'Renamed) body)]
guards)
    TcRnDuplicateSigDecl pairs :: NonEmpty (LocatedN RdrName, Sig GhcPs)
pairs@((L SrcSpanAnnN
_ RdrName
name, Sig GhcPs
sig) :| [(LocatedN RdrName, Sig GhcPs)]
_) -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Duplicate" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
what_it_is
            SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"s for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr RdrName
name)
          , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"at" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((SrcSpan -> SDoc) -> [SrcSpan] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr ([SrcSpan] -> [SDoc]) -> [SrcSpan] -> [SDoc]
forall a b. (a -> b) -> a -> b
$ (SrcSpan -> SrcSpan -> Ordering) -> [SrcSpan] -> [SrcSpan]
forall a. (a -> a -> Ordering) -> [a] -> [a]
sortBy SrcSpan -> SrcSpan -> Ordering
leftmost_smallest
                                        ([SrcSpan] -> [SrcSpan]) -> [SrcSpan] -> [SrcSpan]
forall a b. (a -> b) -> a -> b
$ ((LocatedN RdrName, Sig GhcPs) -> SrcSpan)
-> [(LocatedN RdrName, Sig GhcPs)] -> [SrcSpan]
forall a b. (a -> b) -> [a] -> [b]
map (LocatedN RdrName -> SrcSpan
forall a e. HasLoc a => GenLocated a e -> SrcSpan
getLocA (LocatedN RdrName -> SrcSpan)
-> ((LocatedN RdrName, Sig GhcPs) -> LocatedN RdrName)
-> (LocatedN RdrName, Sig GhcPs)
-> SrcSpan
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (LocatedN RdrName, Sig GhcPs) -> LocatedN RdrName
forall a b. (a, b) -> a
fst)
                                        ([(LocatedN RdrName, Sig GhcPs)] -> [SrcSpan])
-> [(LocatedN RdrName, Sig GhcPs)] -> [SrcSpan]
forall a b. (a -> b) -> a -> b
$ NonEmpty (LocatedN RdrName, Sig GhcPs)
-> [(LocatedN RdrName, Sig GhcPs)]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (LocatedN RdrName, Sig GhcPs)
pairs)
          ]
      where
        what_it_is :: SDoc
what_it_is = Sig GhcPs -> SDoc
forall (p :: Pass). IsPass p => Sig (GhcPass p) -> SDoc
hsSigDoc Sig GhcPs
sig
    TcRnMisplacedSigDecl Sig (GhcPass 'Renamed)
sig -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Misplaced" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Sig (GhcPass 'Renamed) -> SDoc
forall (p :: Pass). IsPass p => Sig (GhcPass p) -> SDoc
hsSigDoc Sig (GhcPass 'Renamed)
sig SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
colon, Sig (GhcPass 'Renamed) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Sig (GhcPass 'Renamed)
sig]
    TcRnUnexpectedDefaultSig Sig GhcPs
sig -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Unexpected default signature:")
         Arity
2 (Sig GhcPs -> SDoc
forall a. Outputable a => a -> SDoc
ppr Sig GhcPs
sig)
    TcRnDuplicateMinimalSig LSig GhcPs
sig1 LSig GhcPs
sig2 [LSig GhcPs]
otherSigs -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Multiple minimal complete definitions"
           , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"at" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((SrcSpan -> SDoc) -> [SrcSpan] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr ([SrcSpan] -> [SDoc]) -> [SrcSpan] -> [SDoc]
forall a b. (a -> b) -> a -> b
$ (SrcSpan -> SrcSpan -> Ordering) -> [SrcSpan] -> [SrcSpan]
forall a. (a -> a -> Ordering) -> [a] -> [a]
sortBy SrcSpan -> SrcSpan -> Ordering
leftmost_smallest ([SrcSpan] -> [SrcSpan]) -> [SrcSpan] -> [SrcSpan]
forall a b. (a -> b) -> a -> b
$ (GenLocated SrcSpanAnnA (Sig GhcPs) -> SrcSpan)
-> [GenLocated SrcSpanAnnA (Sig GhcPs)] -> [SrcSpan]
forall a b. (a -> b) -> [a] -> [b]
map GenLocated SrcSpanAnnA (Sig GhcPs) -> SrcSpan
forall a e. HasLoc a => GenLocated a e -> SrcSpan
getLocA [GenLocated SrcSpanAnnA (Sig GhcPs)]
sigs)
           , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Combine alternative minimal complete definitions with `|'" ]
      where
        sigs :: [GenLocated SrcSpanAnnA (Sig GhcPs)]
sigs = LSig GhcPs
GenLocated SrcSpanAnnA (Sig GhcPs)
sig1 GenLocated SrcSpanAnnA (Sig GhcPs)
-> [GenLocated SrcSpanAnnA (Sig GhcPs)]
-> [GenLocated SrcSpanAnnA (Sig GhcPs)]
forall a. a -> [a] -> [a]
: LSig GhcPs
GenLocated SrcSpanAnnA (Sig GhcPs)
sig2 GenLocated SrcSpanAnnA (Sig GhcPs)
-> [GenLocated SrcSpanAnnA (Sig GhcPs)]
-> [GenLocated SrcSpanAnnA (Sig GhcPs)]
forall a. a -> [a] -> [a]
: [LSig GhcPs]
[GenLocated SrcSpanAnnA (Sig GhcPs)]
otherSigs
    TcRnMessage
TcRnUnexpectedStandaloneDerivingDecl -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal standalone deriving declaration"
    TcRnUnusedVariableInRuleDecl FastString
name Name
var -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Rule" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
doubleQuotes (FastString -> SDoc
forall doc. IsLine doc => FastString -> doc
ftext FastString
name) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
colon,
          [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Forall'd variable" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
var) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+>
                  [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"does not appear on left hand side"]
    TcRnMessage
TcRnUnexpectedStandaloneKindSig -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal standalone kind signature"
    TcRnIllegalRuleLhs RuleLhsErrReason
errReason FastString
name LHsExpr (GhcPass 'Renamed)
lhs HsExpr (GhcPass 'Renamed)
bad_e -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
sep [[Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Rule" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> FastString -> SDoc
pprRuleName FastString
name SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc
forall doc. IsLine doc => doc
colon,
           Arity -> SDoc -> SDoc
nest Arity
2 ([SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [SDoc
err,
                         [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"in left-hand side:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed)) -> SDoc
forall a. Outputable a => a -> SDoc
ppr LHsExpr (GhcPass 'Renamed)
GenLocated SrcSpanAnnA (HsExpr (GhcPass 'Renamed))
lhs])]
      SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$
      [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"LHS must be of form (f e1 .. en) where f is not forall'd"
      where
        err :: SDoc
err = case RuleLhsErrReason
errReason of
          UnboundVariable RdrName
uv NotInScopeError
nis -> RdrName -> NotInScopeError -> SDoc
pprScopeError RdrName
uv NotInScopeError
nis
          RuleLhsErrReason
IllegalExpression -> [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Illegal expression:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> HsExpr (GhcPass 'Renamed) -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsExpr (GhcPass 'Renamed)
bad_e
    TcRnDuplicateRoleAnnot NonEmpty (LRoleAnnotDecl GhcPs)
list -> SDoc -> DecoratedSDoc
mkSimpleDecorated (SDoc -> DecoratedSDoc) -> SDoc -> DecoratedSDoc
forall a b. (a -> b) -> a -> b
$
      SDoc -> Arity -> SDoc -> SDoc
hang ([Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Duplicate role annotations for" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc