summaryrefslogtreecommitdiff
path: root/testsuite/tests/deSugar/should_compile
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-04-07 14:01:39 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2015-04-07 15:10:37 +0100
commitcfb60421a43f23e75ead85d99cec207a156f9312 (patch)
treed6dace38a82f43bbde1715b302185fbca9b4e0f4 /testsuite/tests/deSugar/should_compile
parent74d2c33a1f4ebe3de090bc73d08910bbdd31f8f1 (diff)
downloadhaskell-cfb60421a43f23e75ead85d99cec207a156f9312.tar.gz
Do not quantify over the function itself in a RULE
We were erroneously quantifying over the function when it had a dictionary type. A bit pathological, but possible. This fixes Trac #10251
Diffstat (limited to 'testsuite/tests/deSugar/should_compile')
-rw-r--r--testsuite/tests/deSugar/should_compile/T10251.hs41
-rw-r--r--testsuite/tests/deSugar/should_compile/all.T1
2 files changed, 42 insertions, 0 deletions
diff --git a/testsuite/tests/deSugar/should_compile/T10251.hs b/testsuite/tests/deSugar/should_compile/T10251.hs
new file mode 100644
index 0000000000..afca7fb9c7
--- /dev/null
+++ b/testsuite/tests/deSugar/should_compile/T10251.hs
@@ -0,0 +1,41 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# OPTIONS_GHC -O #-}
+module T10251 where
+
+data D = D
+data E = E
+
+class Storable a where
+ poke2 :: a -> E
+instance Storable D where
+ poke2 = poke2 -- undefined
+
+class Foo a where
+instance Foo D where
+
+class (Foo t, Storable t) => FooStorable t where
+
+instance FooStorable D where
+ {-# SPECIALIZE instance FooStorable D #-}
+
+{-# SPECIALIZE bug :: D -> E #-}
+
+bug
+ :: FooStorable t
+ => t
+ -> E
+bug = poke2
+{-
+sf 9160 # ghc -c -fforce-recomp -Wall B.hs
+
+ghc: panic! (the 'impossible' happened)
+ (GHC version 7.10.1 for x86_64-unknown-linux):
+ Template variable unbound in rewrite rule
+ $fFooStorableD_XU
+ [$fFooStorableD_XU]
+ [$fFooStorableD_XU]
+ []
+ []
+
+Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
+-}
diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T
index ac8f95c0c2..956f951151 100644
--- a/testsuite/tests/deSugar/should_compile/all.T
+++ b/testsuite/tests/deSugar/should_compile/all.T
@@ -103,3 +103,4 @@ test('T5252Take2',
test('T2431', normal, compile, ['-ddump-simpl -dsuppress-uniques'])
test('T7669', normal, compile, [''])
test('T8470', normal, compile, [''])
+test('T10251', normal, compile, [''])