summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-11-03 08:38:18 -0500
committerRyan Scott <ryan.gl.scott@gmail.com>2020-11-03 08:38:19 -0500
commit7cabae37b9e629def5dfe0239f5e641ce951571b (patch)
treef83a593a3e9ddaee89fd95c4720161632e827af0
parent1370eda7a53f5dfc88afe705b2ffecb1d5544ec7 (diff)
downloadhaskell-wip/T18920.tar.gz
Add a regression test for #18920wip/T18920
Commit f594a68a5500696d94ae36425bbf4d4073aca3b2 (`Use level numbers for generalisation`) ended up fixing #18920. Let's add a regression test to ensure that it stays fixed. Fixes #18920.
-rw-r--r--testsuite/tests/typecheck/should_compile/T18920.hs37
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T1
2 files changed, 38 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T18920.hs b/testsuite/tests/typecheck/should_compile/T18920.hs
new file mode 100644
index 0000000000..e529b920d2
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T18920.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE Rank2Types #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE GADTs #-}
+module T18920 where
+
+import Data.Kind
+
+class Monad solver => Solver solver where
+ type Constraint solver :: Type
+ type Label solver :: Type
+
+class Queue q
+
+data Tree s a where
+ NewVar :: Term s t => (t -> Tree s a) -> Tree s a
+
+class Solver solver => Term solver term
+
+class Transformer t where
+ type EvalState t :: Type
+ type TreeState t :: Type
+ type ForSolver t :: (Type -> Type)
+ type ForResult t :: Type
+ nextT :: SearchSig (ForSolver t) q t (ForResult t)
+ returnT :: ContinueSig solver q t (ForResult t)
+
+type ContinueSig solver q t a =
+ ( Solver solver, Queue q, Transformer t )
+ => Int -> q -> t -> EvalState t
+ -> solver (Int, [a])
+
+type SearchSig solver q t a =
+ (Solver solver, Queue q, Transformer t )
+ => Int -> Tree solver a -> q -> t -> EvalState t -> TreeState t
+ -> solver (Int,[a])
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index faac5bba9f..d02c3ee2fa 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -725,6 +725,7 @@ test('T18470', normal, compile, [''])
test('T18323', normal, compile, [''])
test('T18585', normal, compile, [''])
test('T18831', normal, compile, [''])
+test('T18920', normal, compile, [''])
test('T15942', normal, compile, [''])
test('ClassDefaultInHsBoot', [extra_files(['ClassDefaultInHsBootA1.hs','ClassDefaultInHsBootA2.hs','ClassDefaultInHsBootA2.hs-boot','ClassDefaultInHsBootA3.hs'])], multimod_compile, ['ClassDefaultInHsBoot', '-v0'])