[GHC] #14109: GHC matches -- as a varsym when lexing a qvarsym

#14109: GHC matches -- as a varsym when lexing a qvarsym -------------------------------------+------------------------------------- Reporter: glguy | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Parser) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- GHC seems only to exclude the line comment marker `--` when lexing a varsym and not a qvarsym. This can be observed in the following code {{{ module Demo where x Demo.-- y = (x,y) }}} Generating this surprising error message {{{ /Users/emertens/Desktop/Demo.hs:3:3: error: Qualified name in binding position: Demo.-- }}} and excludes this definition perhaps? {{{ example f = Just.-- comment f }}} Which might either have lexed as `Just` `.` `-- comment`, or it might have lexed as `Just.-` `-`, but it probably shouldn't be the case that it's a qvarsym. At a minimum, the Haskell Report specifically excludes `--` from the varsym rule, so it can't support the qvarsym rule match that it is now. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14109 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14109: GHC matches -- as a varsym when lexing a qvarsym -------------------------------------+------------------------------------- Reporter: glguy | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by harpocrates): It looks like the lexer does absolutely no validation for anything that is qualified. Things like `Prelude.|`, `Prelude.->`, `Prelude.data`, etc. all make it all the way through to the renamer. Most of these should (according to the report) probably lex as 3 or more separate tokens. Alternatively (and I prefer this), we could just report a lexer error. The functions for validating qualified symbols, constructors, etc. are already defined in `basicTypes/Lexeme.hs`, so there isn't a much work to be done here. I'm also volunteering to implement either of these options. :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14109#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14109: GHC matches -- as a varsym when lexing a qvarsym -------------------------------------+------------------------------------- Reporter: glguy | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Parser) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by harpocrates): * cc: harpocrates (added) Comment: Causes problems in Haddock too, see https://github.com/haskell/haddock/issues/952. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14109#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC