diff options
| author | Herbert Valerio Riedel <hvr@gnu.org> | 2016-02-27 17:34:14 +0100 |
|---|---|---|
| committer | Herbert Valerio Riedel <hvr@gnu.org> | 2016-02-27 17:34:14 +0100 |
| commit | 869d9c62d8329022f9f5504a92d2d74efec4f2e8 (patch) | |
| tree | d0a0f668c423ffff8a5c92235052c5bc565428f3 /compiler | |
| parent | b9c697eefd34fcba3ab9c1f831baf7f651ad7503 (diff) | |
| download | haskell-869d9c62d8329022f9f5504a92d2d74efec4f2e8.tar.gz | |
Print which flag controls emitted lexer warnings
This is extends bb5afd3c274011c5ea302210b4c290ec1f83209c to cover
warnings emitted during lexing.
This implements another part of #10752
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/parser/Lexer.x | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 71478026c9..650b302b54 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -2206,7 +2206,8 @@ mkPState flags buf loc = addWarning :: WarningFlag -> SrcSpan -> SDoc -> P () addWarning option srcspan warning = P $ \s@PState{messages=(ws,es), dflags=d} -> - let warning' = mkWarnMsg d srcspan alwaysQualify warning + let warning' = makeIntoWarning (Reason option) $ + mkWarnMsg d srcspan alwaysQualify warning ws' = if wopt option d then ws `snocBag` warning' else ws in POk s{messages=(ws', es)} () @@ -2229,7 +2230,8 @@ mkTabWarning PState{tab_first=tf, tab_count=tc, dflags=d} = <> middle <> text "." $+$ text "Please use spaces instead." - in fmap (\s -> mkWarnMsg d (RealSrcSpan s) alwaysQualify message) tf + in fmap (\s -> makeIntoWarning (Reason Opt_WarnTabs) $ + mkWarnMsg d (RealSrcSpan s) alwaysQualify message) tf getMessages :: PState -> Messages getMessages p@PState{messages=(ws,es)} = |
