diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-06-02 00:02:03 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-06-02 00:50:45 +0100 |
commit | 9b73cb16485f331d9dc1f37826c6d503e24a5b0b (patch) | |
tree | f5f5772dc844ed925af757c1b5cd08b8fa6bd88d /testsuite | |
parent | 11d8f84fd3237c3821c8f826716fc4c9adfccb8c (diff) | |
download | haskell-9b73cb16485f331d9dc1f37826c6d503e24a5b0b.tar.gz |
Refactor the GlobalRdrEnv, fixing #7672
This patch started innocently enough, by deleting a single
call from rnImportDecl, namely
let gbl_env = mkGlobalRdrEnv (filterOut from_this_mod gres)
The 'filterOut' makes no sense, and was the cause of #7672.
But that little loose end led to into a twisty maze of little
passages, all alike, which has taken me an unreasonably long
time to straighten out. Happily, I think the result is really
much better.
In particular:
* INVARIANT 1 of the GlobalRdrEnv type was simply not true:
we had multiple GlobalRdrElts in a list with the same
gre_name field. This kludgily implmented one form of
shadowing.
* Meanwhile, extendGlobalRdrEnvRn implemented a second form of
shadowing, by deleting stuff from the GlobalRdrEnv.
* In turn, much of this shadowing stuff depended on the Names of
the Ids bound in the GHCi InteractiveContext being Internal
names, even though the TyCons and suchlike all had External
Names. Very confusing.
So I have made the following changes
* I re-established INVARIANT 1 of GlobalRdrEnv. As a result
some strange code in RdrName.pickGREs goes away.
* RnNames.extendGlobalRdrEnvRn now makes one call to deal with
shadowing, where necessary, and another to extend the
environment. It deals separately with duplicate bindings.
The very complicated RdrName.extendGlobalRdrEnv becomes much
simpler; we need to export the shadowing function, now called
RdrName.shadowNames; and we can nuke
RdrName.findLocalDupsRdrEnv altogether.
RdrName Note [GlobalRdrEnv shadowing] summarises the shadowing
story
* The Names of the Ids bound in the GHCi interactive context are
now all External. See Note [Interactively-bound Ids in GHCi]
in HscTypes.
* Names for Ids created by the debugger are now made by
IfaceEnv.newInteractiveBinder. This fixes a lurking bug which
was that the debugger was using mkNewUniqueSupply 'I' to make
uniques, which does NOT guarantee a fresh supply of uniques on
successive calls.
* Note [Template Haskell ambiguity] in RnEnv shows that one TH-related
error is reported lazily (on occurrences) when it might be better
reported when extending the environment. In some (but not all) cases
this was done before; but now it's uniformly at occurrences. In
some ways it'd be better to report when extending the environment,
but it's a tiresome test and the error is rare, so I'm leaving it
at the lookup site for now, with the above Note.
* A small thing: RnNames.greAvail becomes RdrName.availFromGRE, where
it joins the dual RdrName.gresFromAvail.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/break027.stdout | 18 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T10248.stderr | 34 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T5564.stderr | 19 | ||||
-rw-r--r-- | testsuite/tests/module/mod110.stderr | 14 | ||||
-rw-r--r-- | testsuite/tests/module/mod151.stderr | 14 | ||||
-rw-r--r-- | testsuite/tests/module/mod152.stderr | 21 | ||||
-rw-r--r-- | testsuite/tests/module/mod153.stderr | 14 | ||||
-rw-r--r-- | testsuite/tests/rename/should_compile/T1972.stderr | 24 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T5533.stderr | 8 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T7906.stderr | 8 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/rn_dup.stderr | 52 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/rnfail044.stderr | 14 | ||||
-rw-r--r-- | testsuite/tests/th/T7241.stderr | 14 | ||||
-rw-r--r-- | testsuite/tests/th/T8932.stderr | 16 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/tcfail037.stderr | 15 |
15 files changed, 140 insertions, 145 deletions
diff --git a/testsuite/tests/ghci.debugger/scripts/break027.stdout b/testsuite/tests/ghci.debugger/scripts/break027.stdout index bac674b946..903b7b772a 100644 --- a/testsuite/tests/ghci.debugger/scripts/break027.stdout +++ b/testsuite/tests/ghci.debugger/scripts/break027.stdout @@ -1,9 +1,9 @@ -Breakpoint 0 activated at ../QSort.hs:(4,1)-(6,55) -Stopped at ../QSort.hs:(4,1)-(6,55) -_result :: [t] = _ -Stopped at ../QSort.hs:5:16-51 -_result :: [Integer] = _ -a :: Integer = 3 -left :: [Integer] = _ -right :: [Integer] = _ -a :: Integer -- Defined at <no location info> +Breakpoint 0 activated at ..\QSort.hs:(4,1)-(6,55)
+Stopped at ..\QSort.hs:(4,1)-(6,55)
+_result :: [t] = _
+Stopped at ..\QSort.hs:5:16-51
+_result :: [Integer] = _
+a :: Integer = 3
+left :: [Integer] = _
+right :: [Integer] = _
+a :: Integer -- Defined in ‘interactive:Ghci2’
diff --git a/testsuite/tests/ghci/scripts/T10248.stderr b/testsuite/tests/ghci/scripts/T10248.stderr index 1245b994fd..8133ee585a 100644 --- a/testsuite/tests/ghci/scripts/T10248.stderr +++ b/testsuite/tests/ghci/scripts/T10248.stderr @@ -1,18 +1,16 @@ - -<interactive>:3:10: warning: - Found hole ‘_’ with type: IO () - In the second argument of ‘(<$>)’, namely ‘_’ - In the first argument of ‘ghciStepIO :: - IO a_alT -> IO a_alT’, namely - ‘Just <$> _’ - In a stmt of an interactive GHCi command: - it <- ghciStepIO :: IO a_alT -> IO a_alT (Just <$> _) -*** Exception: <interactive>:3:10: error: - Found hole ‘_’ with type: IO () - In the second argument of ‘(<$>)’, namely ‘_’ - In the first argument of ‘ghciStepIO :: - IO a_alT -> IO a_alT’, namely - ‘Just <$> _’ - In a stmt of an interactive GHCi command: - it <- ghciStepIO :: IO a_alT -> IO a_alT (Just <$> _) -(deferred type error) +
+<interactive>:3:10: warning:
+ Found hole ‘_’ with type: IO ()
+ In the second argument of ‘(<$>)’, namely ‘_’
+ In the first argument of ‘ghciStepIO :: IO a -> IO a’, namely
+ ‘Just <$> _’
+ In a stmt of an interactive GHCi command:
+ it <- ghciStepIO :: IO a -> IO a (Just <$> _)
+*** Exception: <interactive>:3:10: error:
+ Found hole ‘_’ with type: IO ()
+ In the second argument of ‘(<$>)’, namely ‘_’
+ In the first argument of ‘ghciStepIO :: IO a -> IO a’, namely
+ ‘Just <$> _’
+ In a stmt of an interactive GHCi command:
+ it <- ghciStepIO :: IO a -> IO a (Just <$> _)
+(deferred type error)
diff --git a/testsuite/tests/ghci/scripts/T5564.stderr b/testsuite/tests/ghci/scripts/T5564.stderr index c358dab319..deba7e2b78 100644 --- a/testsuite/tests/ghci/scripts/T5564.stderr +++ b/testsuite/tests/ghci/scripts/T5564.stderr @@ -1,9 +1,10 @@ - -<interactive>:3:1: - Not in scope: ‘git’ - Perhaps you meant ‘it’ (line 2) - -<interactive>:5:1: - Not in scope: ‘fit’ - Perhaps you meant one of these: - ‘fst’ (imported from Prelude), ‘it’ (line 4) +
+<interactive>:3:1: error:
+ Not in scope: ‘git’
+ Perhaps you meant ‘it’ (line 2)
+
+<interactive>:5:1: error:
+ Not in scope: ‘fit’
+ Perhaps you meant one of these:
+ ‘fst’ (imported from Prelude), ‘Ghci1.it’ (imported from Ghci1),
+ ‘it’ (line 4)
diff --git a/testsuite/tests/module/mod110.stderr b/testsuite/tests/module/mod110.stderr index 1018f69f0d..815da10602 100644 --- a/testsuite/tests/module/mod110.stderr +++ b/testsuite/tests/module/mod110.stderr @@ -1,7 +1,7 @@ - -mod110.hs:11:10: - Ambiguous occurrence ‘Eq’ - It could refer to either ‘M.Eq’, defined at mod110.hs:7:1 - or ‘Prelude.Eq’, - imported from ‘Prelude’ at mod110.hs:4:1-14 - (and originally defined in ‘GHC.Classes’) +
+mod110.hs:11:10: error:
+ Ambiguous occurrence ‘Eq’
+ It could refer to either ‘Prelude.Eq’,
+ imported from ‘Prelude’ at mod110.hs:4:1-14
+ (and originally defined in ‘GHC.Classes’)
+ or ‘M.Eq’, defined at mod110.hs:7:1
diff --git a/testsuite/tests/module/mod151.stderr b/testsuite/tests/module/mod151.stderr index 9f750584f0..3feab8e7ba 100644 --- a/testsuite/tests/module/mod151.stderr +++ b/testsuite/tests/module/mod151.stderr @@ -1,7 +1,7 @@ - -mod151.hs:2:20: - Ambiguous occurrence ‘id’ - It could refer to either ‘M.id’, defined at mod151.hs:2:30 - or ‘Prelude.id’, - imported from ‘Prelude’ at mod151.hs:2:8 - (and originally defined in ‘GHC.Base’) +
+mod151.hs:2:20: error:
+ Ambiguous occurrence ‘id’
+ It could refer to either ‘Prelude.id’,
+ imported from ‘Prelude’ at mod151.hs:2:8
+ (and originally defined in ‘GHC.Base’)
+ or ‘M.id’, defined at mod151.hs:2:30
diff --git a/testsuite/tests/module/mod152.stderr b/testsuite/tests/module/mod152.stderr index 3c96bc1270..d0106d44a6 100644 --- a/testsuite/tests/module/mod152.stderr +++ b/testsuite/tests/module/mod152.stderr @@ -1,14 +1,7 @@ - -mod152.hs:2:26: - Ambiguous occurrence ‘id’ - It could refer to either ‘M.id’, defined at mod152.hs:2:36 - or ‘Prelude.id’, - imported from ‘Prelude’ at mod152.hs:2:8 - (and originally defined in ‘GHC.Base’) - -mod152.hs:2:26: - Conflicting exports for ‘id’: - ‘module Prelude’ exports ‘Prelude.id’ - imported from ‘Prelude’ at mod152.hs:2:8 - (and originally defined in ‘GHC.Base’) - ‘id’ exports ‘M.id’ defined at mod152.hs:2:36 +
+mod152.hs:2:26: error:
+ Ambiguous occurrence ‘id’
+ It could refer to either ‘Prelude.id’,
+ imported from ‘Prelude’ at mod152.hs:2:8
+ (and originally defined in ‘GHC.Base’)
+ or ‘M.id’, defined at mod152.hs:2:36
diff --git a/testsuite/tests/module/mod153.stderr b/testsuite/tests/module/mod153.stderr index fa5283b9ef..8f45a03063 100644 --- a/testsuite/tests/module/mod153.stderr +++ b/testsuite/tests/module/mod153.stderr @@ -1,7 +1,7 @@ - -mod153.hs:2:11: - Ambiguous occurrence ‘id’ - It could refer to either ‘M.id’, defined at mod153.hs:2:21 - or ‘Prelude.id’, - imported from ‘Prelude’ at mod153.hs:2:8 - (and originally defined in ‘GHC.Base’) +
+mod153.hs:2:11: error:
+ Ambiguous occurrence ‘id’
+ It could refer to either ‘Prelude.id’,
+ imported from ‘Prelude’ at mod153.hs:2:8
+ (and originally defined in ‘GHC.Base’)
+ or ‘M.id’, defined at mod153.hs:2:21
diff --git a/testsuite/tests/rename/should_compile/T1972.stderr b/testsuite/tests/rename/should_compile/T1972.stderr index 0f450fc023..e19b08eece 100644 --- a/testsuite/tests/rename/should_compile/T1972.stderr +++ b/testsuite/tests/rename/should_compile/T1972.stderr @@ -1,12 +1,12 @@ - -T1972.hs:12:3: Warning: - This binding for ‘name’ shadows the existing binding - defined at T1972.hs:9:19 - -T1972.hs:14:3: Warning: - This binding for ‘mapAccumL’ shadows the existing bindings - defined at T1972.hs:16:1 - imported from ‘Data.List’ at T1972.hs:7:1-16 - (and originally defined in ‘Data.Traversable’) - -T1972.hs:20:10: Warning: Defined but not used: ‘c’ +
+T1972.hs:12:3: warning:
+ This binding for ‘name’ shadows the existing binding
+ defined at T1972.hs:9:19
+
+T1972.hs:14:3: warning:
+ This binding for ‘mapAccumL’ shadows the existing bindings
+ imported from ‘Data.List’ at T1972.hs:7:1-16
+ (and originally defined in ‘Data.Traversable’)
+ defined at T1972.hs:16:1
+
+T1972.hs:20:10: warning: Defined but not used: ‘c’
diff --git a/testsuite/tests/rename/should_fail/T5533.stderr b/testsuite/tests/rename/should_fail/T5533.stderr index 5d514685d4..2c8d761667 100644 --- a/testsuite/tests/rename/should_fail/T5533.stderr +++ b/testsuite/tests/rename/should_fail/T5533.stderr @@ -1,4 +1,4 @@ - -T5533.hs:4:1: - The type signature for ‘f2’ lacks an accompanying binding - (You cannot give a type signature for a record selector or class method) +
+T5533.hs:4:1: error:
+ The type signature for ‘f2’ lacks an accompanying binding
+ (The type signature must be given where ‘f2’ is declared)
diff --git a/testsuite/tests/rename/should_fail/T7906.stderr b/testsuite/tests/rename/should_fail/T7906.stderr index 3f06d8b2fb..e2b3e13008 100644 --- a/testsuite/tests/rename/should_fail/T7906.stderr +++ b/testsuite/tests/rename/should_fail/T7906.stderr @@ -1,4 +1,4 @@ - -T7906.hs:5:16: - The INLINABLE pragma for ‘foo’ lacks an accompanying binding - (You cannot give a INLINABLE pragma for a record selector or class method) +
+T7906.hs:5:16: error:
+ The INLINABLE pragma for ‘foo’ lacks an accompanying binding
+ (The INLINABLE pragma must be given where ‘foo’ is declared)
diff --git a/testsuite/tests/rename/should_fail/rn_dup.stderr b/testsuite/tests/rename/should_fail/rn_dup.stderr index 961e420ac7..db6767a635 100644 --- a/testsuite/tests/rename/should_fail/rn_dup.stderr +++ b/testsuite/tests/rename/should_fail/rn_dup.stderr @@ -1,22 +1,30 @@ - -rn_dup.hs:9:10: - Multiple declarations of ‘MkT’ - Declared at: rn_dup.hs:7:10 - rn_dup.hs:7:16 - rn_dup.hs:9:10 - -rn_dup.hs:12:16: - Multiple declarations of ‘rf’ - Declared at: rn_dup.hs:11:16 - rn_dup.hs:11:27 - rn_dup.hs:12:16 - -rn_dup.hs:17:3: - Multiple declarations of ‘CT’ - Declared at: rn_dup.hs:15:3 - rn_dup.hs:17:3 - -rn_dup.hs:18:3: - Multiple declarations of ‘f’ - Declared at: rn_dup.hs:16:3 - rn_dup.hs:18:3 +
+rn_dup.hs:9:10: error:
+ Multiple declarations of ‘MkT’
+ Declared at: rn_dup.hs:7:10
+ rn_dup.hs:9:10
+
+rn_dup.hs:9:10: error:
+ Multiple declarations of ‘MkT’
+ Declared at: rn_dup.hs:7:16
+ rn_dup.hs:9:10
+
+rn_dup.hs:12:16: error:
+ Multiple declarations of ‘rf’
+ Declared at: rn_dup.hs:11:16
+ rn_dup.hs:12:16
+
+rn_dup.hs:12:16: error:
+ Multiple declarations of ‘rf’
+ Declared at: rn_dup.hs:11:27
+ rn_dup.hs:12:16
+
+rn_dup.hs:17:3: error:
+ Multiple declarations of ‘CT’
+ Declared at: rn_dup.hs:15:3
+ rn_dup.hs:17:3
+
+rn_dup.hs:18:3: error:
+ Multiple declarations of ‘f’
+ Declared at: rn_dup.hs:16:3
+ rn_dup.hs:18:3
diff --git a/testsuite/tests/rename/should_fail/rnfail044.stderr b/testsuite/tests/rename/should_fail/rnfail044.stderr index eef15b2209..4cfb3e4d23 100644 --- a/testsuite/tests/rename/should_fail/rnfail044.stderr +++ b/testsuite/tests/rename/should_fail/rnfail044.stderr @@ -1,7 +1,7 @@ - -rnfail044.hs:5:12: - Ambiguous occurrence ‘splitAt’ - It could refer to either ‘A.splitAt’, defined at rnfail044.hs:8:3 - or ‘Data.List.splitAt’, - imported from ‘Prelude’ at rnfail044.hs:5:8 - (and originally defined in ‘GHC.List’) +
+rnfail044.hs:5:12: error:
+ Ambiguous occurrence ‘splitAt’
+ It could refer to either ‘Data.List.splitAt’,
+ imported from ‘Prelude’ at rnfail044.hs:5:8
+ (and originally defined in ‘GHC.List’)
+ or ‘A.splitAt’, defined at rnfail044.hs:8:3
diff --git a/testsuite/tests/th/T7241.stderr b/testsuite/tests/th/T7241.stderr index 343cdc827d..15c554175c 100644 --- a/testsuite/tests/th/T7241.stderr +++ b/testsuite/tests/th/T7241.stderr @@ -1,6 +1,8 @@ - -T7241.hs:7:3: - Duplicate exact Name ‘Foo’ - Probable cause: you used a unique Template Haskell name (NameU), - perhaps via newName, but bound it multiple times - If that's it, then -ddump-splices might be useful +
+T7241.hs:7:3: error:
+ Same exact name in multiple name-spaces:
+ type constructor or class ‘Foo’, declared at: T7241.hs:7:3
+ data constructor ‘Foo’, declared at: T7241.hs:7:3
+ Probable cause: you bound a unique Template Haskell name (NameU),
+ perhaps via newName, in different name-spaces.
+ If that's it, then -ddump-splices might be useful
diff --git a/testsuite/tests/th/T8932.stderr b/testsuite/tests/th/T8932.stderr index c861235091..68fb024938 100644 --- a/testsuite/tests/th/T8932.stderr +++ b/testsuite/tests/th/T8932.stderr @@ -1,11 +1,5 @@ - -T8932.hs:5:3: - Duplicate exact Name ‘foo’ - Probable cause: you used a unique Template Haskell name (NameU), - perhaps via newName, but bound it multiple times - If that's it, then -ddump-splices might be useful - -T8932.hs:11:1: - Multiple declarations of ‘foo’ - Declared at: T8932.hs:5:3 - T8932.hs:11:1 +
+T8932.hs:11:1: error:
+ Multiple declarations of ‘foo’
+ Declared at: T8932.hs:5:3
+ T8932.hs:11:1
diff --git a/testsuite/tests/typecheck/should_fail/tcfail037.stderr b/testsuite/tests/typecheck/should_fail/tcfail037.stderr index 5ada45cc84..eefd822973 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail037.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail037.stderr @@ -1,8 +1,7 @@ - -tcfail037.hs:7:11: - Ambiguous occurrence ‘+’ - It could refer to either ‘ShouldFail.+’, - defined at tcfail037.hs:10:5 - or ‘Prelude.+’, - imported from ‘Prelude’ at tcfail037.hs:3:8-17 - (and originally defined in ‘GHC.Num’) +
+tcfail037.hs:7:11: error:
+ Ambiguous occurrence ‘+’
+ It could refer to either ‘Prelude.+’,
+ imported from ‘Prelude’ at tcfail037.hs:3:8-17
+ (and originally defined in ‘GHC.Num’)
+ or ‘ShouldFail.+’, defined at tcfail037.hs:10:5
|