summaryrefslogtreecommitdiff
path: root/testsuite/tests/patsyn
diff options
context:
space:
mode:
authorAdam Gundry <adam@well-typed.com>2020-10-02 20:23:27 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-12-24 16:34:49 -0500
commit6f8bafb4fbddd2c8a113f5ddb04636a3a1be9355 (patch)
tree7169b8ce5f972892c498c30ee48db2028e76edac /testsuite/tests/patsyn
parent9809474462527d36b9e237ee7012b08e0845b714 (diff)
downloadhaskell-6f8bafb4fbddd2c8a113f5ddb04636a3a1be9355.tar.gz
Refactor renamer datastructures
This patch significantly refactors key renamer datastructures (primarily Avail and GlobalRdrElt) in order to treat DuplicateRecordFields in a more robust way. In particular it allows the extension to be used with pattern synonyms (fixes where mangled record selector names could be printed instead of field labels (e.g. with -Wpartial-fields or hole fits, see new tests). The key idea is the introduction of a new type GreName for names that may represent either normal entities or field labels. This is then used in GlobalRdrElt and AvailInfo, in place of the old way of representing fields using FldParent (yuck) and an extra list in AvailTC. Updates the haddock submodule.
Diffstat (limited to 'testsuite/tests/patsyn')
-rw-r--r--testsuite/tests/patsyn/should_compile/T11959.stderr3
-rw-r--r--testsuite/tests/patsyn/should_compile/T14630.hs16
-rw-r--r--testsuite/tests/patsyn/should_compile/all.T3
3 files changed, 21 insertions, 1 deletions
diff --git a/testsuite/tests/patsyn/should_compile/T11959.stderr b/testsuite/tests/patsyn/should_compile/T11959.stderr
new file mode 100644
index 0000000000..4645f33641
--- /dev/null
+++ b/testsuite/tests/patsyn/should_compile/T11959.stderr
@@ -0,0 +1,3 @@
+
+T11959Lib.hs:2:35: warning: [-Wduplicate-exports (in -Wdefault)]
+ ‘:>’ is exported by ‘pattern (:>)’ and ‘Vec2(Nil, (:>))’
diff --git a/testsuite/tests/patsyn/should_compile/T14630.hs b/testsuite/tests/patsyn/should_compile/T14630.hs
new file mode 100644
index 0000000000..04aee67038
--- /dev/null
+++ b/testsuite/tests/patsyn/should_compile/T14630.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE NamedFieldPuns #-}
+
+module T14630 where
+
+pattern Tuple :: a -> b -> (a, b)
+pattern Tuple{x, y} = (x, y)
+
+{-# COMPLETE Tuple #-}
+
+f :: (a, b) -> a
+f Tuple{x} = x
+
+g :: (Int, Int) -> Int
+g Tuple{..} = x + y
diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T
index 75be0c68b2..defb2ac52b 100644
--- a/testsuite/tests/patsyn/should_compile/all.T
+++ b/testsuite/tests/patsyn/should_compile/all.T
@@ -53,7 +53,7 @@ test('T11367', normal, compile, [''])
test('T11351', normal, compile, [''])
test('T11633', normal, compile, [''])
test('T11727', normal, compile, [''])
-test('T11959', expect_broken(11959), multimod_compile, ['T11959', '-v0'])
+test('T11959', normal, multimod_compile, ['T11959', '-v0'])
test('T12094', normal, compile, [''])
test('T11977', normal, compile, [''])
test('T12108', normal, compile, [''])
@@ -79,3 +79,4 @@ test('T14498', normal, compile, [''])
test('T16682', [extra_files(['T16682.hs', 'T16682a.hs'])],
multimod_compile, ['T16682', '-v0 -fwarn-incomplete-patterns -fno-code'])
test('T17775-singleton', normal, compile, [''])
+test('T14630', normal, compile, ['-Wname-shadowing'])