summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2019-10-10 14:33:10 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-10-12 06:33:42 -0400
commit0a338264054a518ddc2ab7920af4489a38c8a214 (patch)
treeb8537571b1caa8bf71aae787fc9dcdd6fac9f380 /testsuite
parentcd1a8808031de162fe92b04de905d59886595abb (diff)
downloadhaskell-0a338264054a518ddc2ab7920af4489a38c8a214.tar.gz
Use newDFunName for both manual and derived instances (#17339)
Issue #17339 was caused by using a slightly different version of `newDFunName` for derived instances that, confusingly enough, did not take all arguments to the class into account when generating the `DFun` name. I cannot think of any good reason for doing this, so this patch uses `newDFunName` uniformly for both derived instances and manually written instances alike. Fixes #17339.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/deriving/should_compile/T17339.hs17
-rw-r--r--testsuite/tests/deriving/should_compile/T17339.stderr23
-rw-r--r--testsuite/tests/deriving/should_compile/all.T2
3 files changed, 42 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_compile/T17339.hs b/testsuite/tests/deriving/should_compile/T17339.hs
new file mode 100644
index 0000000000..4312d2ffc4
--- /dev/null
+++ b/testsuite/tests/deriving/should_compile/T17339.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE DeriveAnyClass #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE StandaloneDeriving #-}
+module T17339 where
+
+class Cls a b
+data A1
+data A2
+data B1
+data B2
+
+instance Cls A1 B1
+instance Cls A2 B1
+
+deriving anyclass instance Cls A1 B2
+deriving anyclass instance Cls A2 B2
diff --git a/testsuite/tests/deriving/should_compile/T17339.stderr b/testsuite/tests/deriving/should_compile/T17339.stderr
new file mode 100644
index 0000000000..68da373ae4
--- /dev/null
+++ b/testsuite/tests/deriving/should_compile/T17339.stderr
@@ -0,0 +1,23 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core
+ = {terms: 8, types: 20, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 1, types: 2, coercions: 0, joins: 0/0}
+T17339.$fClsA1B1 :: Cls A1 B1
+T17339.$fClsA1B1 = T17339.C:Cls @ A1 @ B1
+
+-- RHS size: {terms: 1, types: 2, coercions: 0, joins: 0/0}
+T17339.$fClsA2B1 :: Cls A2 B1
+T17339.$fClsA2B1 = T17339.C:Cls @ A2 @ B1
+
+-- RHS size: {terms: 1, types: 2, coercions: 0, joins: 0/0}
+T17339.$fClsA1B2 :: Cls A1 B2
+T17339.$fClsA1B2 = T17339.C:Cls @ A1 @ B2
+
+-- RHS size: {terms: 1, types: 2, coercions: 0, joins: 0/0}
+T17339.$fClsA2B2 :: Cls A2 B2
+T17339.$fClsA2B2 = T17339.C:Cls @ A2 @ B2
+
+
+
diff --git a/testsuite/tests/deriving/should_compile/all.T b/testsuite/tests/deriving/should_compile/all.T
index 04fd02518f..55c7d90f09 100644
--- a/testsuite/tests/deriving/should_compile/all.T
+++ b/testsuite/tests/deriving/should_compile/all.T
@@ -119,3 +119,5 @@ test('T15831', normal, compile, [''])
test('T16179', normal, compile, [''])
test('T16518', normal, compile, [''])
test('T17324', normal, compile, [''])
+test('T17339', normal, compile,
+ ['-ddump-simpl -dsuppress-idinfo -dno-typeable-binds'])