Improved panic message for zonkTcTyVarToTyVar
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 8 Dec 2017 17:32:16 +0000 (17:32 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Mon, 11 Dec 2017 11:55:37 +0000 (11:55 +0000)
compiler/typecheck/TcMType.hs

index d7e6a5e..7473967 100644 (file)
@@ -1532,10 +1532,14 @@ zonkTcTyVar tv
 
 -- Variant that assumes that any result of zonking is still a TyVar.
 -- Should be used only on skolems and SigTvs
-zonkTcTyVarToTyVar :: TcTyVar -> TcM TcTyVar
+zonkTcTyVarToTyVar :: HasDebugCallStack => TcTyVar -> TcM TcTyVar
 zonkTcTyVarToTyVar tv
   = do { ty <- zonkTcTyVar tv
-       ; return (tcGetTyVar "zonkTcTyVarToVar" ty) }
+       ; let tv' = case tcGetTyVar_maybe ty of
+                     Just tv' -> tv'
+                     Nothing  -> pprPanic "zonkTcTyVarToTyVar"
+                                          (ppr tv $$ ppr ty)
+       ; return tv' }
 
 {-
 %************************************************************************