summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/typecheck/should_compile/T14434.hs17
-rw-r--r--testsuite/tests/typecheck/should_compile/T14434.stdout2
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T1
3 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T14434.hs b/testsuite/tests/typecheck/should_compile/T14434.hs
new file mode 100644
index 0000000000..a0d0442fed
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T14434.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE MonoLocalBinds, FlexibleInstances, OverloadedStrings #-}
+{-# OPTIONS -fsolve-constant-dicts #-}
+
+module T14434 where
+
+class ToString a where
+ toString :: a -> String
+
+-- | This instance is used in original code as hack
+-- to simplify code generation
+instance {-# OVERLAPPABLE #-} ToString a where
+ toString _ = "Catchall attribute value"
+
+toStringX :: (ToString a) => a -> String
+toStringX = toString
+ -- Here we do /not/ want to solve the ToString
+ -- constraint with the local instance
diff --git a/testsuite/tests/typecheck/should_compile/T14434.stdout b/testsuite/tests/typecheck/should_compile/T14434.stdout
new file mode 100644
index 0000000000..f1436e3959
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T14434.stdout
@@ -0,0 +1,2 @@
+toStringX :: forall a. ToString a => a -> String
+toStringX = toString
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index e799a45669..03e70915d4 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -581,3 +581,4 @@ test('T14333', normal, compile, [''])
test('T14363', normal, compile, [''])
test('T14363a', normal, compile, [''])
test('T7169', normal, compile, [''])
+test('T14434', [], run_command, ['$MAKE -s --no-print-directory T14434'])