[GHC] #15139: EmptyCase produces incorrect SrcSpans

#15139: EmptyCase produces incorrect SrcSpans -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.2 (Parser) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Poor/confusing Unknown/Multiple | error message Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- If you compile the following program, you'll get a warning for `f` with an improperly placed `SrcSpan`: {{{#!hs {-# LANGUAGE EmptyCase #-} {-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wincomplete-patterns #-} module Bug where import Data.Type.Equality can'tHappen :: Int :~: Bool can'tHappen = undefined f, g :: Bool -> Bool f True = case can'tHappen of {} g True = case () of () -> True }}} {{{ $ /opt/ghc/8.4.2/bin/ghci Bug.hs GHCi, version 8.4.2: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Bug.hs:12:1: warning: [-Wincomplete-patterns] Pattern match(es) are non-exhaustive In an equation for ‘f’: Patterns not matched: False | 12 | f True = case can'tHappen of {} | ^^^^^^^^^^^^^ Bug.hs:13:1: warning: [-Wincomplete-patterns] Pattern match(es) are non-exhaustive In an equation for ‘g’: Patterns not matched: False | 13 | g True = case () of () -> True | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Ok, one module loaded. }}} Compare that to the warning for `g`, whose `SrcSpan` spans the entire clause, as expected. The bug lies in the parser—patch incoming. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15139 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15139: EmptyCase produces incorrect SrcSpans -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.2 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4685 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D4685 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15139#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15139: EmptyCase produces incorrect SrcSpans
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.4.2
(Parser) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Poor/confusing | Unknown/Multiple
error message | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D4685
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#15139: EmptyCase produces incorrect SrcSpans -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.2 (Parser) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | parser/should_compile/T15139 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4685 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => closed * testcase: => parser/should_compile/T15139 * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15139#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC