Commit 1e872802 authored by Ian Lynagh's avatar Ian Lynagh

Be stricter about abstract newtypes in FFI declarations again.

This reverts the relaxation in c6b0fd62
parent 4082460e
......@@ -122,15 +122,10 @@ normaliseFfiType' env ty0 = go [] ty0
panic "normaliseFfiType': Got more GREs than expected"
_ ->
return False
when (not newtypeOK) $
-- later: stop_here
addWarnTc (ptext (sLit "newtype") <+> quotes (ppr tc) <+>
ptext (sLit "is used in an FFI declaration,") $$
ptext (sLit "but its constructor is not in scope.") $$
ptext (sLit "This will become an error in GHC 7.6.1."))
let nt_co = mkAxInstCo (newTyConCo tc) tys
add_co nt_co rec_nts' nt_rhs
if newtypeOK
then do let nt_co = mkAxInstCo (newTyConCo tc) tys
add_co nt_co rec_nts' nt_rhs
else children_only
| isFamilyTyCon tc -- Expand open tycons
, (co, ty) <- normaliseTcApp env tc tys
......@@ -138,11 +133,7 @@ normaliseFfiType' env ty0 = go [] ty0
= add_co co rec_nts ty
| otherwise
= return (mkReflCo ty, ty)
-- If we have reached an ordinary (non-newtype) type constructor,
-- we are done. Note that we don't need to normalise the arguments,
-- because whether an FFI type is legal or not depends only on
-- the top-level type constructor (e.g. "Ptr a" is valid for all a).
= children_only
where
tc_key = getUnique tc
children_only = do xs <- mapM (go rec_nts) tys
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment