diff options
| author | Sylvain Henry <sylvain@haskus.fr> | 2016-12-01 12:24:34 -0500 |
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2016-12-01 12:24:35 -0500 |
| commit | 514c01eec5f2b23f278c29b61345dce6c37900f1 (patch) | |
| tree | 5ef25752151d352ed69d0c43fc30982eeb0c393b | |
| parent | f48f5a9ebf384e1e157b7b413e1d779f4289ddd2 (diff) | |
| download | haskell-514c01eec5f2b23f278c29b61345dce6c37900f1.tar.gz | |
Levity polymorphic expressions mustn't be floated-out in let-bindings.
Reviewers: simonpj, austin, bgamari
Reviewed By: simonpj, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2769
GHC Trac Issues: #12901
| -rw-r--r-- | compiler/simplCore/SetLevels.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index f2f373d40a..dc36a6c9b0 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -83,6 +83,7 @@ import Demand ( StrictSig ) import Name ( getOccName, mkSystemVarName ) import OccName ( occNameString ) import Type ( isUnliftedType, Type, mkLamTypes ) +import Kind ( isLevityPolymorphic, typeKind ) import BasicTypes ( Arity, RecFlag(..) ) import UniqSupply import Util @@ -487,6 +488,9 @@ lvlMFE strict_ctxt env ann_expr -- Can't let-bind it; see Note [Unlifted MFEs] -- This includes coercions, which we don't want to float anyway -- NB: no need to substitute cos isUnliftedType doesn't change + || isLevityPolymorphic (typeKind (exprType expr)) + -- We can't let-bind levity polymorphic expressions + -- See Note [Levity polymorphism invariants] in CoreSyn || notWorthFloating ann_expr abs_vars || not float_me = -- Don't float it out |
