[GHC] #13450: Better parse error for empy character literal
#13450: Better parse error for empy character literal -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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: -------------------------------------+------------------------------------- Empty character literals give an obscure error message. As an example, this code: {{{#!hs example = foo : bar where foo = '' bar = "asdf" }}} gives the following error when loaded in GHCi: {{{ err.hs:4:6: parse error (possibly incorrect indentation or mismatched brackets) }}} This has affected me once, as a beginner. I've seen it affect a few other beginners, and the error message isn't very helpful to figuring out what's wrong. It would be nice if a better error message could be reported. If there's a parse error on `''`, then GHC could report something like: {{{ err.hs:3:11: parse error on `''`. Note: Character literals may not be empty. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13450> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13450: Better parse error for empy character literal -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"74cd1be0b2778ad99566cde085328bde2090294a/ghc" 74cd1be0/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="74cd1be0b2778ad99566cde085328bde2090294a" Don't deeply expand insolubles Trac #13450 went bananas if we expand insoluble constraints. Better just to leave them un-expanded. I'm not sure in detail about why it goes so badly wrong; but regardless, the less we mess around with insoluble contraints the better the error messages will be. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13450#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13450: Better parse error for empy character literal -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | typecheck/should_fail/T14350 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => typecheck/should_fail/T14350 * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13450#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13450: Better parse error for empy character literal -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | typecheck/should_fail/T14350 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Simon, the commit here doesn't fix this issue. (Did you mean #14350?) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13450#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13450: Better parse error for empy character literal -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: closed => new * testcase: typecheck/should_fail/T14350 => * resolution: fixed => Comment: Darn. Yes, typo. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13450#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13450: Better parse error for empy character literal -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: feature request | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | parser/should_fail/T13450 | parser/should_fail/T13450TH Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4594 Wiki Page: | -------------------------------------+------------------------------------- Changes (by sighingnow): * status: new => patch * testcase: => parser/should_fail/T13450 parser/should_fail/T13450TH * differential: => Phab:D4594 * component: Compiler => Compiler (Parser) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13450#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13450: Better parse error for empy character literal -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: feature request | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | parser/should_fail/T13450 | parser/should_fail/T13450TH Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4594 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"cac8be611e7e80ed80e24b15faac9e1ac0a07247/ghc" cac8be6/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="cac8be611e7e80ed80e24b15faac9e1ac0a07247" Better error message for empty character literal, for Trac #13450. For empty character literal, the `''`, report error message properly rather than just throw a "parser error" with wrong error location. Test Plan: make test TEST="T13450 T13450TH" Reviewers: goldfire, bgamari Reviewed By: bgamari Subscribers: thomie, mpickering, carter GHC Trac Issues: #13450 Differential Revision: https://phabricator.haskell.org/D4594 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13450#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13450: Better parse error for empy character literal -------------------------------------+------------------------------------- Reporter: parsonsmatt | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.0.1 (Parser) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | parser/should_fail/T13450 | parser/should_fail/T13450TH Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4594 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.6.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13450#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC