Re: [GHC] #7351: showRichTokenStream has an off-by one error on starting col

2012-11-29 Thread GHC
#7351: showRichTokenStream has an off-by one error on starting col
---+
  Reporter:  alanz |  Owner:  simonmar
  Type:  bug   | Status:  closed  
  Priority:  normal|  Milestone:  7.6.2   
 Component:  GHC API   |Version:  7.6.1   
Resolution:  fixed |   Keywords:  
Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown  | Difficulty:  Unknown 
  Testcase:|  Blockedby:  
  Blocking:|Related:  
---+
Changes (by igloo):

  * status:  merge => closed
  * resolution:  => fixed


Comment:

 I think we're better off not merging this: if we do, then any workarounds
 people implement for 7.6.1 will mean that they-re off-by-one in the other
 direction with 7.6.2.

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7351: showRichTokenStream has an off-by one error on starting col

2012-10-25 Thread GHC
#7351: showRichTokenStream has an off-by one error on starting col
-+--
Reporter:  alanz |   Owner:  simonmar
Type:  bug   |  Status:  merge   
Priority:  normal|   Milestone:  7.6.2   
   Component:  GHC API   | Version:  7.6.1   
Keywords:|  Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
  Difficulty:  Unknown   |Testcase:  
   Blockedby:|Blocking:  
 Related:|  
-+--
Changes (by simonmar):

  * status:  new => merge


-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7351: showRichTokenStream has an off-by one error on starting col

2012-10-25 Thread GHC
#7351: showRichTokenStream has an off-by one error on starting col
-+--
Reporter:  alanz |   Owner:  simonmar
Type:  bug   |  Status:  new 
Priority:  normal|   Milestone:  7.6.2   
   Component:  GHC API   | Version:  7.6.1   
Keywords:|  Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
  Difficulty:  Unknown   |Testcase:  
   Blockedby:|Blocking:  
 Related:|  
-+--

Comment(by marlowsd@…):

 commit cdf1389865885c190d4b2f0eb81fc659b375fb6f
 {{{
 Author: Simon Marlow 
 Date:   Wed Oct 24 13:23:08 2012 +0100

 fix off-by-one-column in showRichTokenStream (#7351)

  compiler/main/GHC.hs |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 }}}

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7351: showRichTokenStream has an off-by one error on starting col

2012-10-24 Thread GHC
#7351: showRichTokenStream has an off-by one error on starting col
-+--
Reporter:  alanz |   Owner:  simonmar
Type:  bug   |  Status:  new 
Priority:  normal|   Milestone:  7.6.2   
   Component:  GHC API   | Version:  7.6.1   
Keywords:|  Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
  Difficulty:  Unknown   |Testcase:  
   Blockedby:|Blocking:  
 Related:|  
-+--
Changes (by simonmar):

  * owner:  => simonmar
  * milestone:  => 7.6.2


Comment:

 Thanks, I'll commit.

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7351: showRichTokenStream has an off-by one error on starting col

2012-10-24 Thread GHC
#7351: showRichTokenStream has an off-by one error on starting col
-+--
Reporter:  alanz |   Owner:  
Type:  bug   |  Status:  new 
Priority:  normal|   Milestone:  
   Component:  GHC API   | Version:  7.6.1   
Keywords:|  Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
  Difficulty:  Unknown   |Testcase:  
   Blockedby:|Blocking:  
 Related:|  
-+--
Changes (by simonmar):

  * difficulty:  => Unknown


Old description:

> When using showRichTokenStream to re-create a source file, all lines
> after the first one start one column from the left.
>
> The code for advancing to a new line has an off-by one bug where it
> assumes zero based columns.
>
> I have marked what I assume to be a fix in the pasted code below.
>
> ---
> showRichTokenStream ts = go startLoc ts ""
> where sourceFile = getFile $ map (getLoc . fst) ts
>   getFile [] = panic "showRichTokenStream: No source file found"
>   getFile (UnhelpfulSpan _ : xs) = getFile xs
>   getFile (RealSrcSpan s : _) = srcSpanFile s
>   startLoc = mkRealSrcLoc sourceFile 1 1
>   go _ [] = id
>   go loc ((L span _, str):ts)
>   = case span of
> UnhelpfulSpan _ -> go loc ts
> RealSrcSpan s
>  | locLine == tokLine -> ((replicate (tokCol - locCol) '
> ') ++)
>. (str ++)
>. go tokEnd ts
>  | otherwise -> ((replicate (tokLine - locLine) '\n') ++)
>   . ((replicate (tokCol - 1) ' ') ++) -- AZ:
> updated line
>   . (str ++)
>   . go tokEnd ts
>   where (locLine, locCol) = (srcLocLine loc, srcLocCol
> loc)
> (tokLine, tokCol) = (srcSpanStartLine s,
> srcSpanStartCol s)
> tokEnd = realSrcSpanEnd s
> --

New description:

 When using showRichTokenStream to re-create a source file, all lines after
 the first one start one column from the left.

 The code for advancing to a new line has an off-by one bug where it
 assumes zero based columns.

 I have marked what I assume to be a fix in the pasted code below.

 {{{
 showRichTokenStream ts = go startLoc ts ""
 where sourceFile = getFile $ map (getLoc . fst) ts
   getFile [] = panic "showRichTokenStream: No source file found"
   getFile (UnhelpfulSpan _ : xs) = getFile xs
   getFile (RealSrcSpan s : _) = srcSpanFile s
   startLoc = mkRealSrcLoc sourceFile 1 1
   go _ [] = id
   go loc ((L span _, str):ts)
   = case span of
 UnhelpfulSpan _ -> go loc ts
 RealSrcSpan s
  | locLine == tokLine -> ((replicate (tokCol - locCol) '
 ') ++)
. (str ++)
. go tokEnd ts
  | otherwise -> ((replicate (tokLine - locLine) '\n') ++)
   . ((replicate (tokCol - 1) ' ') ++) -- AZ:
 updated line
   . (str ++)
   . go tokEnd ts
   where (locLine, locCol) = (srcLocLine loc, srcLocCol
 loc)
 (tokLine, tokCol) = (srcSpanStartLine s,
 srcSpanStartCol s)
 tokEnd = realSrcSpanEnd s
 }}}

--

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #7351: showRichTokenStream has an off-by one error on starting col

2012-10-20 Thread GHC
#7351: showRichTokenStream has an off-by one error on starting col
--+-
 Reporter:  alanz |  Owner:  
 Type:  bug   | Status:  new 
 Priority:  normal|  Component:  GHC API 
  Version:  7.6.1 |   Keywords:  
   Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown  |   Testcase:  
Blockedby:|   Blocking:  
  Related:|  
--+-
 When using showRichTokenStream to re-create a source file, all lines after
 the first one start one column from the left.

 The code for advancing to a new line has an off-by one bug where it
 assumes zero based columns.

 I have marked what I assume to be a fix in the pasted code below.

 ---
 showRichTokenStream ts = go startLoc ts ""
 where sourceFile = getFile $ map (getLoc . fst) ts
   getFile [] = panic "showRichTokenStream: No source file found"
   getFile (UnhelpfulSpan _ : xs) = getFile xs
   getFile (RealSrcSpan s : _) = srcSpanFile s
   startLoc = mkRealSrcLoc sourceFile 1 1
   go _ [] = id
   go loc ((L span _, str):ts)
   = case span of
 UnhelpfulSpan _ -> go loc ts
 RealSrcSpan s
  | locLine == tokLine -> ((replicate (tokCol - locCol) '
 ') ++)
. (str ++)
. go tokEnd ts
  | otherwise -> ((replicate (tokLine - locLine) '\n') ++)
   . ((replicate (tokCol - 1) ' ') ++) -- AZ:
 updated line
   . (str ++)
   . go tokEnd ts
   where (locLine, locCol) = (srcLocLine loc, srcLocCol
 loc)
 (tokLine, tokCol) = (srcSpanStartLine s,
 srcSpanStartCol s)
 tokEnd = realSrcSpanEnd s
 --

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs