summaryrefslogtreecommitdiff
path: root/compiler/deSugar/DsUtils.hs
diff options
context:
space:
mode:
authorRichard Eisenberg <rae@cs.brynmawr.edu>2017-03-16 10:34:29 -0400
committerRichard Eisenberg <rae@cs.brynmawr.edu>2017-03-17 11:23:13 -0400
commitdca44adb9e14992e0aed49cdfd4b2baa2182073b (patch)
tree887e2093f942fff75e1ad666cd194446592e8d22 /compiler/deSugar/DsUtils.hs
parent4dc993008a66d6a54909da462363a25e8449f000 (diff)
downloadhaskell-dca44adb9e14992e0aed49cdfd4b2baa2182073b.tar.gz
Fix #12709 by not building bad applications
In an effort to report multiple levity polymorphism errors all at once, the desugarer does not fail when encountering bad levity polymorphism. But we must be careful not to build the bad applications, lest they try to satisfy the let/app invariant and call isUnliftedType on a levity polymorphic type. This protects calls to mkCoreAppDs appropriately. test case: typecheck/should_fail/T12709
Diffstat (limited to 'compiler/deSugar/DsUtils.hs')
-rw-r--r--compiler/deSugar/DsUtils.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/deSugar/DsUtils.hs b/compiler/deSugar/DsUtils.hs
index 165130aa94..db757d6afe 100644
--- a/compiler/deSugar/DsUtils.hs
+++ b/compiler/deSugar/DsUtils.hs
@@ -540,6 +540,7 @@ into
which stupidly tries to bind the datacon 'True'.
-}
+-- NB: Make sure the argument is not levity polymorphic
mkCoreAppDs :: SDoc -> CoreExpr -> CoreExpr -> CoreExpr
mkCoreAppDs _ (Var f `App` Type ty1 `App` Type ty2 `App` arg1) arg2
| f `hasKey` seqIdKey -- Note [Desugaring seq (1), (2)]
@@ -552,6 +553,7 @@ mkCoreAppDs _ (Var f `App` Type ty1 `App` Type ty2 `App` arg1) arg2
mkCoreAppDs s fun arg = mkCoreApp s fun arg -- The rest is done in MkCore
+-- NB: No argument can be levity polymorphic
mkCoreAppsDs :: SDoc -> CoreExpr -> [CoreExpr] -> CoreExpr
mkCoreAppsDs s fun args = foldl (mkCoreAppDs s) fun args