Commit a1ca534a authored by Joachim Breitner's avatar Joachim Breitner
Browse files

Test cases for context stack overflow

one for constraints, one for type families
parent ea3c659e
{-# LANGUAGE UndecidableInstances, FlexibleInstances #-}
module ContextStack1 where
class Cls a where meth :: a
instance Cls [a] => Cls a
t :: ()
t = meth
ContextStack1.hs:10:5:
Context reduction stack overflow; size = 11
Use -fcontext-stack=N to increase stack size to N
Cls [[[[[[[[[[[()]]]]]]]]]]]
In the expression: meth
In an equation for ‛t’: t = meth
{-# LANGUAGE AllowAmbiguousTypes, TypeFamilies #-}
module ContextStack2 where
type family TF a :: *
type instance TF (a,b) = (TF a, TF b)
t :: (a ~ TF (a,Int)) => Int
t = undefined
ContextStack2.hs:8:6:
Context reduction stack overflow; size = 11
Use -fcontext-stack=N to increase stack size to N
(TF (TF (TF (TF (TF (TF (TF (TF (TF (TF (TF a)))))))))),
TF (TF (TF (TF (TF (TF (TF (TF (TF (TF (TF Int)))))))))))
~ TF (TF (TF (TF (TF (TF (TF (TF (TF (TF a)))))))))
In the ambiguity check for: forall a. a ~ TF (a, Int) => Int
In the type signature for ‛t’: t :: a ~ TF (a, Int) => Int
......@@ -325,3 +325,5 @@ test('T8392a', normal, compile_fail, [''])
test('T8428', normal, compile_fail, [''])
test('T8450', normal, compile_fail, [''])
test('T8514', normal, compile_fail, [''])
test('ContextStack1', normal, compile_fail, ['-fcontext-stack=10'])
test('ContextStack2', normal, compile_fail, ['-fcontext-stack=10'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment