From: Debian Haskell Group Date: Wed, 1 Apr 2015 11:35:10 +0000 (+0000) Subject: ghc-ignore-ANN-annotation X-Git-Tag: archive/raspbian/8.0.2-9+rpi1~1^2^2^2^2^2~12 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6728b58989206e801835690fa3d503f79708a8a7;p=ghc.git ghc-ignore-ANN-annotation Gbp-Pq: Name ghc-ignore-ANN-annotation.patch --- diff --git a/compiler/typecheck/TcAnnotations.lhs b/compiler/typecheck/TcAnnotations.lhs index 1d495c0e..04719bce 100644 --- a/compiler/typecheck/TcAnnotations.lhs +++ b/compiler/typecheck/TcAnnotations.lhs @@ -18,19 +18,26 @@ import Outputable import Module import TcExpr import {-# SOURCE #-} TcSplice ( runAnnotation ) -import FastString #endif + +import FastString \end{code} \begin{code} tcAnnotations :: [LAnnDecl Name] -> TcM [Annotation] -tcAnnotations = mapM tcAnnotation -tcAnnotation :: LAnnDecl Name -> TcM Annotation #ifndef GHCI --- TODO: modify lexer so ANN pragmas are parsed as comments in a stage1 compiler, so developers don't see this error -tcAnnotation (L _ (HsAnnotation _ expr)) = pprPanic "Cant do annotations without GHCi" (ppr expr) +-- No GHCI; emit a warning (not an error) and ignore. cf Trac #4268 +tcAnnotations [] = return [] +tcAnnotations anns@(L loc _ : _) + = do { setSrcSpan loc $ addWarnTc $ + (ptext (sLit "Ignoring ANN annotation") <> plural anns <> comma + <+> ptext (sLit "because this is a stage-1 compiler or doesn't support GHCi")) + ; return [] } #else +tcAnnotations = mapM tcAnnotation + +tcAnnotation :: LAnnDecl Name -> TcM Annotation tcAnnotation ann@(L loc (HsAnnotation provenance expr)) = do -- Work out what the full target of this annotation was mod <- getModule