summaryrefslogtreecommitdiff
path: root/testsuite/tests/rename/should_compile
diff options
context:
space:
mode:
authorAdam Gundry <adam@well-typed.com>2016-03-05 20:02:32 +0100
committerBen Gamari <ben@smart-cactus.org>2016-03-05 20:02:33 +0100
commitbd681bceba535d0e67e8182964dc167877e4756d (patch)
tree6f631ac256602860c5384fd797762661e1414cf9 /testsuite/tests/rename/should_compile
parent1d6177b133f3a6ac28cc8a679807563cfca3c56a (diff)
downloadhaskell-bd681bceba535d0e67e8182964dc167877e4756d.tar.gz
Drop module qualifier from punned record fields (#11662)
A record pattern match, construction or update like `Rec { Mod.f }` should expand to `Rec { Mod.f = f }` rather than `Rec { Mod.f = Mod.f }`. Test Plan: New test rename/should_compile/T11662 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: hesselink, thomie Differential Revision: https://phabricator.haskell.org/D1965 GHC Trac Issues: #11662
Diffstat (limited to 'testsuite/tests/rename/should_compile')
-rw-r--r--testsuite/tests/rename/should_compile/T11662.hs14
-rw-r--r--testsuite/tests/rename/should_compile/T11662_A.hs3
-rw-r--r--testsuite/tests/rename/should_compile/all.T4
3 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_compile/T11662.hs b/testsuite/tests/rename/should_compile/T11662.hs
new file mode 100644
index 0000000000..e9afda0f16
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T11662.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE NamedFieldPuns #-}
+module T11662 where
+
+import T11662_A (Rec (Rec))
+import qualified T11662_A
+
+g :: Rec -> Integer
+g (Rec { T11662_A.f }) = f
+
+h :: Integer -> Rec -> Rec
+h f r = r { T11662_A.f }
+
+k :: Integer -> Rec
+k f = Rec { T11662_A.f }
diff --git a/testsuite/tests/rename/should_compile/T11662_A.hs b/testsuite/tests/rename/should_compile/T11662_A.hs
new file mode 100644
index 0000000000..1d4f625bce
--- /dev/null
+++ b/testsuite/tests/rename/should_compile/T11662_A.hs
@@ -0,0 +1,3 @@
+module T11662_A where
+
+data Rec = Rec { f :: Integer }
diff --git a/testsuite/tests/rename/should_compile/all.T b/testsuite/tests/rename/should_compile/all.T
index 65f92e2779..ede9f19f74 100644
--- a/testsuite/tests/rename/should_compile/all.T
+++ b/testsuite/tests/rename/should_compile/all.T
@@ -233,3 +233,7 @@ test('T11164',
test('T11167', normal, compile, [''])
test('T11167_ambig', normal, compile, [''])
test('T10625', normal, compile, [''])
+test('T11662',
+ [extra_clean(['T11662_A.hi', 'T11662_A.o'])],
+ multimod_compile,
+ ['T11662', '-v0'])