Commit 08c5b670 authored by simonpj's avatar simonpj
Browse files

Simplify treatement of pragmas slightly

parent b801454d
...@@ -25,7 +25,6 @@ import TcHsType ...@@ -25,7 +25,6 @@ import TcHsType
import TcPat import TcPat
import TcMType import TcMType
import TcType import TcType
import RnBinds( misplacedSigErr )
import Coercion import Coercion
import TysPrim import TysPrim
import Id import Id
...@@ -44,7 +43,6 @@ import BasicTypes ...@@ -44,7 +43,6 @@ import BasicTypes
import Outputable import Outputable
import FastString import FastString
import Data.List( partition )
import Control.Monad import Control.Monad
#include "HsVersions.h" #include "HsVersions.h"
...@@ -559,24 +557,16 @@ tcSpec _ prag = pprPanic "tcSpec" (ppr prag) ...@@ -559,24 +557,16 @@ tcSpec _ prag = pprPanic "tcSpec" (ppr prag)
tcImpPrags :: [LSig Name] -> TcM [LTcSpecPrag] tcImpPrags :: [LSig Name] -> TcM [LTcSpecPrag]
tcImpPrags prags tcImpPrags prags
= do { this_mod <- getModule = do { this_mod <- getModule
; let is_imp prag ; mapAndRecoverM (wrapLocM tcImpSpec)
= case sigName prag of [L loc (name,prag) | (L loc prag@(SpecSig (L _ name) _ _)) <- prags
Nothing -> False , not (nameIsLocalOrFrom this_mod name) ] }
Just name -> not (nameIsLocalOrFrom this_mod name)
(spec_prags, others) = partition isSpecLSig $ tcImpSpec :: (Name, Sig Name) -> TcM TcSpecPrag
filter is_imp prags tcImpSpec (name, prag)
; mapM_ misplacedSigErr others
-- Messy that this misplaced-sig error comes here
-- but the others come from the renamer
; mapAndRecoverM (wrapLocM tcImpSpec) spec_prags }
tcImpSpec :: Sig Name -> TcM TcSpecPrag
tcImpSpec prag@(SpecSig (L _ name) _ _)
= do { id <- tcLookupId name = do { id <- tcLookupId name
; checkTc (isAnyInlinePragma (idInlinePragma id)) ; checkTc (isAnyInlinePragma (idInlinePragma id))
(impSpecErr name) (impSpecErr name)
; tcSpec id prag } ; tcSpec id prag }
tcImpSpec p = pprPanic "tcImpSpec" (ppr p)
impSpecErr :: Name -> SDoc impSpecErr :: Name -> SDoc
impSpecErr name impSpecErr name
......
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