[GHC] #9573: Add warning for invalid digits in integer literals
GHC
ghc-devs at haskell.org
Sat Sep 13 08:32:57 UTC 2014
#9573: Add warning for invalid digits in integer literals
-------------------------------------+-------------------------------------
Reporter: vlopez | Owner: vlopez
Type: bug | Status: new
Priority: normal | Milestone: 7.10.1
Component: Compiler | Version: 7.9
(Parser) | Keywords: parsing, integer,
Resolution: | octal, binary, hexadecimal,
Operating System: | Architecture: Unknown/Multiple
Unknown/Multiple | Difficulty: Difficult (2-5
Type of failure: | days)
None/Unknown | Blocked By:
Test Case: | Related Tickets:
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by andreas.abel):
I think a parse *error* would be more appropriate (and useful) than a
warning. I consider it as a bug rather than a feature that the following
parses:
{{{
test h = (+)92837492837h
}}}
Whitespace isn't that expensive anymore, and even cheaper on the black
market ;-), so this "feature" does not seem worth preserving.
The moral: number literals should have to be terminated by one of the
following: whitespace, punctuation (including parenthesis), operators etc,
but not just by an alphabetic character.
Maybe one can first parse a number literal as it was an identifier (i.e.,
allow leading numeric characters in identifiers), and then postprocess
identifiers that start with a numeric character as number literals, giving
parse errors if they do not make sense.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9573#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list