• Matthías Páll Gissurarson's avatar
    Sort valid substitutions for typed holes by "relevance" · cbdea959
    Matthías Páll Gissurarson authored
    This is an initial attempt at tackling the issue of how to order the
    suggestions provided by the valid substitutions checker, by sorting
    them by creating a graph of how they subsume each other. We'd like to
    order them in such a manner that the most "relevant" suggestions are
    displayed first, so that the suggestion that the user might be looking
    for is displayed before more far-fetched suggestions (and thus also
    displayed when they'd otherwise be cut-off by the
    `-fmax-valid-substitutions` limit). The previous ordering was based on
    the order in which the elements appear in the list of imports, which I
    believe is less correlated with relevance than this ordering.
    A drawback of this approach is that, since we now want to sort the
    elements, we can no longer "bail out early" when we've hit the
    `-fmax-valid-substitutions` limit.
    Reviewers: bgamari, dfeuer
    Reviewed By: dfeuer
    Subscribers: dfeuer, rwbarton, thomie, carter
    Differential Revision: https://phabricator.haskell.org/D4326
TcErrors.hs 133 KB