[commit: ghc] master: Include OverloadedRecordFields selectors in NameShape. (8f8016a)
git at git.haskell.org
git at git.haskell.org
Thu Feb 23 23:16:39 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/8f8016a5cb006fe14e1058c01a215b90e8435cc8/ghc
>---------------------------------------------------------------
commit 8f8016a5cb006fe14e1058c01a215b90e8435cc8
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date: Wed Feb 22 21:59:59 2017 -0800
Include OverloadedRecordFields selectors in NameShape.
Summary:
Fixes #13323.
Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
Test Plan: validate
Reviewers: bgamari, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3175
>---------------------------------------------------------------
8f8016a5cb006fe14e1058c01a215b90e8435cc8
compiler/backpack/NameShape.hs | 2 +-
testsuite/tests/backpack/should_compile/T13323.bkp | 17 +++++++++++++++++
testsuite/tests/backpack/should_compile/T13323.stderr | 13 +++++++++++++
testsuite/tests/backpack/should_compile/all.T | 1 +
4 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/compiler/backpack/NameShape.hs b/compiler/backpack/NameShape.hs
index 9817854..261fffb 100644
--- a/compiler/backpack/NameShape.hs
+++ b/compiler/backpack/NameShape.hs
@@ -83,7 +83,7 @@ mkNameShape :: ModuleName -> [AvailInfo] -> NameShape
mkNameShape mod_name as =
NameShape mod_name as $ mkOccEnv $ do
a <- as
- n <- availName a : availNames a
+ n <- availName a : availNamesWithSelectors a
return (occName n, n)
-- | Given an existing 'NameShape', merge it with a list of 'AvailInfo's
diff --git a/testsuite/tests/backpack/should_compile/T13323.bkp b/testsuite/tests/backpack/should_compile/T13323.bkp
new file mode 100644
index 0000000..70a1ccf
--- /dev/null
+++ b/testsuite/tests/backpack/should_compile/T13323.bkp
@@ -0,0 +1,17 @@
+{-# LANGUAGE DuplicateRecordFields #-}
+unit p where
+ signature A where
+ data A = A { foo :: Int }
+ data B = B { foo :: Bool }
+ module P where
+ import A
+ x :: A -> Int
+ x = foo
+unit q where
+ module A where
+ data A = A { foo :: Int }
+ data B = B { foo :: Bool }
+unit r where
+ dependency p[A=q:A]
+ module R where
+ import P
diff --git a/testsuite/tests/backpack/should_compile/T13323.stderr b/testsuite/tests/backpack/should_compile/T13323.stderr
new file mode 100644
index 0000000..3d6a510
--- /dev/null
+++ b/testsuite/tests/backpack/should_compile/T13323.stderr
@@ -0,0 +1,13 @@
+[1 of 3] Processing p
+ [1 of 2] Compiling A[sig] ( p/A.hsig, nothing )
+ [2 of 2] Compiling P ( p/P.hs, nothing )
+[2 of 3] Processing q
+ Instantiating q
+ [1 of 1] Compiling A ( q/A.hs, T13323.out/q/A.o )
+[3 of 3] Processing r
+ Instantiating r
+ [1 of 1] Including p[A=q:A]
+ Instantiating p[A=q:A]
+ [1 of 2] Compiling A[sig] ( p/A.hsig, T13323.out/p/p-HVmFlcYSefiK5n1aDP1v7x/A.o )
+ [2 of 2] Compiling P ( p/P.hs, T13323.out/p/p-HVmFlcYSefiK5n1aDP1v7x/P.o )
+ [1 of 1] Compiling R ( r/R.hs, T13323.out/r/R.o )
diff --git a/testsuite/tests/backpack/should_compile/all.T b/testsuite/tests/backpack/should_compile/all.T
index 683d913..8f4ec3b 100644
--- a/testsuite/tests/backpack/should_compile/all.T
+++ b/testsuite/tests/backpack/should_compile/all.T
@@ -47,3 +47,4 @@ test('bkp52', normal, backpack_compile, [''])
test('T13149', expect_broken(13149), backpack_compile, [''])
test('T13214', normal, backpack_compile, [''])
+test('T13323', normal, backpack_compile, [''])
More information about the ghc-commits
mailing list