diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2020-01-23 23:03:04 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-02-29 05:06:31 -0500 |
commit | 327b29e1a05d9f1ea04465c9b23aed92473dd453 (patch) | |
tree | 0b6db26b4677c2677a32754de523eb842f9cb849 /utils | |
parent | 37f126033f1e5bf0331143f005ef90ba6e2e02cd (diff) | |
download | haskell-327b29e1a05d9f1ea04465c9b23aed92473dd453.tar.gz |
Monotonic locations (#17632)
When GHC is parsing a file generated by a tool, e.g. by the C preprocessor, the
tool may insert #line pragmas to adjust the locations reported to the user.
As the result, the locations recorded in RealSrcLoc are not monotonic. Elements
that appear later in the StringBuffer are not guaranteed to have a higher
line/column number.
In fact, there are no guarantees whatsoever, as #line pragmas can arbitrarily
modify locations. This lack of guarantees makes ideas such as #17544
infeasible.
This patch adds an additional bit of information to every SrcLoc:
newtype BufPos = BufPos { bufPos :: Int }
A BufPos represents the location in the StringBuffer, unaffected by any
pragmas.
Updates haddock submodule.
Metric Increase:
haddock.Cabal
haddock.base
haddock.compiler
MultiLayerModules
Naperian
parsing001
T12150
Diffstat (limited to 'utils')
-rw-r--r-- | utils/check-api-annotations/Main.hs | 2 | ||||
m--------- | utils/haddock | 0 |
2 files changed, 1 insertions, 1 deletions
diff --git a/utils/check-api-annotations/Main.hs b/utils/check-api-annotations/Main.hs index 51d389ce13..83568c573f 100644 --- a/utils/check-api-annotations/Main.hs +++ b/utils/check-api-annotations/Main.hs @@ -82,7 +82,7 @@ testOneFile libdir fileName = do getAllSrcSpans ast = everything (++) ([] `mkQ` getSrcSpan) ast where getSrcSpan :: SrcSpan -> [RealSrcSpan] - getSrcSpan (RealSrcSpan ss) = [ss] + getSrcSpan (RealSrcSpan ss _) = [ss] getSrcSpan (UnhelpfulSpan _) = [] diff --git a/utils/haddock b/utils/haddock -Subproject 78d0e033a2f8ce5dc1f5e2e4eb8b823ee4d1d1b +Subproject b104c573fdc6efcecc3bfaa2fb6084b7679f32d |