[GHC] #11004: hsc2hs does not handle single quotes properly

#11004: hsc2hs does not handle single quotes properly -------------------------------------+------------------------------------- Reporter: sergv | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: hsc2hs | Version: 7.10.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The tool gets confused by quotes for promoted constructors (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/promotion.ht... #promotion-syntax). Here's an example: {{{#!hs {-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} data Foo = Foo | Bar data Indexed ix where Indexed :: Indexed 'Foo main :: IO () main = print $ #size int }}} gets translated into {{{#!hs {-# LINE 1 "Test.hsc" #-} {-# LANGUAGE DataKinds #-} {-# LINE 2 "Test.hsc" #-} {-# LANGUAGE GADTs #-} data Foo = Foo | Bar data Indexed ix where Indexed :: Indexed 'Foo main :: IO () main = print $ #size int }}} Then GHC complains about `#size`: {{{ Test.hsc:10:16: parse error on input ‘#’ }}} Judging from the source of utils/hsc2hs/HSCParser.hs, the tool treats single quotes the same way as double quotes. I.e. it looks for balanced, possibly multiline, strings delimited by '. At least, it seems unnecessary to expect newlines in that string-like structure, because character literals cannot contain newlines, AFAIK. It's interesting to note that this problem looks like a bit of an edge case, since highlighting in the ticket seems to be confused as well. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11004 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11004: hsc2hs does not handle single quotes properly -------------------------------------+------------------------------------- Reporter: sergv | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: hsc2hs | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by sergv): * Attachment "Test.hsc" added. Sample that triggers the bug -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11004 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11004: hsc2hs does not handle single quotes properly -------------------------------------+------------------------------------- Reporter: sergv | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: hsc2hs | Version: 7.10.2 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * keywords: => newcomer Comment: Thank you for the report. Since you looked at the code already: would you like to submit a patch? See [wiki:Newcomers] and [wiki:WorkingConventions/FixingBugs]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11004#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11004: hsc2hs does not handle single quotes properly -------------------------------------+------------------------------------- Reporter: sergv | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: hsc2hs | Version: 7.10.2 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by sergv): Yes, I'd like to fix this issue. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11004#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11004: hsc2hs does not handle single quotes properly -------------------------------------+------------------------------------- Reporter: sergv | Owner: sergv Type: bug | Status: new Priority: normal | Milestone: Component: hsc2hs | Version: 7.10.2 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by sergv): * owner: => sergv -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11004#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11004: hsc2hs does not handle single quotes properly -------------------------------------+------------------------------------- Reporter: sergv | Owner: sergv Type: bug | Status: new Priority: normal | Milestone: Component: hsc2hs | Version: 7.10.2 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by tmobile): I just hit this. Anyone have a patch? If not I'll try to have someone work on this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11004#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11004: hsc2hs does not handle single quotes properly -------------------------------------+------------------------------------- Reporter: sergv | Owner: sergv Type: bug | Status: new Priority: normal | Milestone: Component: hsc2hs | Version: 7.10.2 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by sergv): I've never got around to actually doing this issue, so there's no patch. Please feel free to reassign as you see fit. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11004#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11004: hsc2hs does not handle single quotes properly -------------------------------------+------------------------------------- Reporter: sergv | Owner: tmobile Type: bug | Status: new Priority: normal | Milestone: Component: hsc2hs | Version: 7.10.2 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by tmobile): * owner: sergv => tmobile -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11004#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11004: hsc2hs does not handle single quotes properly -------------------------------------+------------------------------------- Reporter: sergv | Owner: tmobile Type: bug | Status: new Priority: normal | Milestone: Component: hsc2hs | Version: 7.10.2 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by andrewthad): I just ran into this problem as well. It's easy to work around by just omitting the single quotes. I may try to fix this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11004#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11004: hsc2hs does not handle single quotes properly -------------------------------------+------------------------------------- Reporter: sergv | Owner: tmobile Type: bug | Status: closed Priority: normal | Milestone: Component: hsc2hs | Version: 7.10.2 Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by chessai): * status: new => closed * resolution: => fixed Comment: fixed in https://github.com/haskell/hsc2hs/commit/fac8b62e48f4c99cfe8f3efff63c8fcd94b... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11004#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11004: hsc2hs does not handle single quotes properly -------------------------------------+------------------------------------- Reporter: sergv | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: hsc2hs | Version: 7.10.2 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * owner: tmobile => (none) * status: closed => new * resolution: fixed => Comment: While this feature has been added to `hsc2hs`, I'd like to keep this ticket open since there are two remaining tasks to be done on GHC's side: * Update GHC's `hsc2hs` submodule to actually use this new `hsc2hs` feature. * Add some tests cases to GHC's testsuite which demonstrate that this feature actually works. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11004#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11004: hsc2hs does not handle single quotes properly -------------------------------------+------------------------------------- Reporter: sergv | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.8.1 Component: hsc2hs | Version: 7.10.2 Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: hsc2hs/T11004 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/173 -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * testcase: => hsc2hs/T11004 * differential: => https://gitlab.haskell.org/ghc/ghc/merge_requests/173 * resolution: => fixed * milestone: => 8.8.1 Comment: A test was added (and the `hsc2hs` submodule bumped) in [https://gitlab.haskell.org/ghc/ghc/commit/79a5afb613235e93bc2c580987595b9c13... 79a5afb613235e93bc2c580987595b9c1324db15]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11004#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC