[GHC] #10993: Bad error message reported when -XBinaryLiterals is not enabled
GHC
ghc-devs at haskell.org
Tue Oct 20 15:22:13 UTC 2015
#10993: Bad error message reported when -XBinaryLiterals is not enabled
-------------------------------------+-------------------------------------
Reporter: osa1 | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.11
(Parser) |
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:
-------------------------------------+-------------------------------------
When `-XBinaryLiterals` is not enabled, expressions like `0b10101` is
causing
this horrible error message: `Not in scope: ‘b10101’`.
The reason, as far as I understand, is that lexer is not lexing `0b0101`
as a
single token when `-XBinaryLiterals` is not enabled. Then the parser is
parsing
this as an application of `0` to `b0101`. (this can be observed with
`-ddump-parsed`)
My suggestion:
Lexer should always generate a single token for `0b0101`. We don't do
`ifExtension binaryLiteralsEnabled` checks in the lexer anymore. We
somehow
mark generated token as "requires extension: BinaryLiterals"(I don't know
if we
have the infrastructure for this right now). Then, when the parser sees an
integer that requires `-XBinaryLiterals`, checks the flag and reports the
error
etc.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10993>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list