diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-07-05 13:46:29 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-07-05 16:24:12 +0100 |
commit | 895eefa8447a2886e77fdedcbca8047263c88db7 (patch) | |
tree | 067b91d5b15a370e5f059413d098dacdb50c7ab0 /testsuite/tests/deriving | |
parent | 5f79394f628259403edf612ef109d8c0f4d7e67a (diff) | |
download | haskell-895eefa8447a2886e77fdedcbca8047263c88db7.tar.gz |
Make unique auxiliary function names in deriving
In deriving for Data, we make some auxiliary functions, but they
didn't always get distinct names (Trac #12245). This patch fixes
it by using the same mechanism as for dictionary functions, namely
chooseUniqueOccTc.
Some assocated refactoring came along for the ride.
Diffstat (limited to 'testsuite/tests/deriving')
-rw-r--r-- | testsuite/tests/deriving/should_compile/T12245.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/deriving/should_compile/all.T | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/testsuite/tests/deriving/should_compile/T12245.hs b/testsuite/tests/deriving/should_compile/T12245.hs new file mode 100644 index 0000000000..21e271792a --- /dev/null +++ b/testsuite/tests/deriving/should_compile/T12245.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE FlexibleInstances #-} + +module T12245 where + +import Data.Data ( Data ) + +data Foo f = Foo (f Bool) (f Int) + +deriving instance Data (Foo []) +deriving instance Data (Foo Maybe) diff --git a/testsuite/tests/deriving/should_compile/all.T b/testsuite/tests/deriving/should_compile/all.T index 9017687b07..a81c4ce2d7 100644 --- a/testsuite/tests/deriving/should_compile/all.T +++ b/testsuite/tests/deriving/should_compile/all.T @@ -70,4 +70,4 @@ test('T11732a', normal, compile, ['']) test('T11732b', normal, compile, ['']) test('T11732c', normal, compile, ['']) test('T11833', normal, compile, ['']) -test('T11837', normal, compile, ['']) +test('T12245', normal, compile, ['']) |