[GHC] #8258: GHC accepts `data Foo where` in H2010 mode

#8258: GHC accepts `data Foo where` in H2010 mode --------------------------+------------------------------------------------ Reporter: hvr | Owner: Type: bug | Status: new Priority: low | Milestone: 7.8.1 Component: | Version: 7.0.4 Compiler | Operating System: Unknown/Multiple Keywords: | Type of failure: GHC accepts invalid program Architecture: | Test Case: Unknown/Multiple | Blocking: Difficulty: | Unknown | Blocked By: | Related Tickets: | --------------------------+------------------------------------------------ According to the Haskell2010 report, The grammar productions relevant for `data` declarations are the following: {{{ topdecl → data [context =>] simpletype [= constrs] [deriving] }}} (from [http://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-680004.2 4.2.1 Algebraic Datatype Declarations]) However, GHC 7.0.4/7.4.2/7.6.3/HEAD all happily compile the following Haskell module without any warning when using `-XHaskell2010 -Wall`, even though this is not valid Haskell2010 afaik: {{{#!hs module Foo where data Foo where }}} The trailing `where` in the `data` declaration is not valid Haskell2010 (without language extensions such as `GADT`). At the very least, this divergence from the Haskell Report should be mentioned in [http://www.haskell.org/ghc/docs/latest/html/users_guide /bugs-and-infelicities.html#haskell-standards-divergence 14.1.1. Divergence from Haskell 98 and Haskell 2010]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8258 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8258: GHC accepts `data Foo where` in H2010 mode -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: low | Milestone: 7.12.1 Component: Compiler | Version: 7.0.4 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by siddhanathan): Should a trailing `where` be considered legal? For example, the following is valid: {{{ c = 5 where a = 5 where b = 5 }}} And the code above will be parsed as: {{{ ==================== Parser ==================== c = 5 a = 5 where b = 5 }}} But the trailing `where` after `c = 5` was probably accidental. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8258#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8258: GHC accepts `data Foo where` in H2010 mode -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: low | Milestone: 7.12.1 Component: Compiler | Version: 7.0.4 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * component: Compiler => Compiler (Parser) Comment: `c = 5 where` is ok. From https://www.haskell.org/onlinereport/haskell2010/haskellch4.html: {{{ decl → (funlhs | pat) rhs rhs → = exp [where decls] decls → { decl1 ; … ; decln } (n ≥ 0) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8258#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8258: GHC accepts `data Foo where` in H2010 mode -------------------------------------+------------------------------------- Reporter: hvr | Owner: sighingnow Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.0.4 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC accepts | Test Case: parser/T8258, invalid program | parser/T8258NoGADTs Blocked By: | Blocking: 11384 Related Tickets: | Differential Rev(s): Phab:D4350 Wiki Page: | -------------------------------------+------------------------------------- Changes (by sighingnow): * owner: (none) => sighingnow * testcase: => parser/T8258, parser/T8258NoGADTs * differential: => Phab:D4350 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8258#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8258: GHC accepts `data Foo where` in H2010 mode
-------------------------------------+-------------------------------------
Reporter: hvr | Owner: sighingnow
Type: bug | Status: new
Priority: low | Milestone:
Component: Compiler | Version: 7.0.4
(Parser) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: GHC accepts | Test Case: parser/T8258,
invalid program | parser/T8258NoGADTs
Blocked By: | Blocking: 11384
Related Tickets: | Differential Rev(s): Phab:D4350
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#8258: GHC accepts `data Foo where` in H2010 mode -------------------------------------+------------------------------------- Reporter: hvr | Owner: sighingnow Type: bug | Status: closed Priority: low | Milestone: 8.6.1 Component: Compiler | Version: 7.0.4 (Parser) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC accepts | Test Case: parser/T8258, invalid program | parser/T8258NoGADTs Blocked By: | Blocking: 11384 Related Tickets: | Differential Rev(s): Phab:D4350 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed * milestone: => 8.6.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8258#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC