diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/rename/should_compile/T17853.hs | 17 | ||||
-rw-r--r-- | testsuite/tests/rename/should_compile/T17853A.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/rename/should_compile/all.T | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_compile/T17853.hs b/testsuite/tests/rename/should_compile/T17853.hs new file mode 100644 index 0000000000..c44ae4a303 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T17853.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE DisambiguateRecordFields #-} +{-# OPTIONS_GHC -Werror=unused-imports #-} +module T17853 where + +-- All the imports of T17853A are necessary, so they should not be reported as +-- redundant. DisambiguateRecordFields has special logic for looking up field +-- labels in record field construction because the module qualifier is optional. +-- Previously this incorrectly reported imports as redundant if they were used +-- only for fields that were in scope under a different prefix (see #17853). +import qualified T17853A +import qualified T17853A as X (X(..)) +import qualified T17853A as Y (Y(..)) + +main :: IO () +main = do + print T17853A.X { X.name = "hello" } + print T17853A.Y { Y.age = 3 } diff --git a/testsuite/tests/rename/should_compile/T17853A.hs b/testsuite/tests/rename/should_compile/T17853A.hs new file mode 100644 index 0000000000..0d757a5af3 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T17853A.hs @@ -0,0 +1,4 @@ +module T17853A where + +data X = X { name :: String } deriving Show +data Y = Y { age :: Int } deriving Show diff --git a/testsuite/tests/rename/should_compile/all.T b/testsuite/tests/rename/should_compile/all.T index 92f186075e..71d631e499 100644 --- a/testsuite/tests/rename/should_compile/all.T +++ b/testsuite/tests/rename/should_compile/all.T @@ -177,3 +177,4 @@ test('T17837', normal, compile, ['']) test('T18497', [], makefile_test, ['T18497']) test('T18264', [], makefile_test, ['T18264']) test('T18302', expect_broken(18302), compile, ['']) +test('T17853', [], multimod_compile, ['T17853', '-v0']) |