Test Trac #7862
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 11 Nov 2014 13:06:21 +0000 (13:06 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 11 Nov 2014 13:06:21 +0000 (13:06 +0000)
testsuite/tests/indexed-types/should_fail/T7862.hs [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/T7862.stderr [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/all.T

diff --git a/testsuite/tests/indexed-types/should_fail/T7862.hs b/testsuite/tests/indexed-types/should_fail/T7862.hs
new file mode 100644 (file)
index 0000000..98b99ab
--- /dev/null
@@ -0,0 +1,19 @@
+{-# LANGUAGE TypeFamilies, FlexibleContexts #-}
+
+module T7862 where
+
+type family Scalar t
+
+newtype Tower s a = Tower [a]
+
+type instance Scalar (Tower s a) = a
+
+class (Num (Scalar t), Num t) => Mode t where
+    (<+>) :: t -> t -> t
+
+instance (Num a) => Mode (Tower s a) where
+    Tower as <+> _ = undefined
+      where
+        _ = (Tower as) <+> (Tower as)
+
+instance Num a => Num (Tower s a) where
diff --git a/testsuite/tests/indexed-types/should_fail/T7862.stderr b/testsuite/tests/indexed-types/should_fail/T7862.stderr
new file mode 100644 (file)
index 0000000..c2583d8
--- /dev/null
@@ -0,0 +1,17 @@
+
+T7862.hs:17:24:
+    Overlapping instances for Num (Tower s0 a)
+      arising from a use of ‘<+>’
+    Matching givens (or their superclasses):
+      (Num (Tower s a))
+        bound by the instance declaration at T7862.hs:14:10-36
+    Matching instances:
+      instance Num a => Num (Tower s a) -- Defined at T7862.hs:19:10
+    (The choice depends on the instantiation of ‘a, s0’)
+    In the expression: (Tower as) <+> (Tower as)
+    In a pattern binding: _ = (Tower as) <+> (Tower as)
+    In an equation for ‘<+>’:
+        (Tower as) <+> _
+          = undefined
+          where
+              _ = (Tower as) <+> (Tower as)
index 0fbee70..286360a 100644 (file)
@@ -130,4 +130,4 @@ test('T9433', normal, compile_fail, [''])
 test('BadSock', normal, compile_fail, [''])
 test('T9580', normal, multimod_compile_fail, ['T9580', ''])
 test('T9662', normal, compile_fail, [''])
-
+test('T7862', normal, compile_fail, [''])