[commit: ghc] master: Improve find_lbl panic message (aa06883)

git at git.haskell.org git at git.haskell.org
Fri Oct 14 02:59:04 UTC 2016


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

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

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

commit aa06883c4cffcd8d064122f4ed83d02a7bd221f2
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Thu Oct 13 19:42:21 2016 -0400

    Improve find_lbl panic message


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

aa06883c4cffcd8d064122f4ed83d02a7bd221f2
 compiler/iface/TcIface.hs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs
index eba52e4..ee51b5d 100644
--- a/compiler/iface/TcIface.hs
+++ b/compiler/iface/TcIface.hs
@@ -765,7 +765,10 @@ tcIfaceDataCons tycon_name tycon tc_tybinders if_cons
         ; let lbl_names = map find_lbl my_lbls
               find_lbl x = case find (\ fl -> flSelector fl == x) field_lbls of
                              Just fl -> fl
-                             Nothing -> error $ "find_lbl missing " ++ occNameString (occName x)
+                             Nothing -> pprPanic "TcIface.find_lbl" not_found
+                where
+                  not_found = text "missing:" <+> ppr (occName x)
+                           $$ text "known labels:" <+> ppr field_lbls
 
         -- Remember, tycon is the representation tycon
         ; let orig_res_ty = mkFamilyTyConApp tycon



More information about the ghc-commits mailing list