diff options
author | sheaf <sam.derbyshire@gmail.com> | 2022-05-04 13:41:22 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-05-04 16:16:12 -0400 |
commit | 445d3657aaa0860e725c525c844326557d2f39d5 (patch) | |
tree | fa963991bb8fac2b5ac2dc9092afd31a5a8aedb4 /compiler/GHC/Tc/Utils | |
parent | 934a90dd6a34d2d1100506795d5f76cd20e2c599 (diff) | |
download | haskell-445d3657aaa0860e725c525c844326557d2f39d5.tar.gz |
Ensure Any is not levity-polymorphic in FFI
The previous patch forgot to account for a type such as
Any @(TYPE (BoxedRep l))
for a quantified levity variable l.
Diffstat (limited to 'compiler/GHC/Tc/Utils')
-rw-r--r-- | compiler/GHC/Tc/Utils/TcType.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Tc/Utils/TcType.hs b/compiler/GHC/Tc/Utils/TcType.hs index 9caf6c9f5b..63ba3e01c5 100644 --- a/compiler/GHC/Tc/Utils/TcType.hs +++ b/compiler/GHC/Tc/Utils/TcType.hs @@ -2289,10 +2289,10 @@ isFFILabelTy ty = checkRepTyCon ok ty -- - @Just (NotValid ..)@ for @Any :: k@ if @k@ is not a kind of boxed types, -- - @Nothing@ if the type is not @Any@. checkAnyTy :: Type -> Maybe (Validity' IllegalForeignTypeReason) -checkAnyTy ty +checkAnyTy ty | Just ki <- anyTy_maybe ty = Just $ - if isBoxedTypeKind ki + if isJust $ kindBoxedRepLevity_maybe ki then IsValid -- NB: don't allow things like @Any :: TYPE IntRep@, as per #21305. else NotValid (TypeCannotBeMarshaled ty NotBoxedKindAny) |