• Edward Z. Yang's avatar
    Filter orphan rules based on imports, fixes #10294 and #10420. · 0cb1f5cf
    Edward Z. Yang authored
    If we have an orphan rule in our database, don't apply it
    unless the defining module is transitively imported by the
    module we are processing.  We do this by defining a new RuleEnv
    data type which includes both the RuleBase as well as the set
    of visible orphan modules, and threading this through the
    relevant environments (CoreReader, RuleCheckEnv and ScEnv).
    This is analogous to the instances fix we applied in #2182
    , but done for RULES.
    An important knock-on effect is that we can remove some buggy
    code in LoadInterface which tried to avoid loading interfaces
    that were loaded by plugins (which sometimes caused instances
    and rules to NEVER become visible).
    One note about tests: I renamed the old plugins07 test to T10420
    and replaced plugins07 with a test to ensure that a plugin
    import did not cause new rules to be loaded in.
    Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
    Test Plan: validate
    Reviewers: simonpj, austin, goldfire
    Subscribers: bgamari, thomie
    Differential Revision: https://phabricator.haskell.org/D950
    GHC Trac Issues: #10420
TcIface.hs 61.5 KB