[GHC] #13986: TypeApplications causes parse errors in @-patterns with certain Unicode characters
#13986: TypeApplications causes parse errors in @-patterns with certain Unicode characters -------------------------------------+------------------------------------- Reporter: Tikhon | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC rejects Unknown/Multiple | valid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following function definition works without TypeApplications but fails to parse with the extension enabled: {{{#!hs {-# LANGUAGE TypeApplications #-} module Mininal where foo x₁@True = 10 }}} It also parses correctly with "x" in place of "x₁". -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13986> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13986: TypeApplications causes parse errors in @-patterns with certain Unicode characters -------------------------------------+------------------------------------- Reporter: Tikhon | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by Tikhon: Old description:
The following function definition works without TypeApplications but fails to parse with the extension enabled:
{{{#!hs {-# LANGUAGE TypeApplications #-} module Mininal where
foo x₁@True = 10 }}}
It also parses correctly with "x" in place of "x₁".
New description: The following function definition works without TypeApplications but fails to parse with the extension enabled: {{{#!hs {-# LANGUAGE TypeApplications #-} module Mininal where foo x₁@True = 10 }}} It also parses correctly with "x" in place of "x₁". Parse error: {{{ Minimal.hs:5:1-11: error: … Parse error in pattern: foo x₁ @True Compilation failed. }}} -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13986#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13986: TypeApplications causes parse errors in @-patterns with certain Unicode characters -------------------------------------+------------------------------------- Reporter: Tikhon | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Keywords: Resolution: | TypeApplications Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: => TypeApplications -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13986#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13986: TypeApplications causes parse errors in @-patterns with certain Unicode characters -------------------------------------+------------------------------------- Reporter: Tikhon | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Keywords: Resolution: | TypeApplications Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://phabricator.haskell.org/D4105 -------------------------------------+------------------------------------- Changes (by harpocrates): * differential: => https://phabricator.haskell.org/D4105 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13986#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13986: TypeApplications causes parse errors in @-patterns with certain Unicode characters -------------------------------------+------------------------------------- Reporter: Tikhon | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Keywords: Resolution: | TypeApplications Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://phabricator.haskell.org/D4105 -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"821adee12e89dbd0a52fde872b633e4e2e9051dc/ghc" 821adee1/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="821adee12e89dbd0a52fde872b633e4e2e9051dc" Fix a bug in 'alexInputPrevChar' The lexer hacks around unicode by squishing any character into a 'Word8' and then storing the actual character in its state. This happens at 'alexGetByte'. That is all and well, but we ought to be careful that the characters we retrieve via 'alexInputPrevChar' also fit this convention. In fact, #13986 exposes nicely what can go wrong: the regex in the left context of the type application rule uses the '$idchar' character set which relies on the unicode hack. However, a left context corresponds to a call to 'alexInputPrevChar', and we end up passing full blown unicode characters to '$idchar', despite it not being equipped to deal with these. Test Plan: Added a regression test case Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13986 Differential Revision: https://phabricator.haskell.org/D4105 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13986#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13986: TypeApplications causes parse errors in @-patterns with certain Unicode characters -------------------------------------+------------------------------------- Reporter: Tikhon | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 (Parser) | Keywords: Resolution: fixed | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | parser/should_compile/T13986.hs Blocked By: | Blocking: Related Tickets: | Differential Rev(s): phab:D4105 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * testcase: => parser/should_compile/T13986.hs * status: new => closed * differential: https://phabricator.haskell.org/D4105 => phab:D4105 * resolution: => fixed * milestone: => 8.4.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13986#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC