Add built-in syntax suggestions, and refactor to allow library use
authorMatthías Páll Gissurarson <pallm@chalmers.se>
Thu, 1 Nov 2018 22:32:32 +0000 (18:32 -0400)
committerBen Gamari <ben@smart-cactus.org>
Thu, 1 Nov 2018 22:36:08 +0000 (18:36 -0400)
commit1c92f193ee406545daedd06e0b9d5d7354d9af64
treeed3e5193a71107445af87f911cab779a22a0d5f2
parent695f1f2fe03d71bad47d52f003881b34eb5083b4
Add built-in syntax suggestions, and refactor to allow library use

Summary:
This change to the valid hole fits adds built-in syntax candidates (like (:) and []),
so that they are checked in addition to what is in scope.

The rest is merely a refactor and export of the functions used to find the valid
hole fits, since there was interest at ICFP to use the valid hole fit machinery for
additional uses. By exporting the `tcFilterHoleFits` function, this can now be done
without having to rely on parsing the actual error message.

Test Plan: Test for built-in syntax included

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: RyanGlScott, rwbarton, carter

Differential Revision: https://phabricator.haskell.org/D5227
12 files changed:
compiler/typecheck/TcHoleErrors.hs
testsuite/tests/typecheck/should_compile/T14273.stderr
testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr
testsuite/tests/typecheck/should_compile/constraint_hole_fits.stderr
testsuite/tests/typecheck/should_compile/hole_constraints.stderr
testsuite/tests/typecheck/should_compile/holes.stderr
testsuite/tests/typecheck/should_compile/holes2.stderr
testsuite/tests/typecheck/should_compile/holes3.stderr
testsuite/tests/typecheck/should_compile/refinement_hole_fits.stderr
testsuite/tests/typecheck/should_compile/type_in_type_hole_fits.stderr
testsuite/tests/typecheck/should_compile/valid_hole_fits.hs
testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr