import Bag
import Kind ( hasMoreBoxityInfo, Kind{-instance-} )
import Literal ( literalType, Literal{-instance-} )
-import Id ( idType, isBottomingId,
+import Id ( idType, isBottomingId, dataConRepType,
dataConArgTys, GenId{-instances-},
emptyIdSet, mkIdSet, intersectIdSets,
- unionIdSets, elementOfIdSet, IdSet(..)
+ unionIdSets, elementOfIdSet, SYN_IE(IdSet)
)
import Maybes ( catMaybes )
import Name ( isLocallyDefined, getSrcLoc, Name{-instance NamedThing-} )
import TyCon ( isPrimTyCon )
import TyVar ( tyVarKind, GenTyVar{-instances-} )
import Unique ( Unique )
-import Usage ( GenUsage )
+import Usage ( GenUsage, SYN_IE(Usage) )
import Util ( zipEqual, pprTrace, pprPanic, assertPanic, panic )
infixr 9 `thenL`, `seqL`, `thenMaybeL`, `seqMaybeL`
(addInScopeVars binders (lintCoreExpr body))
lintCoreExpr e@(Con con args)
- = lintCoreArgs {-False-} e unoverloaded_ty args
+ = lintCoreArgs {-False-} e (dataConRepType con) args
-- Note: we don't check for primitive types in these arguments
- where
- -- Constructors are special in that they aren't passed their
- -- dictionary arguments, so we swizzle them out of the
- -- constructor type before handing over to lintCorArgs
- unoverloaded_ty = mkForAllTys tyvars tau
- (tyvars, theta, tau) = splitSigmaTy (idType con)
lintCoreExpr e@(Prim op args)
= lintCoreArgs {-True-} e (primOpType op) args
lintCoreArg e ty (LitArg lit)
= -- Make sure function type matches argument
- case (getFunTyExpandingDicts_maybe ty) of
+ case (getFunTyExpandingDicts_maybe False{-no peeking in newtypes-} ty) of
Just (arg,res) | (lit_ty `eqTy` arg) -> returnL(Just res)
_ -> addErrL (mkAppMsg ty lit_ty e) `seqL` returnL Nothing
where
= -- Make sure variable is bound
checkInScope v `seqL`
-- Make sure function type matches argument
- case (getFunTyExpandingDicts_maybe ty) of
+ case (getFunTyExpandingDicts_maybe False{-as above-} ty) of
Just (arg,res) | (var_ty `eqTy` arg) -> returnL(Just res)
_ -> addErrL (mkAppMsg ty var_ty e) `seqL` returnL Nothing
where