Following up from the last commit in the constraint solver.
authorDimitrios.Vytiniotis <dimitris@microsoft.com>
Thu, 5 Apr 2012 21:11:18 +0000 (22:11 +0100)
committerDimitrios.Vytiniotis <dimitris@microsoft.com>
Thu, 5 Apr 2012 21:11:18 +0000 (22:11 +0100)
testsuite/tests/perf/compiler/all.T
testsuite/tests/typecheck/should_compile/T3108.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/all.T

index c3f4978..a599ccf 100644 (file)
@@ -123,7 +123,7 @@ test('T4801',
      [''])
 
 test('T3064',
-     [ expect_broken( 3064 ),
+     [# expect_broken( 3064 ),
       # expected value: 9 (x86/Linux 30-03-2011):
       if_wordsize(32,
           compiler_stats_num_field('peak_megabytes_allocated', 7, 12)),
diff --git a/testsuite/tests/typecheck/should_compile/T3108.hs b/testsuite/tests/typecheck/should_compile/T3108.hs
new file mode 100644 (file)
index 0000000..774d5f3
--- /dev/null
@@ -0,0 +1,37 @@
+{-# LANGUAGE OverlappingInstances, UndecidableInstances, MultiParamTypeClasses, 
+             FunctionalDependencies, FlexibleInstances #-}
+
+module T3108 where
+
+-- Direct recursion terminates (typechecking-wise)
+
+class C0 x
+ where
+ m0 :: x -> ()
+ m0 = const undefined
+
+instance (C0 x, C0 y) => C0 (x,y)
+instance C0 Bool
+instance C0 (x,Bool) => C0 x
+
+foo :: ()
+foo = m0 (1::Int)
+
+
+-- Indirect recursion does not terminate (typechecking-wise)
+
+class C1 x
+ where
+ m1 :: x -> ()
+ m1 = const undefined
+
+instance (C1 x, C1 y) => C1 (x,y)
+instance C1 Bool
+instance (C2 x y, C1 (y,Bool)) => C1 x
+
+class C2 x y | x -> y
+instance C2 Int Int
+
+-- It is this declaration that causes nontermination of typechecking.
+bar :: ()
+bar = m1 (1::Int)
index 76708bb..5fcd89f 100644 (file)
@@ -371,6 +371,7 @@ test('T5643', normal, compile, [''])
 test('T5595', normal, compile, [''])
 test('T5676', normal, compile, [''])
 test('T4310', normal, compile, [''])
+test('T3108', normal, compile, [''])
 
 test('T5792',normal,run_command,
      ['$MAKE -s --no-print-directory T5792'])