Correct the advanceSrcLoc calculation for tabs
authorIan Lynagh <igloo@earth.li>
Sun, 29 Nov 2009 15:39:33 +0000 (15:39 +0000)
committerIan Lynagh <igloo@earth.li>
Sun, 29 Nov 2009 15:39:33 +0000 (15:39 +0000)
It was off-by-one

compiler/basicTypes/SrcLoc.lhs

index e213bef..e1a2a43 100644 (file)
@@ -138,7 +138,7 @@ srcLocCol _other         = panic "srcLocCol: unknown col"
 -- character in any other case
 advanceSrcLoc :: SrcLoc -> Char -> SrcLoc
 advanceSrcLoc (SrcLoc f l _) '\n' = SrcLoc f  (l + 1) 1
-advanceSrcLoc (SrcLoc f l c) '\t' = SrcLoc f  l ((((c `shiftR` 3) + 1)
+advanceSrcLoc (SrcLoc f l c) '\t' = SrcLoc f  l (((((c - 1) `shiftR` 3) + 1)
                                                   `shiftL` 3) + 1)
 advanceSrcLoc (SrcLoc f l c) _    = SrcLoc f  l (c + 1)
 advanceSrcLoc loc            _    = loc -- Better than nothing