[commit: ghc] master: Avoid panic due to partial ieName (a12e47b)

git at git.haskell.org git at git.haskell.org
Wed Dec 2 20:38:41 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/a12e47bed74e305b37e68014c52feba3dd075514/ghc

>---------------------------------------------------------------

commit a12e47bed74e305b37e68014c52feba3dd075514
Author: Eric Seidel <gridaphobe at gmail.com>
Date:   Wed Dec 2 14:37:21 2015 -0600

    Avoid panic due to partial ieName
    
    HsImpExp.ieName is partial and fails when given e.g. `module X`
    
    solution: use ieNames instead which returns a list of names instead of a single name.
    
    Reviewed By: bgamari, austin
    
    Differential Revision: https://phabricator.haskell.org/D1551
    
    GHC Trac Issues: #11077


>---------------------------------------------------------------

a12e47bed74e305b37e68014c52feba3dd075514
 compiler/typecheck/TcHsSyn.hs                         | 2 +-
 testsuite/tests/warnings/should_compile/T11077.hs     | 3 +++
 testsuite/tests/warnings/should_compile/T11077.stderr | 3 +++
 testsuite/tests/warnings/should_compile/all.T         | 1 +
 4 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/compiler/typecheck/TcHsSyn.hs b/compiler/typecheck/TcHsSyn.hs
index ae095e0..39e7f2d 100644
--- a/compiler/typecheck/TcHsSyn.hs
+++ b/compiler/typecheck/TcHsSyn.hs
@@ -317,7 +317,7 @@ zonkTopDecls ev_binds binds export_ies sig_ns rules vects imp_specs fords
         ; warn_missing_sigs <- woptM Opt_WarnMissingSigs
         ; warn_only_exported <- woptM Opt_WarnMissingExportedSigs
         ; let export_occs  = maybe emptyBag
-                                   (listToBag . map (rdrNameOcc . ieName . unLoc) . unLoc)
+                                   (listToBag . concatMap (map rdrNameOcc . ieNames . unLoc) . unLoc)
                                    export_ies
               sig_warn
                 | warn_only_exported = topSigWarnIfExported export_occs sig_ns
diff --git a/testsuite/tests/warnings/should_compile/T11077.hs b/testsuite/tests/warnings/should_compile/T11077.hs
new file mode 100644
index 0000000..76533cb
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/T11077.hs
@@ -0,0 +1,3 @@
+module T11077 (module X, foo) where
+import Data.List as X
+foo = undefined
diff --git a/testsuite/tests/warnings/should_compile/T11077.stderr b/testsuite/tests/warnings/should_compile/T11077.stderr
new file mode 100644
index 0000000..3cb2cba
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/T11077.stderr
@@ -0,0 +1,3 @@
+
+T11077.hs:3:1: warning:
+    Top-level binding with no type signature: foo :: forall t. t
diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T
index 3954ba8..c2b8dd2 100644
--- a/testsuite/tests/warnings/should_compile/all.T
+++ b/testsuite/tests/warnings/should_compile/all.T
@@ -4,6 +4,7 @@ test('T9178', extra_clean(['T9178.o', 'T9178DataType.o',
 			   'T9178.hi', 'T9178DataType.hi']),
 	      multimod_compile, ['T9178', '-Wall'])
 test('T9230', normal, compile_without_flag('-fno-warn-tabs'), [''])
+test('T11077', normal, compile, ['-fwarn-missing-exported-sigs'])
 test('T11128', normal, compile, [''])
 
 test('DeprU',



More information about the ghc-commits mailing list