From 6728b58989206e801835690fa3d503f79708a8a7 Mon Sep 17 00:00:00 2001 From: Debian Haskell Group Date: Wed, 1 Apr 2015 11:35:10 +0000 Subject: [PATCH] ghc-ignore-ANN-annotation Gbp-Pq: Name ghc-ignore-ANN-annotation.patch --- compiler/typecheck/TcAnnotations.lhs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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 -- 2.30.2