-checkInScope loc_msg var loc scope errs
- | isLocallyDefined var
- && not (var `elemVarSet` scope)
- && not (isId var && mayHaveNoBinding var)
- -- Micro-hack here... Class decls generate applications of their
- -- dictionary constructor, but don't generate a binding for the
- -- constructor (since it would never be used). After a single round
- -- of simplification, these dictionary constructors have been
- -- inlined (from their UnfoldInfo) to CoCons. Just between
- -- desugaring and simplfication, though, they appear as naked, unbound
- -- variables as the function in an application.
- -- The hack here simply doesn't check for out-of-scope-ness for
- -- data constructors (at least, in a function position).
- -- Ditto primitive Ids
- = (Nothing, addErr errs (hsep [ppr var, loc_msg]) loc)
+checkInScope loc_msg var loc scope errs warns
+ | mustHaveLocalBinding var && not (var `elemVarSet` scope)
+ = (Nothing, addErr errs (hsep [ppr var, loc_msg]) loc, warns)