From 82c7d643eeba748f0aaa7489066d9eee62c294c4 Mon Sep 17 00:00:00 2001 From: Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> Date: Fri, 22 Nov 2019 23:44:21 +0100 Subject: [PATCH] Use mkLocalIdOrCoVar in PmCheck/Oracle --- compiler/GHC/HsToCore/PmCheck/Oracle.hs | 2 +- compiler/basicTypes/Id.hs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/GHC/HsToCore/PmCheck/Oracle.hs b/compiler/GHC/HsToCore/PmCheck/Oracle.hs index 1b5c5b24c8f..63a05467c21 100644 --- a/compiler/GHC/HsToCore/PmCheck/Oracle.hs +++ b/compiler/GHC/HsToCore/PmCheck/Oracle.hs @@ -508,7 +508,7 @@ nameTyCt (TyCt pred_ty) = do unique <- getUniqueM let occname = mkVarOccFS (fsLit ("pm_"++show unique)) idname = mkInternalName unique occname noSrcSpan - return (mkLocalId idname pred_ty) + return (mkLocalIdOrCoVar idname pred_ty) -- | Add some extra type constraints to the 'TyState'; return 'Nothing' if we -- find a contradiction (e.g. @Int ~ Bool@). diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index 2af33050f39..067b8d0d359 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -266,9 +266,10 @@ mkVanillaGlobalWithInfo = mkGlobalId VanillaId -- | For an explanation of global vs. local 'Id's, see "Var#globalvslocal" -mkLocalId :: Name -> Type -> Id -mkLocalId name ty = ASSERT( not (isCoVarType ty) ) +mkLocalId :: HasCallStack => Name -> Type -> Id +mkLocalId name ty = if( not (isCoVarType ty) ) then mkLocalIdWithInfo name ty vanillaIdInfo + else pprPanic "mkLocalId" (ppr name <+> ppr ty) -- | Same as 'mkLocalId' but without the assertion; used when the -- type is a panic, search for invented_id -- GitLab