[GHC] #10537: Parser: commas_tup_tail returns spurious "Missing" value

#10537: Parser: commas_tup_tail returns spurious "Missing" value -------------------------------------+------------------------------------- Reporter: alanz | Owner: alanz Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 (Parser) | Operating System: Unknown/Multiple Keywords: | Type of failure: None/Unknown Architecture: | Blocked By: Unknown/Multiple | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Parsing {{{#!hs {-# LANGUAGE TupleSections #-} baz = (1, "hello", 6.5,,) 'a' (Just ()) }}} Results in the following AST fragment {{{ (L tests/examples/Tuple.hs:3:7-25 (ExplicitTuple [ L tests/examples/Tuple.hs:3:8 (Present (L tests/examples/Tuple.hs:3:8 (HsOverLit (OverLit (HsIntegral [ '1' ] 1) PlaceHolder (HsLit (HsString [] {abstract:FastString})) PlaceHolder)))) , L tests/examples/Tuple.hs:3:11-17 (Present (L tests/examples/Tuple.hs:3:11-17 (HsLit (HsString [ '"' , 'h' , 'e' , 'l' , 'l' , 'o' , '"' ] {abstract:FastString})))) , L tests/examples/Tuple.hs:3:20-22 (Present (L tests/examples/Tuple.hs:3:20-22 (HsOverLit (OverLit (HsFractional (FL [ '6' , '.' , '5' ] (:% 13 2))) PlaceHolder (HsLit (HsString [] {abstract:FastString})) PlaceHolder)))) , L tests/examples/Tuple.hs:3:24 (Missing PlaceHolder) , L tests/examples/Tuple.hs:3:24 (Missing PlaceHolder) ] }}} The final `Missing PlaceHolder` is duplicated -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10537 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10537: Parser: commas_tup_tail returns spurious "Missing" value -------------------------------------+------------------------------------- Reporter: alanz | Owner: alanz Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 (Parser) | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by simonpj): It doesn't look duplicated to me. There are indeed two missing elements in the tuple. Do you have a program that goes wrong? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10537#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10537: Parser: commas_tup_tail returns spurious "Missing" value -------------------------------------+------------------------------------- Reporter: alanz | Owner: alanz Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 (Parser) | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by mpickering): I think you're right Simon. There is something wrong with the annotations though, firstly both the Missing elements have the same SrcSpan `L tests/examples/Tuple.hs:3:24`. {{{ ((tests/examples/Tuple.hs:3:8, AnnComma), [tests/examples/Tuple.hs:3:9]), ((tests/examples/Tuple.hs:3:11-17, AnnComma), [tests/examples/Tuple.hs:3:18]), ((tests/examples/Tuple.hs:3:20-22, AnnComma), [tests/examples/Tuple.hs:3:23]), ((tests/examples/Tuple.hs:3:24, AnnComma), [tests/examples/Tuple.hs:3:24]), }}} Here are the relevant annotations. Notice how the first three commas are associated with the preceding item (much like they are for lists) but the last one is associated directly with the `Missing`. As both `Missing`s have the same SrcSpan then this is causing duplicated output in `ghc- exactprint`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10537#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10537: Parser: commas_tup_tail duplicate SrcSpan on "Missing" value -------------------------------------+------------------------------------- Reporter: alanz | Owner: alanz Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 (Parser) | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Description changed by alanz: Old description:
Parsing
{{{#!hs {-# LANGUAGE TupleSections #-}
baz = (1, "hello", 6.5,,) 'a' (Just ()) }}}
Results in the following AST fragment
{{{ (L tests/examples/Tuple.hs:3:7-25 (ExplicitTuple [ L tests/examples/Tuple.hs:3:8 (Present (L tests/examples/Tuple.hs:3:8 (HsOverLit (OverLit (HsIntegral [ '1' ] 1) PlaceHolder (HsLit (HsString [] {abstract:FastString})) PlaceHolder)))) , L tests/examples/Tuple.hs:3:11-17 (Present (L tests/examples/Tuple.hs:3:11-17 (HsLit (HsString [ '"' , 'h' , 'e' , 'l' , 'l' , 'o' , '"' ] {abstract:FastString})))) , L tests/examples/Tuple.hs:3:20-22 (Present (L tests/examples/Tuple.hs:3:20-22 (HsOverLit (OverLit (HsFractional (FL [ '6' , '.' , '5' ] (:% 13 2))) PlaceHolder (HsLit (HsString [] {abstract:FastString})) PlaceHolder)))) , L tests/examples/Tuple.hs:3:24 (Missing PlaceHolder) , L tests/examples/Tuple.hs:3:24 (Missing PlaceHolder) ] }}}
The final `Missing PlaceHolder` is duplicated
New description: Parsing {{{#!hs {-# LANGUAGE TupleSections #-} baz = (1, "hello", 6.5,,) 'a' (Just ()) }}} Results in the following AST fragment {{{ (L tests/examples/Tuple.hs:3:7-25 (ExplicitTuple [ L tests/examples/Tuple.hs:3:8 (Present (L tests/examples/Tuple.hs:3:8 (HsOverLit (OverLit (HsIntegral [ '1' ] 1) PlaceHolder (HsLit (HsString [] {abstract:FastString})) PlaceHolder)))) , L tests/examples/Tuple.hs:3:11-17 (Present (L tests/examples/Tuple.hs:3:11-17 (HsLit (HsString [ '"' , 'h' , 'e' , 'l' , 'l' , 'o' , '"' ] {abstract:FastString})))) , L tests/examples/Tuple.hs:3:20-22 (Present (L tests/examples/Tuple.hs:3:20-22 (HsOverLit (OverLit (HsFractional (FL [ '6' , '.' , '5' ] (:% 13 2))) PlaceHolder (HsLit (HsString [] {abstract:FastString})) PlaceHolder)))) , L tests/examples/Tuple.hs:3:24 (Missing PlaceHolder) , L tests/examples/Tuple.hs:3:24 (Missing PlaceHolder) ] }}} The final `Missing PlaceHolder` has a duplicated SrcSpan -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10537#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10537: Parser: commas_tup_tail duplicate SrcSpan on "Missing" value -------------------------------------+------------------------------------- Reporter: alanz | Owner: alanz Type: bug | Status: patch Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 (Parser) | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by alanz): * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10537#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10537: Parser: commas_tup_tail duplicate SrcSpan on "Missing" value -------------------------------------+------------------------------------- Reporter: alanz | Owner: alanz Type: bug | Status: patch Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 (Parser) | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D995 -------------------------------------+------------------------------------- Changes (by alanz): * differential: => Phab:D995 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10537#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10537: Parser: commas_tup_tail duplicate SrcSpan on "Missing" value
-------------------------------------+-------------------------------------
Reporter: alanz | Owner: alanz
Type: bug | Status: patch
Priority: normal | Milestone: 7.10.2
Component: Compiler | Version: 7.10.1
(Parser) | Keywords:
Resolution: | Architecture:
Operating System: Unknown/Multiple | Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions: Phab:D995
-------------------------------------+-------------------------------------
Comment (by Alan Zimmerman

#10537: Parser: commas_tup_tail duplicate SrcSpan on "Missing" value -------------------------------------+------------------------------------- Reporter: alanz | Owner: alanz Type: bug | Status: merge Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 (Parser) | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D995 -------------------------------------+------------------------------------- Changes (by alanz): * status: patch => merge -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10537#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10537: Parser: commas_tup_tail duplicate SrcSpan on "Missing" value -------------------------------------+------------------------------------- Reporter: alanz | Owner: alanz Type: bug | Status: closed Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 (Parser) | Keywords: Resolution: fixed | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D995 -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-7.10`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10537#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC