Inform hole substitutions of typeclass constraints (fixes #14273).
authorMatthías Páll Gissurarson <mpg@mpg.is>
Thu, 18 Jan 2018 05:49:38 +0000 (00:49 -0500)
committerBen Gamari <ben@smart-cactus.org>
Thu, 18 Jan 2018 19:20:28 +0000 (14:20 -0500)
commit96b52e63b850f8072b905ca232b5644efc011b37
tree947cc50992732dfeb5ed1270c6b5d1df19c8b3fd
parentda83722c503a2f032bf21b386b8021c0794d4176
Inform hole substitutions of typeclass constraints (fixes  #14273).

This implements SPJ's suggestion on the ticket (#14273). We find the
relevant constraints (ones that whose free unification variables are all
mentioned in the type of the hole), and then clone the free unification
variables of the hole and the relevant constraints. We then add a
subsumption constraints and run the simplifier, and then check whether
all the constraints were solved.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: RyanGlScott, rwbarton, thomie, carter

GHC Trac Issues: #14273

Differential Revision: https://phabricator.haskell.org/D4315

(cherry picked from commit 1e14fd3ecfd468c3beddb2e5f992c358e1a798de)
25 files changed:
compiler/typecheck/TcErrors.hs
compiler/typecheck/TcRnTypes.hs
compiler/typecheck/TcSimplify.hs
compiler/typecheck/TcSimplify.hs-boot
testsuite/tests/ghci/scripts/T8353.stderr
testsuite/tests/th/T10267.stderr
testsuite/tests/th/all.T
testsuite/tests/typecheck/should_compile/T13050.stderr
testsuite/tests/typecheck/should_compile/T14273.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T14273.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T14590.stderr
testsuite/tests/typecheck/should_compile/T9497a.stderr
testsuite/tests/typecheck/should_compile/all.T
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/valid_substitutions.hs
testsuite/tests/typecheck/should_compile/valid_substitutions.stderr
testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/valid_substitutions_interactions.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T9497d.stderr
testsuite/tests/typecheck/should_run/T9497a-run.stderr
testsuite/tests/typecheck/should_run/T9497b-run.stderr
testsuite/tests/typecheck/should_run/T9497c-run.stderr