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 05:49:40 +0000 (00:49 -0500)
commit1e14fd3ecfd468c3beddb2e5f992c358e1a798de
tree080300ea965349584307202930ef7d1cbd8e5c1f
parent6b1ff0098e7595d5f3b8e6ad7c5d8e4104b02445
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
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