diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-11-03 08:38:18 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-05 00:51:01 -0500 |
commit | 2125b1d6bea0c620e3a089603dace6bb38020c81 (patch) | |
tree | e720cfc772490b405142d1246365db6e1c4a884f | |
parent | 17d5c51834d64f1762320b7abaa40c5686564f4d (diff) | |
download | haskell-2125b1d6bea0c620e3a089603dace6bb38020c81.tar.gz |
Add a regression test for #18920
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.hs | 37 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/all.T | 1 |
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']) |