From 5bdfdd139e5aff57631e9f1c6654dc7b8590c63f Mon Sep 17 00:00:00 2001
From: Simon Peyton Jones <simonpj@microsoft.com>
Date: Tue, 28 Apr 2020 09:45:09 +0100
Subject: [PATCH] Add tests for #17873

---
 .../tests/typecheck/should_compile/T17873.hs      | 15 +++++++++++++++
 testsuite/tests/typecheck/should_compile/all.T    |  1 +
 2 files changed, 16 insertions(+)
 create mode 100644 testsuite/tests/typecheck/should_compile/T17873.hs

diff --git a/testsuite/tests/typecheck/should_compile/T17873.hs b/testsuite/tests/typecheck/should_compile/T17873.hs
new file mode 100644
index 000000000000..3372f62bfd81
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T17873.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE ImplicitParams #-}
+
+module T17873 where
+
+-- With GHC 8.8 this failed with a nonsense message
+--    Couldn't match type ‘?x::Bool -> Bool’ with ‘Bool’
+--      Expected type: Bool -> Bool -> Bool
+--      Actual type: (?x::Bool -> Bool) => Bool -> Bool
+
+-- With eager instantiation, it's fine.
+
+getx :: (?x :: Bool -> Bool) => Bool -> Bool
+getx = ?x
+
+z3 = (let ?x = not in getx) False
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index a7825b9f5441..03389993ddff 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -705,3 +705,4 @@ test('T18005', normal, compile, [''])
 test('T18023', normal, compile, [''])
 test('T18036', normal, compile, [''])
 test('T18036a', normal, compile, [''])
+test('T17873', normal, compile, [''])
-- 
GitLab