[GHC] #14719: Caret diagnostics for GADT constructor error message don't span the whole constructor

#14719: Caret diagnostics for GADT constructor error message don't span the whole constructor -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 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: -------------------------------------+------------------------------------- Inspecting the caret diagnostics in the error message for this program: {{{#!hs {-# LANGUAGE GADTs #-} module Bug where data Foo1 where MkFoo1 :: Bool newtype Foo2 where MkFoo2 :: Foo2 }}} {{{ $ /opt/ghc/8.2.2/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:5:3: error: • Data constructor ‘MkFoo1’ returns type ‘Bool’ instead of an instance of its parent type ‘Foo1’ • In the definition of data constructor ‘MkFoo1’ In the data type declaration for ‘Foo1’ | 5 | MkFoo1 :: Bool | ^ Bug.hs:8:3: error: • The constructor of a newtype must have exactly one field but ‘MkFoo2’ has none • In the definition of data constructor ‘MkFoo2’ In the newtype declaration for ‘Foo2’ | 8 | MkFoo2 :: Foo2 | ^ }}} We notice something fishy: the carets don't span the entirey of the constructor! Contrast this with the carets for the error message in this program: {{{#!hs {-# LANGUAGE GADTs #-} module Bug where data Foo where MkFoo, MkFoo :: Foo }}} {{{ $ /opt/ghc/8.2.2/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:5:3: error: Multiple declarations of ‘MkFoo’ Declared at: Bug.hs:5:3 Bug.hs:5:3 | 5 | MkFoo, MkFoo :: Foo | ^^^^^^^^^^^^^^^^^^^ }}} Where the carets span everything that is relevant. I know what is causing this: patch incoming. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14719 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14719: Caret diagnostics for GADT constructor error message don't span the whole constructor -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 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:D4344 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D4344 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14719#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14719: Caret diagnostics for GADT constructor error message don't span the whole
constructor
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.2
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:D4344
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#14719: Caret diagnostics for GADT constructor error message don't span the whole constructor -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.2 Resolution: fixed | 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:D4344 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.4.1 Comment: Merged to 8.4 since it is just so darn simple. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14719#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC