-- Locality
ru_local :: Bool -- The fn at the head of the rule is
-- defined in the same module as the rule
+ -- and is not an implicit Id (like a record sel
+ -- class op, or data con)
+ -- NB: ru_local is *not* used to decide orphan-hood
+ -- c.g. MkIface.coreRuleToIfaceRule
}
| BuiltinRule { -- Built-in rules are used for constant folding
-- Substitute the dict bindings eagerly,
-- and take the body apart into a (f args) form
- { let local_rule = nameIsLocalOrFrom mod fn_name
- -- NB we can't use isLocalId in the orphan test,
- -- because isLocalId isn't true of class methods
+ { let local_rule = isLocalId fn_id
+ -- NB: isLocalId is False of implicit Ids. This is good becuase
+ -- we don't want to attach rules to the bindings of implicit Ids,
+ -- because they don't show up in the bindings until just before code gen
fn_name = idName fn_id
rule = Rule { ru_name = name, ru_fn = fn_name, ru_act = act,
; return (bndrs', args', rhs') }
; let mb_tcs = map ifTopFreeName args
; lcl <- getLclEnv
- ; let this_module = if_mod lcl
; returnM (Rule { ru_name = name, ru_fn = fn, ru_act = act,
ru_bndrs = bndrs', ru_args = args',
ru_rhs = rhs',
ru_rough = mb_tcs,
- ru_local = nameModule fn == this_module }) }
+ ru_local = False }) } -- An imported RULE is never for a local Id
+ -- or, even if it is (module loop, perhaps)
+ -- we'll just leave it in the non-local set
where
-- This function *must* mirror exactly what Rules.topFreeName does
-- We could have stored the ru_rough field in the iface file