Improve find_lbl panic message
authorBen Gamari <ben@smart-cactus.org>
Thu, 13 Oct 2016 23:42:21 +0000 (19:42 -0400)
committerBen Gamari <ben@smart-cactus.org>
Fri, 14 Oct 2016 02:57:25 +0000 (22:57 -0400)
compiler/iface/TcIface.hs

index eba52e4..ee51b5d 100644 (file)
@@ -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