Skip to content
  • Ömer Sinan Ağacan's avatar
    Fix a performance issue with -fprint-expanded-synonyms · e4834edf
    Ömer Sinan Ağacan authored
    The type synonym expander was doing redundant work by looking at same
    types again and again. This patch fixes the loop code when both of the
    types can be expanded, to do `O(min(n, m))` comparisons and `O(n + m)`
    expansions, where `n` is expansions of the first type and `m` is
    expansions of the second type.
    
    Reported by sjcjoosten in T10547.
    
    Test Plan:
    Added a regression test that was taking several minutes to type check
    before this patch.
    
    Reviewers: bgamari, simonpj, austin, ezyang
    
    Reviewed By: bgamari, simonpj, austin, ezyang
    
    Subscribers: simonpj, thomie
    
    Differential Revision: https://phabricator.haskell.org/D2198
    
    GHC Trac Issues: #10547
    e4834edf