[Git][ghc/ghc][wip/T18341] Literal expressions can't diverge

Sebastian Graf gitlab at gitlab.haskell.org
Fri Aug 28 14:29:21 UTC 2020



Sebastian Graf pushed to branch wip/T18341 at Glasgow Haskell Compiler / GHC


Commits:
3833b5e8 by Sebastian Graf at 2020-08-28T16:29:14+02:00
Literal expressions can't diverge

- - - - -


1 changed file:

- compiler/GHC/HsToCore/PmCheck/Oracle.hs


Changes:

=====================================
compiler/GHC/HsToCore/PmCheck/Oracle.hs
=====================================
@@ -1759,8 +1759,12 @@ addCoreCt nabla x e = do
       pm_alt_con_app x (PmAltConLike (RealDataCon dc)) ex_tvs arg_ids
 
     -- | Adds a literal constraint, i.e. @x ~ 42 at .
+    -- Also we assume that literal expressions won't diverge, so this
+    -- will add a @x ~/ ⊥@ constraint.
     pm_lit :: Id -> PmLit -> StateT Nabla (MaybeT DsM) ()
-    pm_lit x lit = pm_alt_con_app x (PmAltLit lit) [] []
+    pm_lit x lit = do
+      modifyT $ \nabla -> addNotBotCt nabla x
+      pm_alt_con_app x (PmAltLit lit) [] []
 
     -- | Adds the given constructor application as a solution for @x at .
     pm_alt_con_app :: Id -> PmAltCon -> [TyVar] -> [Id] -> StateT Nabla (MaybeT DsM) ()



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3833b5e89ae151c54b6e2fa1c516157093b97cd8

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3833b5e89ae151c54b6e2fa1c516157093b97cd8
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200828/05dc5179/attachment-0001.html>


More information about the ghc-commits mailing list