Clone relevant constraints to avoid side-effects on HoleDests. Fixes #15370.
authorMatthías Páll Gissurarson <mpg@mpg.is>
Tue, 24 Jul 2018 21:57:48 +0000 (23:57 +0200)
committerBen Gamari <ben@smart-cactus.org>
Thu, 2 Aug 2018 02:45:04 +0000 (22:45 -0400)
commit588364c38530b51902d79d0175deed359796d172
tree97645734161aa72bf044e79a8f923ca07b226046
parente86db0d59dc2f9d8f4140c6b3052762a1ae82428
Clone relevant constraints to avoid side-effects on HoleDests. Fixes #15370.

Summary: When looking for valid hole fits, the constraints relevant
to the hole may sometimes contain a HoleDest. Previously,
these were not cloned, which could cause the filling of filled
coercion hole being, which would cause an assert to fail. This is now fixed.

Test Plan: Regression test included.

Reviewers: simonpj, bgamari, goldfire

Reviewed By: simonpj

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15370

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

(cherry picked from commit 0dc86f6bc454253969dedc31bed477eded4cf82d)
compiler/typecheck/TcHoleErrors.hs
compiler/typecheck/TcMType.hs
testsuite/tests/typecheck/should_compile/T15370.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T15370.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/all.T