on master help sign in
Fix some expected failures in damlc-shake-tests (#2010)

Most of them were caused by off-by-one errors in goto definition. There was also one test that was marked as an expected failure but the actual bug has been fixed for some time and the only reason it was failing is that the error message was different than the test expected. I’ve also renamed daml-ghc-shake-test-ci to damlc-shake-tests which is something that I might actually be able to remember :)

commit5beb77cdb0021ee150573ea5f127f8b6d2ce8b51 authorMoritz Kiefer <moritz.kiefer@purelyfunctional.org> dateThu 4 Jul 2019, 16:57 (7 years ago) parent1fee8b0
3 files changed+13−9
src/Development/IDE/Spans/AtPoint.hs+5−3 src/Development/IDE/Spans/Calculate.hs+4−2 src/Development/IDE/Spans/Type.hs+4−4
src/Development/IDE/Spans/AtPoint.hs+5−3
@@ -124,12 +124,14 @@ locationsAtPoint getHieFile IdeOptions{..} pkgState pos =
124124
125125spansAtPoint :: Position -> [SpanInfo] -> [SpanInfo]
126126spansAtPoint pos = filter atp where
127− line = _line pos + 1
128− cha = _character pos + 1
127+ line = _line pos
128+ cha = _character pos
129129 atp SpanInfo{..} = spaninfoStartLine <= line
130130 && spaninfoEndLine >= line
131131 && spaninfoStartCol <= cha
132− && spaninfoEndCol >= cha
132+ -- The end col points to the column after the
133+ -- last character so we use > instead of >=
134+ && spaninfoEndCol > cha
133135
134136showName :: Outputable a => a -> T.Text
135137showName = T.pack . prettyprint
src/Development/IDE/Spans/Calculate.hs+4−2
@@ -167,9 +167,11 @@ toSpanInfo :: (SpanSource, SrcSpan, Maybe Type) -> Maybe SpanInfo
167167toSpanInfo (name,mspan,typ) =
168168 case mspan of
169169 RealSrcSpan spn ->
170− Just (SpanInfo (srcSpanStartLine spn)
170+ -- GHC’s line and column numbers are 1-based while LSP’s line and column
171+ -- numbers are 0-based.
172+ Just (SpanInfo (srcSpanStartLine spn - 1)
171173 (srcSpanStartCol spn - 1)
172− (srcSpanEndLine spn)
174+ (srcSpanEndLine spn - 1)
173175 (srcSpanEndCol spn - 1)
174176 typ
175177 name)
src/Development/IDE/Spans/Type.hs+4−4
@@ -21,13 +21,13 @@ import OccName
2121-- unboxed but Haddock doesn't show that.
2222data SpanInfo =
2323 SpanInfo {spaninfoStartLine :: {-# UNPACK #-} !Int
24− -- ^ Start line of the span.
24+ -- ^ Start line of the span, zero-based.
2525 ,spaninfoStartCol :: {-# UNPACK #-} !Int
26− -- ^ Start column of the span.
26+ -- ^ Start column of the span, zero-based.
2727 ,spaninfoEndLine :: {-# UNPACK #-} !Int
28− -- ^ End line of the span (absolute).
28+ -- ^ End line of the span (absolute), zero-based.
2929 ,spaninfoEndCol :: {-# UNPACK #-} !Int
30− -- ^ End column of the span (absolute).
30+ -- ^ End column of the span (absolute), zero-based.
3131 ,spaninfoType :: !(Maybe Type)
3232 -- ^ A pretty-printed representation fo the type.
3333 ,spaninfoSource :: !SpanSource