From 5248fdf75d1e5b5d097cd86af8e230dc5844f4ca Mon Sep 17 00:00:00 2001
From: Zubin Duggal <zubin.duggal@gmail.com>
Date: Mon, 28 Aug 2023 15:00:14 +0530
Subject: [PATCH] testsuite: Add regression test for #23861

Simon says this was fixed by

commit 8d68685468d0b6e922332a3ee8c7541efbe46137
Author: sheaf <sam.derbyshire@gmail.com>
Date:   Fri Aug 4 15:28:45 2023 +0200

    Remove zonk in tcVTA
---
 testsuite/tests/typecheck/should_compile/T23861.hs | 13 +++++++++++++
 testsuite/tests/typecheck/should_compile/all.T     |  1 +
 2 files changed, 14 insertions(+)
 create mode 100644 testsuite/tests/typecheck/should_compile/T23861.hs

diff --git a/testsuite/tests/typecheck/should_compile/T23861.hs b/testsuite/tests/typecheck/should_compile/T23861.hs
new file mode 100644
index 000000000000..a2b7a8077d4b
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T23861.hs
@@ -0,0 +1,13 @@
+module M where
+
+newtype GetDiscardingUnlift a = MkGetDiscardingUnlift
+    { unGetDiscardingUnlift :: forall m. Either a m
+    }
+
+build :: forall a. a -> GetDiscardingUnlift a
+build w =
+    case build w of
+        MkGetDiscardingUnlift getDiscardingUnlift' ->
+         let getDiscardingUnlift'' :: forall m. Either a m
+             getDiscardingUnlift'' = getDiscardingUnlift' @m
+         in  MkGetDiscardingUnlift getDiscardingUnlift''
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index 0b98018f813e..a842adc21a95 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -891,3 +891,4 @@ test('T18986b', normal, compile, [''])
 test('T23413', normal, compile, [''])
 test('TcIncompleteRecSel', normal, compile, ['-Wincomplete-record-selectors'])
 test('InstanceWarnings', normal, multimod_compile, ['InstanceWarnings', ''])
+test('T23861', normal, compile, [''])
-- 
GitLab