Subject: [commit: ghc] master: Be stricter about abstract newtypes in FFI declarations again. (1e87280)
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch : master

http://hackage.haskell.org/trac/ghc/changeset/1e872802a32846075b27816e5c8dbc1d2c9f06ee

>---------------------------------------------------------------

commit 1e872802a32846075b27816e5c8dbc1d2c9f06ee
Author: Ian Lynagh <igloo@xxxxxxxx>
Date: Tue Feb 21 19:55:09 2012 +0000

Be stricter about abstract newtypes in FFI declarations again.

This reverts the relaxation in c6b0fd62fc715aa6c666eb8afe09073ac7b87a83

>---------------------------------------------------------------

compiler/typecheck/TcForeign.lhs | 19 +++++--------------
1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/compiler/typecheck/TcForeign.lhs b/compiler/typecheck/TcForeign.lhs
index c009343..9fbcff6 100644
--- a/compiler/typecheck/TcForeign.lhs
+++ b/compiler/typecheck/TcForeign.lhs
@@ -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



_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/cvs-ghc

(C)2011 mailinglist-archive.com