2 % (c) The GRASP/AQUA Project, Glasgow University, 1993-1996
4 \section[CoreLint]{A ``lint'' pass to check for Core correctness}
7 #include "HsVersions.h"
15 IMPORT_1_3(IO(hPutStr,stderr))
17 import CmdLineOpts ( opt_D_show_passes, opt_PprUserLength, opt_DoCoreLinting )
21 import Kind ( hasMoreBoxityInfo, Kind{-instance-},
22 isTypeKind, isBoxedTypeKind {- TEMP --SOF -} )
23 import Literal ( literalType, Literal{-instance-} )
24 import Id ( idType, isBottomingId, dataConRepType, isDataCon, isNewCon,
25 dataConArgTys, GenId{-instances-},
26 emptyIdSet, mkIdSet, intersectIdSets,
27 unionIdSets, elementOfIdSet, SYN_IE(IdSet),
30 import Maybes ( catMaybes )
31 import Name ( isLocallyDefined, getSrcLoc, Name{-instance NamedThing-},
34 import Outputable ( PprStyle(..), Outputable(..), pprDumpStyle, printErrs )
35 import ErrUtils ( doIfSet, ghcExit )
36 import PprType ( GenType, GenTyVar, TyCon )
38 import PrimOp ( primOpType, PrimOp(..) )
39 import PrimRep ( PrimRep(..) )
40 import SrcLoc ( SrcLoc )
41 import Type ( mkFunTy,getFunTy_maybe,mkForAllTy,mkForAllTys,getForAllTy_maybe,
42 getFunTyExpandingDicts_maybe,
43 getForAllTyExpandingDicts_maybe,
44 isPrimType,typeKind,instantiateTy,splitSigmaTy,
45 mkForAllUsageTy,getForAllUsageTy,instantiateUsage,
46 maybeAppDataTyConExpandingDicts, eqTy, SYN_IE(Type)
48 import TyCon ( isPrimTyCon, isDataTyCon )
49 import TyVar ( tyVarKind, GenTyVar{-instances-} )
50 import Unique ( Unique )
51 import Usage ( GenUsage, SYN_IE(Usage) )
52 import Util ( zipEqual, pprTrace, pprPanic, assertPanic, panic )
54 infixr 9 `thenL`, `seqL`, `thenMaybeL`, `seqMaybeL`
57 %************************************************************************
59 \subsection[lintCoreBindings]{@lintCoreBindings@: Top-level interface}
61 %************************************************************************
63 Checks that a set of core bindings is well-formed. The PprStyle and String
64 just control what we print in the event of an error. The Bool value
65 indicates whether we have done any specialisation yet (in which case we do
70 (b) Out-of-scope type variables
71 (c) Out-of-scope local variables
74 If we have done specialisation the we check that there are
75 (a) No top-level bindings of primitive (unboxed type)
80 -- Things are *not* OK if:
82 -- * Unsaturated type app before specialisation has been done;
84 -- * Oversaturated type app after specialisation (eta reduction
85 -- may well be happening...);
87 -- Note: checkTyApp is usually followed by a call to checkSpecTyApp.
91 lintCoreBindings :: String -> Bool -> [CoreBinding] -> IO ()
93 lintCoreBindings whoDunnit spec_done binds
94 | not opt_DoCoreLinting
97 lintCoreBindings whoDunnit spec_done binds
98 = case (initL (lint_binds binds) spec_done) of
99 Nothing -> doIfSet opt_D_show_passes
100 (hPutStr stderr ("*** Core Linted result of " ++ whoDunnit ++ "\n"))
102 Just bad_news -> printErrs (display bad_news) >>
105 lint_binds [] = returnL ()
106 lint_binds (bind:binds)
107 = lintCoreBinding bind `thenL` \binders ->
108 addInScopeVars binders (lint_binds binds)
112 text ("*** Core Lint Errors: in result of " ++ whoDunnit ++ " ***"),
113 bad_news pprDumpStyle,
114 ptext SLIT("*** Offending Program ***"),
115 pprCoreBindings pprDumpStyle binds,
116 ptext SLIT("*** End of Offense ***")
120 %************************************************************************
122 \subsection[lintUnfolding]{lintUnfolding}
124 %************************************************************************
126 We use this to check all unfoldings that come in from interfaces
127 (it is very painful to catch errors otherwise):
130 lintUnfolding :: SrcLoc -> CoreExpr -> Maybe CoreExpr
132 lintUnfolding locn expr
134 (initL (addLoc (ImportedUnfolding locn) (lintCoreExpr expr))
135 True{-pretend spec done-})
139 pprTrace "WARNING: Discarded bad unfolding from interface:\n"
140 (vcat [msg (PprForUser opt_PprUserLength),
141 ptext SLIT("*** Bad unfolding ***"),
143 ptext SLIT("*** End unfolding ***")])
147 %************************************************************************
149 \subsection[lintCoreBinding]{lintCoreBinding}
151 %************************************************************************
153 Check a core binding, returning the list of variables bound.
156 lintCoreBinding :: CoreBinding -> LintM [Id]
158 lintCoreBinding (NonRec binder rhs)
159 = lintSingleBinding (binder,rhs) `seqL` returnL [binder]
161 lintCoreBinding (Rec pairs)
162 = addInScopeVars binders (
163 mapL lintSingleBinding pairs `seqL` returnL binders
166 binders = [b | (b,_) <- pairs]
168 lintSingleBinding (binder,rhs)
169 = addLoc (RhsOf binder) (
174 -- Check match to RHS type
176 Nothing -> returnL ()
177 Just ty -> checkTys (idType binder) ty (mkRhsMsg binder ty))
180 -- Check (not isPrimType)
181 checkIfSpecDoneL (not (isPrimType (idType binder)))
182 (mkRhsPrimMsg binder rhs)
184 -- We should check the unfolding, if any, but this is tricky because
185 -- the unfolding is a SimplifiableCoreExpr. Give up for now.
189 %************************************************************************
191 \subsection[lintCoreExpr]{lintCoreExpr}
193 %************************************************************************
196 lintCoreExpr :: CoreExpr -> LintM (Maybe Type) -- Nothing if error found
198 lintCoreExpr (Var var) = checkInScope var `seqL` returnL (Just (idType var))
199 lintCoreExpr (Lit lit) = returnL (Just (literalType lit))
200 lintCoreExpr (SCC _ expr) = lintCoreExpr expr
201 lintCoreExpr e@(Coerce coercion ty expr)
202 = lintCoercion e coercion `seqL`
203 lintCoreExpr expr `seqL` returnL (Just ty)
205 lintCoreExpr (Let binds body)
206 = lintCoreBinding binds `thenL` \binders ->
207 if (null binders) then
208 lintCoreExpr body -- Can't add a new source location
210 addLoc (BodyOfLetRec binders)
211 (addInScopeVars binders (lintCoreExpr body))
213 lintCoreExpr e@(Con con args)
214 = checkL (isDataCon con) (mkConErrMsg e) `seqL`
215 lintCoreArgs {-False-} e (dataConRepType con) args
216 -- Note: we don't check for primitive types in these arguments
218 lintCoreExpr e@(Prim op args)
219 = lintCoreArgs {-True-} e (primOpType op) args
220 -- Note: we do check for primitive types in these arguments
222 lintCoreExpr e@(App fun@(Var v) arg) | isBottomingId v
223 = lintCoreExpr fun `thenMaybeL` \ ty -> lintCoreArg {-False-} e ty arg
224 -- Note: we don't check for primitive types in argument to 'error'
226 lintCoreExpr e@(App fun arg)
227 = lintCoreExpr fun `thenMaybeL` \ty -> lintCoreArg {-True-} e ty arg
228 -- Note: we do check for primitive types in this argument
230 lintCoreExpr (Lam (ValBinder var) expr)
231 = addLoc (LambdaBodyOf var)
232 (addInScopeVars [var]
233 (lintCoreExpr expr `thenMaybeL` \ty ->
234 returnL (Just (mkFunTy (idType var) ty))))
236 lintCoreExpr (Lam (TyBinder tyvar) expr)
237 = lintCoreExpr expr `thenMaybeL` \ty ->
238 returnL (Just(mkForAllTy tyvar ty))
239 -- ToDo: Should add in-scope type variable at this point
241 lintCoreExpr e@(Case scrut alts)
242 = lintCoreExpr scrut `thenMaybeL` \ty ->
246 %************************************************************************
248 \subsection[lintCoreArgs]{lintCoreArgs}
250 %************************************************************************
252 The boolean argument indicates whether we should flag type
253 applications to primitive types as being errors.
256 lintCoreArgs :: {-Bool ->-} CoreExpr -> Type -> [CoreArg] -> LintM (Maybe Type)
258 lintCoreArgs _ ty [] = returnL (Just ty)
259 lintCoreArgs e ty (a : args)
260 = lintCoreArg e ty a `thenMaybeL` \ res ->
261 lintCoreArgs e res args
264 %************************************************************************
266 \subsection[lintCoreArg]{lintCoreArg}
268 %************************************************************************
271 lintCoreArg :: {-Bool ->-} CoreExpr -> Type -> CoreArg -> LintM (Maybe Type)
273 lintCoreArg e ty (LitArg lit)
274 = -- Make sure function type matches argument
275 case (getFunTyExpandingDicts_maybe False{-no peeking in newtypes-} ty) of
276 Just (arg,res) | (lit_ty `eqTy` arg) -> returnL(Just res)
277 _ -> addErrL (mkAppMsg ty lit_ty e) `seqL` returnL Nothing
279 lit_ty = literalType lit
281 lintCoreArg e ty (VarArg v)
282 = -- Make sure variable is bound
283 checkInScope v `seqL`
284 -- Make sure function type matches argument
285 case (getFunTyExpandingDicts_maybe False{-as above-} ty) of
286 Just (arg,res) | (var_ty `eqTy` arg) -> returnL(Just res)
287 _ -> addErrL (mkAppMsg ty var_ty e) `seqL` returnL Nothing
291 lintCoreArg e ty a@(TyArg arg_ty)
292 = -- ToDo: Check that ty is well-kinded and has no unbound tyvars
293 case (getForAllTyExpandingDicts_maybe ty) of
294 Nothing -> addErrL (mkTyAppMsg SLIT("Illegal") ty arg_ty e) `seqL` returnL Nothing
298 tyvar_kind = tyVarKind tyvar
299 argty_kind = typeKind arg_ty
301 if argty_kind `hasMoreBoxityInfo` tyvar_kind
302 -- Arg type might be boxed for a function with an uncommitted
303 -- tyvar; notably this is used so that we can give
304 -- error :: forall a:*. String -> a
305 -- and then apply it to both boxed and unboxed types.
307 returnL(Just(instantiateTy [(tyvar,arg_ty)] body))
309 pprTrace "lintCoreArg:kinds:" (hsep [ppr PprDebug tyvar_kind, ppr PprDebug argty_kind]) $
310 addErrL (mkTyAppMsg SLIT("Kinds not right in") ty arg_ty e) `seqL` returnL Nothing
312 lintCoreArg e ty (UsageArg u)
313 = -- ToDo: Check that usage has no unbound usage variables
314 case (getForAllUsageTy ty) of
315 Just (uvar,bounds,body) ->
316 -- ToDo: Check argument satisfies bounds
317 returnL(Just(panic "lintCoreArg:instantiateUsage uvar u body"))
318 _ -> addErrL (mkUsageAppMsg ty u e) `seqL` returnL Nothing
321 %************************************************************************
323 \subsection[lintCoreAlts]{lintCoreAlts}
325 %************************************************************************
328 lintCoreAlts :: CoreCaseAlts
329 -> Type -- Type of scrutinee
330 -- -> TyCon -- TyCon pinned on the case
331 -> LintM (Maybe Type) -- Type of alternatives
333 lintCoreAlts whole_alts@(AlgAlts alts deflt) ty --tycon
334 = -- Check tycon is not a primitive tycon
335 -- addErrIfL (isPrimTyCon tycon) (mkCasePrimMsg tycon)
337 -- Check we are scrutinising a proper datatype
339 -- addErrIfL (not (tyConFamilySize tycon >= 1)) (mkCaseAbstractMsg tycon)
342 `thenL` \maybe_deflt_ty ->
343 mapL (lintAlgAlt ty {-tycon-}) alts
344 `thenL` \maybe_alt_tys ->
345 -- Check the result types
346 case catMaybes (maybe_deflt_ty : maybe_alt_tys) of
347 [] -> returnL Nothing
349 (first_ty:tys) -> mapL check tys `seqL`
350 returnL (Just first_ty)
352 check ty = checkTys first_ty ty (mkCaseAltMsg whole_alts)
354 lintCoreAlts whole_alts@(PrimAlts alts deflt) ty --tycon
355 = -- Check tycon is a primitive tycon
356 -- addErrIfL (not (isPrimTyCon tycon)) (mkCaseNotPrimMsg tycon)
358 mapL (lintPrimAlt ty) alts
359 `thenL` \maybe_alt_tys ->
361 `thenL` \maybe_deflt_ty ->
362 -- Check the result types
363 case catMaybes (maybe_deflt_ty : maybe_alt_tys) of
364 [] -> returnL Nothing
366 (first_ty:tys) -> mapL check tys `seqL`
367 returnL (Just first_ty)
369 check ty = checkTys first_ty ty (mkCaseAltMsg whole_alts)
371 lintAlgAlt scrut_ty (con,args,rhs)
372 = (case maybeAppDataTyConExpandingDicts scrut_ty of
373 Just (tycon, tys_applied, cons) | isDataTyCon tycon ->
375 arg_tys = dataConArgTys con tys_applied
377 checkL (con `elem` cons) (mkAlgAltMsg2 scrut_ty con) `seqL`
378 checkL (length arg_tys == length args) (mkAlgAltMsg3 con args)
380 mapL check (zipEqual "lintAlgAlt" arg_tys args) `seqL`
383 other -> addErrL (mkAlgAltMsg1 scrut_ty)
385 addInScopeVars args (
389 check (ty, arg) = checkTys ty (idType arg) (mkAlgAltMsg4 ty arg)
391 -- elem: yes, the elem-list here can sometimes be long-ish,
392 -- but as it's use-once, probably not worth doing anything different
393 -- We give it its own copy, so it isn't overloaded.
395 elem x (y:ys) = x==y || elem x ys
397 lintPrimAlt ty alt@(lit,rhs)
398 = checkTys (literalType lit) ty (mkPrimAltMsg alt) `seqL`
401 lintDeflt NoDefault _ = returnL Nothing
402 lintDeflt deflt@(BindDefault binder rhs) ty
403 = checkTys (idType binder) ty (mkDefltMsg deflt) `seqL`
404 addInScopeVars [binder] (lintCoreExpr rhs)
407 %************************************************************************
409 \subsection[lint-coercion]{Coercion}
411 %************************************************************************
414 lintCoercion e (CoerceIn con) = check_con e con
415 lintCoercion e (CoerceOut con) = check_con e con
417 check_con e con = checkL (isNewCon con)
422 %************************************************************************
424 \subsection[lint-monad]{The Lint monad}
426 %************************************************************************
429 type LintM a = Bool -- True <=> specialisation has been done
430 -> [LintLocInfo] -- Locations
431 -> IdSet -- Local vars in scope
432 -> Bag ErrMsg -- Error messages so far
433 -> (a, Bag ErrMsg) -- Result and error messages (if any)
435 type ErrMsg = PprStyle -> Doc
438 = RhsOf Id -- The variable bound
439 | LambdaBodyOf Id -- The lambda-binder
440 | BodyOfLetRec [Id] -- One of the binders
441 | ImportedUnfolding SrcLoc -- Some imported unfolding (ToDo: say which)
443 instance Outputable LintLocInfo where
445 = hcat [ppr sty (getSrcLoc v), ptext SLIT(": [RHS of "), pp_binders sty [v], char ']']
447 ppr sty (LambdaBodyOf b)
448 = hcat [ppr sty (getSrcLoc b),
449 ptext SLIT(": [in body of lambda with binder "), pp_binder sty b, char ']']
451 ppr sty (BodyOfLetRec bs)
452 = hcat [ppr sty (getSrcLoc (head bs)),
453 ptext SLIT(": [in body of letrec with binders "), pp_binders sty bs, char ']']
455 ppr sty (ImportedUnfolding locn)
456 = (<>) (ppr sty locn) (ptext SLIT(": [in an imported unfolding]"))
458 pp_binders :: PprStyle -> [Id] -> Doc
459 pp_binders sty bs = sep (punctuate comma (map (pp_binder sty) bs))
461 pp_binder :: PprStyle -> Id -> Doc
462 pp_binder sty b = hsep [ppr sty b, text "::", ppr sty (idType b)]
466 initL :: LintM a -> Bool -> Maybe ErrMsg
468 = case (m spec_done [] emptyIdSet emptyBag) of { (_, errs) ->
469 if isEmptyBag errs then
473 vcat [ msg sty | msg <- bagToList errs ]
477 returnL :: a -> LintM a
478 returnL r spec loc scope errs = (r, errs)
480 thenL :: LintM a -> (a -> LintM b) -> LintM b
481 thenL m k spec loc scope errs
482 = case m spec loc scope errs of
483 (r, errs') -> k r spec loc scope errs'
485 seqL :: LintM a -> LintM b -> LintM b
486 seqL m k spec loc scope errs
487 = case m spec loc scope errs of
488 (_, errs') -> k spec loc scope errs'
490 thenMaybeL :: LintM (Maybe a) -> (a -> LintM (Maybe b)) -> LintM (Maybe b)
491 thenMaybeL m k spec loc scope errs
492 = case m spec loc scope errs of
493 (Nothing, errs2) -> (Nothing, errs2)
494 (Just r, errs2) -> k r spec loc scope errs2
496 seqMaybeL :: LintM (Maybe a) -> LintM (Maybe b) -> LintM (Maybe b)
497 seqMaybeL m k spec loc scope errs
498 = case m spec loc scope errs of
499 (Nothing, errs2) -> (Nothing, errs2)
500 (Just _, errs2) -> k spec loc scope errs2
502 mapL :: (a -> LintM b) -> [a] -> LintM [b]
503 mapL f [] = returnL []
506 mapL f xs `thenL` \ rs ->
509 mapMaybeL :: (a -> LintM (Maybe b)) -> [a] -> LintM (Maybe [b])
510 -- Returns Nothing if anything fails
511 mapMaybeL f [] = returnL (Just [])
513 = f x `thenMaybeL` \ r ->
514 mapMaybeL f xs `thenMaybeL` \ rs ->
515 returnL (Just (r:rs))
519 checkL :: Bool -> ErrMsg -> LintM ()
520 checkL True msg spec loc scope errs = ((), errs)
521 checkL False msg spec loc scope errs = ((), addErr errs msg loc)
523 checkIfSpecDoneL :: Bool -> ErrMsg -> LintM ()
524 checkIfSpecDoneL True msg spec loc scope errs = ((), errs)
525 checkIfSpecDoneL False msg True loc scope errs = ((), addErr errs msg loc)
526 checkIfSpecDoneL False msg False loc scope errs = ((), errs)
529 = if pred then addErrL spec else returnL ()
531 addErrL :: ErrMsg -> LintM ()
532 addErrL msg spec loc scope errs = ((), addErr errs msg loc)
534 addErr :: Bag ErrMsg -> ErrMsg -> [LintLocInfo] -> Bag ErrMsg
536 addErr errs_so_far msg locs
537 = ASSERT (not (null locs))
538 errs_so_far `snocBag` ( \ sty ->
539 hang (ppr sty (head locs)) 4 (msg sty)
542 addLoc :: LintLocInfo -> LintM a -> LintM a
543 addLoc extra_loc m spec loc scope errs
544 = m spec (extra_loc:loc) scope errs
546 addInScopeVars :: [Id] -> LintM a -> LintM a
547 addInScopeVars ids m spec loc scope errs
548 = -- We check if these "new" ids are already
549 -- in scope, i.e., we have *shadowing* going on.
550 -- For now, it's just a "trace"; we may make
551 -- a real error out of it...
553 new_set = mkIdSet ids
555 -- shadowed = scope `intersectIdSets` new_set
557 -- After adding -fliberate-case, Simon decided he likes shadowed
558 -- names after all. WDP 94/07
559 -- (if isEmptyUniqSet shadowed
561 -- else pprTrace "Shadowed vars:" (ppr PprDebug (uniqSetToList shadowed))) (
562 m spec loc (scope `unionIdSets` new_set) errs
567 checkInScope :: Id -> LintM ()
568 checkInScope id spec loc scope errs
572 if isLocallyDefined id_name && not (id `elementOfIdSet` scope) then
573 ((),addErr errs (\sty -> hsep [ppr sty id, ptext SLIT("is out of scope")]) loc)
577 checkTys :: Type -> Type -> ErrMsg -> LintM ()
578 checkTys ty1 ty2 msg spec loc scope errs
579 = if ty1 `eqTy` ty2 then ((), errs) else ((), addErr errs msg loc)
584 = ($$) (ptext SLIT("Application of newtype constructor:"))
588 = ($$) (ptext SLIT("Coercion using a datatype constructor:"))
592 mkCaseAltMsg :: CoreCaseAlts -> ErrMsg
593 mkCaseAltMsg alts sty
594 = ($$) (ptext SLIT("Type of case alternatives not the same:"))
597 mkCaseDataConMsg :: CoreExpr -> ErrMsg
598 mkCaseDataConMsg expr sty
599 = ($$) (ptext SLIT("A case scrutinee not of data constructor type:"))
602 mkCaseNotPrimMsg :: TyCon -> ErrMsg
603 mkCaseNotPrimMsg tycon sty
604 = ($$) (ptext SLIT("A primitive case on a non-primitive type:"))
607 mkCasePrimMsg :: TyCon -> ErrMsg
608 mkCasePrimMsg tycon sty
609 = ($$) (ptext SLIT("An algebraic case on a primitive type:"))
612 mkCaseAbstractMsg :: TyCon -> ErrMsg
613 mkCaseAbstractMsg tycon sty
614 = ($$) (ptext SLIT("An algebraic case on some weird type:"))
617 mkDefltMsg :: CoreCaseDefault -> ErrMsg
619 = ($$) (ptext SLIT("Binder in case default doesn't match type of scrutinee:"))
622 mkAppMsg :: Type -> Type -> CoreExpr -> ErrMsg
623 mkAppMsg fun arg expr sty
624 = vcat [ptext SLIT("Argument value doesn't match argument type:"),
625 hang (ptext SLIT("Fun type:")) 4 (ppr sty fun),
626 hang (ptext SLIT("Arg type:")) 4 (ppr sty arg),
627 hang (ptext SLIT("Expression:")) 4 (pp_expr sty expr)]
629 mkTyAppMsg :: FAST_STRING -> Type -> Type -> CoreExpr -> ErrMsg
630 mkTyAppMsg msg ty arg expr sty
631 = vcat [hsep [ptext msg, ptext SLIT("type application:")],
632 hang (ptext SLIT("Exp type:")) 4 (ppr sty ty),
633 hang (ptext SLIT("Arg type:")) 4 (ppr sty arg),
634 hang (ptext SLIT("Expression:")) 4 (pp_expr sty expr)]
636 mkUsageAppMsg :: Type -> Usage -> CoreExpr -> ErrMsg
637 mkUsageAppMsg ty u expr sty
638 = vcat [ptext SLIT("Illegal usage application:"),
639 hang (ptext SLIT("Exp type:")) 4 (ppr sty ty),
640 hang (ptext SLIT("Usage exp:")) 4 (ppr sty u),
641 hang (ptext SLIT("Expression:")) 4 (pp_expr sty expr)]
643 mkAlgAltMsg1 :: Type -> ErrMsg
645 = ($$) (text "In some case statement, type of scrutinee is not a data type:")
647 -- (($$) (ppr sty ty) (ppr sty (expandTy ty))) -- ToDo: rm
649 mkAlgAltMsg2 :: Type -> Id -> ErrMsg
650 mkAlgAltMsg2 ty con sty
652 text "In some algebraic case alternative, constructor is not a constructor of scrutinee type:",
657 mkAlgAltMsg3 :: Id -> [Id] -> ErrMsg
658 mkAlgAltMsg3 con alts sty
660 text "In some algebraic case alternative, number of arguments doesn't match constructor:",
665 mkAlgAltMsg4 :: Type -> Id -> ErrMsg
666 mkAlgAltMsg4 ty arg sty
668 text "In some algebraic case alternative, type of argument doesn't match data constructor:",
673 mkPrimAltMsg :: (Literal, CoreExpr) -> ErrMsg
676 (text "In a primitive case alternative, type of literal doesn't match type of scrutinee:")
679 mkRhsMsg :: Id -> Type -> ErrMsg
680 mkRhsMsg binder ty sty
682 [hsep [ptext SLIT("The type of this binder doesn't match the type of its RHS:"),
684 hsep [ptext SLIT("Binder's type:"), ppr sty (idType binder)],
685 hsep [ptext SLIT("Rhs type:"), ppr sty ty]]
687 mkRhsPrimMsg :: Id -> CoreExpr -> ErrMsg
688 mkRhsPrimMsg binder rhs sty
689 = vcat [hsep [ptext SLIT("The type of this binder is primitive:"),
691 hsep [ptext SLIT("Binder's type:"), ppr sty (idType binder)]
694 mkSpecTyAppMsg :: CoreArg -> ErrMsg
695 mkSpecTyAppMsg arg sty
697 (ptext SLIT("Unboxed types in a type application (after specialisation):"))
700 pp_expr :: PprStyle -> CoreExpr -> Doc
702 = pprCoreExpr sty (pprBigCoreBinder sty) (pprTypedCoreBinder sty) (pprTypedCoreBinder sty) expr