diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-09-12 18:34:30 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-09-19 09:04:39 -0400 |
commit | 912afaf49e86501657468f32c1fd20961f98a6d1 (patch) | |
tree | 300d50a6f42ba640781a8c8994b7d6802d89d0b4 | |
parent | c675d08fb08151c10e94a975452ce0c5c2cf997a (diff) | |
download | haskell-912afaf49e86501657468f32c1fd20961f98a6d1.tar.gz |
CoreUtils: Use mightBeUnliftedType in exprIsTopLevelBindable
Also add reference from isUnliftedType to mightBeUnliftedType.
-rw-r--r-- | compiler/coreSyn/CoreUtils.hs | 4 | ||||
-rw-r--r-- | compiler/types/Type.hs | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index 5204d5e9f6..d3ed00f783 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -1880,7 +1880,9 @@ exprIsTopLevelBindable :: CoreExpr -> Type -> Bool -- Top-level literal strings can't even be wrapped in ticks -- see Note [CoreSyn top-level string literals] in CoreSyn exprIsTopLevelBindable expr ty - = not (isUnliftedType ty) + = not (mightBeUnliftedType ty) + -- Note that 'expr' may be levity polymorphic here consequently we must use + -- 'mightBeUnliftedType' rather than 'isUnliftedType' as the latter would panic. || exprIsTickedString expr -- | Check if the expression is zero or more Ticks wrapped around a literal diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index 94ee5af202..f574132c4f 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -2214,7 +2214,9 @@ isLiftedType_maybe ty = go (getRuntimeRep ty) | otherwise = Nothing -- levity polymorphic -- | See "Type#type_classification" for what an unlifted type is. --- Panics on levity polymorphic types. +-- Panics on levity polymorphic types; See 'mightBeUnliftedType' for +-- a more approximate predicate that behaves better in the presence of +-- levity polymorphism. isUnliftedType :: HasDebugCallStack => Type -> Bool -- isUnliftedType returns True for forall'd unlifted types: -- x :: forall a. Int# |