summaryrefslogtreecommitdiff
path: root/testsuite/tests/overloadedrecflds
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2016-10-08 10:06:01 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2016-10-08 10:07:14 +0100
commite660f4bf546e90fb6719ad268ca3daaecdce4b82 (patch)
tree7c23ed1a6983d951c8950f8105d3889914619d81 /testsuite/tests/overloadedrecflds
parent46b78e604c06c8878e436fea93729158dcf55269 (diff)
downloadhaskell-e660f4bf546e90fb6719ad268ca3daaecdce4b82.tar.gz
Rework renaming of children in export lists.
The target of this patch is exports such as: ``` module Foo ( T(A, B, C) ) where ``` Essentially this patch makes sure that we use the correct lookup functions in order to lookup the names in parent-children export lists. This change highlighted the complexity of this small part of GHC which accounts for the scale. This change was motivated by wanting to remove the `PatternSynonym` constructor from `Parent`. As with all these things, it quickly spiraled out of control into a much larger refactor. Reviewers: simonpj, goldfire, bgamari, austin Subscribers: adamgundry, thomie Differential Revision: https://phabricator.haskell.org/D2179 GHC Trac Issues: #11970
Diffstat (limited to 'testsuite/tests/overloadedrecflds')
-rw-r--r--testsuite/tests/overloadedrecflds/should_fail/NoParent.hs6
-rw-r--r--testsuite/tests/overloadedrecflds/should_fail/NoParent.stderr6
-rw-r--r--testsuite/tests/overloadedrecflds/should_fail/all.T1
3 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/tests/overloadedrecflds/should_fail/NoParent.hs b/testsuite/tests/overloadedrecflds/should_fail/NoParent.hs
new file mode 100644
index 0000000000..2d05c4758e
--- /dev/null
+++ b/testsuite/tests/overloadedrecflds/should_fail/NoParent.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE DuplicateRecordFields #-}
+module NoParent (A(x)) where
+
+data A = A
+data B = B { x :: Int }
+data C = C { x :: String }
diff --git a/testsuite/tests/overloadedrecflds/should_fail/NoParent.stderr b/testsuite/tests/overloadedrecflds/should_fail/NoParent.stderr
new file mode 100644
index 0000000000..309536cede
--- /dev/null
+++ b/testsuite/tests/overloadedrecflds/should_fail/NoParent.stderr
@@ -0,0 +1,6 @@
+
+NoParent.hs:2:18: error:
+ • The type constructor ‘A’ is not the parent of the record selector ‘x’.
+ Record selectors can only be exported with their parent type constructor.
+ Parents: C, B
+ • In the export: A(x)
diff --git a/testsuite/tests/overloadedrecflds/should_fail/all.T b/testsuite/tests/overloadedrecflds/should_fail/all.T
index 362640539e..b7d1bff336 100644
--- a/testsuite/tests/overloadedrecflds/should_fail/all.T
+++ b/testsuite/tests/overloadedrecflds/should_fail/all.T
@@ -30,3 +30,4 @@ test('T11167_ambiguous_fixity',
extra_clean([ 'T11167_ambiguous_fixity_A.hi', 'T11167_ambiguous_fixity_A.o'
, 'T11167_ambiguous_fixity_B.hi', 'T11167_ambiguous_fixity_B.o' ]),
multimod_compile_fail, ['T11167_ambiguous_fixity', ''])
+test('NoParent', normal, compile_fail, [''])