[GHC] #11024: Fix strange parsing of BooleanFormula
#11024: Fix strange parsing of BooleanFormula -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Keywords: newcomer | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Consider the following program. {{{ module Foo where class Meh a where foo :: a -> String foo1 :: a -> String foo2 :: a -> String {-# MINIMAL foo, foo1, foo2 #-} }}} The minimal pragma is parsed quite weirdly. {{{ (MinimalSig "{-# MINIMAL" (And [ (Var ({ test.hs:8:15-17 } (Unqual {OccName: foo}))), (And [ (Var ({ test.hs:8:20-23 } (Unqual {OccName: foo1}))), (Var ({ test.hs:8:26-29 } (Unqual {OccName: foo2})))])])))] {Bag(Located (HsBind RdrName)):}}} To be clear, it is parsed as `And [foo, [And [foo1, foo2]]` rather than `And [foo, foo1, foo2]`. Either the datatype should be change to be more like a binary tree or the parser should be changed to handle this properly. I think the second option would be easiest. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11024: Fix strange parsing of BooleanFormula -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by mpickering: Old description:
Consider the following program.
{{{ module Foo where
class Meh a where foo :: a -> String foo1 :: a -> String foo2 :: a -> String
{-# MINIMAL foo, foo1, foo2 #-} }}}
The minimal pragma is parsed quite weirdly.
{{{ (MinimalSig "{-# MINIMAL" (And [ (Var ({ test.hs:8:15-17 } (Unqual {OccName: foo}))), (And [ (Var ({ test.hs:8:20-23 } (Unqual {OccName: foo1}))), (Var ({ test.hs:8:26-29 } (Unqual {OccName: foo2})))])])))] {Bag(Located (HsBind RdrName)):}}}
To be clear, it is parsed as `And [foo, [And [foo1, foo2]]` rather than `And [foo, foo1, foo2]`.
Either the datatype should be change to be more like a binary tree or the parser should be changed to handle this properly. I think the second option would be easiest.
New description: Consider the following program. {{{ module Foo where class Meh a where foo :: a -> String foo1 :: a -> String foo2 :: a -> String {-# MINIMAL foo, foo1, foo2 #-} }}} The minimal pragma is parsed quite weirdly. {{{ (MinimalSig "{-# MINIMAL" (And [ (Var ({ test.hs:8:15-17 } (Unqual {OccName: foo}))), (And [ (Var ({ test.hs:8:20-23 } (Unqual {OccName: foo1}))), (Var ({ test.hs:8:26-29 } (Unqual {OccName: foo2})))])])))] {Bag(Located (HsBind RdrName)): }}} To be clear, it is parsed as `And [foo, [And [foo1, foo2]]` rather than `And [foo, foo1, foo2]`. Either the datatype should be change to be more like a binary tree or the parser should be changed to handle this properly. I think the second option would be easiest. -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11024: Fix strange parsing of BooleanFormula -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by mpickering: Old description:
Consider the following program.
{{{ module Foo where
class Meh a where foo :: a -> String foo1 :: a -> String foo2 :: a -> String
{-# MINIMAL foo, foo1, foo2 #-} }}}
The minimal pragma is parsed quite weirdly.
{{{ (MinimalSig "{-# MINIMAL" (And [ (Var ({ test.hs:8:15-17 } (Unqual {OccName: foo}))), (And [ (Var ({ test.hs:8:20-23 } (Unqual {OccName: foo1}))), (Var ({ test.hs:8:26-29 } (Unqual {OccName: foo2})))])])))] {Bag(Located (HsBind RdrName)): }}}
To be clear, it is parsed as `And [foo, [And [foo1, foo2]]` rather than `And [foo, foo1, foo2]`.
Either the datatype should be change to be more like a binary tree or the parser should be changed to handle this properly. I think the second option would be easiest.
New description: Consider the following program. {{{ module Foo where class Meh a where foo :: a -> String foo1 :: a -> String foo2 :: a -> String {-# MINIMAL foo, foo1, foo2 #-} }}} The minimal pragma is parsed quite weirdly. {{{ (MinimalSig "{-# MINIMAL" (And [ (Var ({ test.hs:8:15-17 } (Unqual {OccName: foo}))), (And [ (Var ({ test.hs:8:20-23 } (Unqual {OccName: foo1}))), (Var ({ test.hs:8:26-29 } (Unqual {OccName: foo2})))])])))] {Bag(Located (HsBind RdrName)): }}} To be clear, it is parsed as `And [foo, And [foo1, foo2]]` rather than `And [foo, foo1, foo2]`. Either the datatype should be change to be more like a binary tree or the parser should be changed to handle this properly. I think the second option would be easiest. -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11024: Fix strange parsing of BooleanFormula -------------------------------------+------------------------------------- Reporter: mpickering | Owner: bollu Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bollu): * owner: => bollu -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11024: Fix strange parsing of BooleanFormula -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * owner: bollu => Comment: Feel free to assign it back to yourself when you want to continue @bollu -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11024: Fix strange parsing of BooleanFormula -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ethercrow): I've tried fixing this in the parser but I don't understand how to write a test for this. Parser tests in the test suite seem to check the output of compiled haskell programs or the error messages, and the way of parsing this pragma shouldn't affect either. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11024: Fix strange parsing of BooleanFormula -------------------------------------+------------------------------------- Reporter: mpickering | Owner: ethercrow Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by ethercrow): * owner: (none) => ethercrow -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11024: Fix strange parsing of BooleanFormula -------------------------------------+------------------------------------- Reporter: mpickering | Owner: ethercrow Type: task | Status: patch Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://phabricator.haskell.org/D3139 -------------------------------------+------------------------------------- Changes (by ethercrow): * status: new => patch * differential: => https://phabricator.haskell.org/D3139 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11024: Fix strange parsing of BooleanFormula -------------------------------------+------------------------------------- Reporter: mpickering | Owner: ethercrow Type: task | Status: patch Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://phabricator.haskell.org/D3139 -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"4ad36206285a84bfc3c9f7d41c55bba83bfdffef/ghc" 4ad3620/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="4ad36206285a84bfc3c9f7d41c55bba83bfdffef" Fix parsing of And chains in BoolFormula Parse `foo, bar, baz` into `And [foo, bar, baz]` instead of `And [foo, And [bar, baz]]`. Fixes #11024. Test Plan: read and think Reviewers: austin, bgamari, mpickering Reviewed By: bgamari, mpickering Subscribers: ezyang, thomie, alanz Differential Revision: https://phabricator.haskell.org/D3139 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11024: Fix strange parsing of BooleanFormula -------------------------------------+------------------------------------- Reporter: mpickering | Owner: ethercrow Type: task | Status: patch Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://phabricator.haskell.org/D3139 -------------------------------------+------------------------------------- Comment (by monoidal): Should this ticket be closed? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11024: Fix strange parsing of BooleanFormula -------------------------------------+------------------------------------- Reporter: mpickering | Owner: ethercrow Type: task | Status: patch Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://phabricator.haskell.org/D3139 -------------------------------------+------------------------------------- Comment (by ethercrow): Yes, this can be closed. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11024: Fix strange parsing of BooleanFormula -------------------------------------+------------------------------------- Reporter: mpickering | Owner: ethercrow Type: task | Status: closed Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Parser) | Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://phabricator.haskell.org/D3139 -------------------------------------+------------------------------------- Changes (by monoidal): * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024#comment:11> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC