* deprecate `0c`, `0C` prefix for octal literals Deprecates the previously allowed syntax of `0c` and `0C` as a prefix for octal literals to bring the literals in line with the behavior of `parseOct` from parseutils. * add `msgKind` arg to `lexMessageLitNum` for deprecation messages * change literal tests to check all valid integer literals Also adds the `tinvaligintegerlit3` test to test for the (still) invalid `0O` prefix.
This commit is contained in:
parent
70cf286a22
commit
681d8e0749
7 changed files with 62 additions and 33 deletions
9
tests/lexer/tintegerliterals.nim
Normal file
9
tests/lexer/tintegerliterals.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# test the valid literals
|
||||
assert 0b10 == 2
|
||||
assert 0B10 == 2
|
||||
assert 0x10 == 16
|
||||
assert 0X10 == 16
|
||||
assert 0o10 == 8
|
||||
# the following is deprecated:
|
||||
assert 0c10 == 8
|
||||
assert 0C10 == 8
|
||||
7
tests/lexer/tinvalidintegerliteral3.nim
Normal file
7
tests/lexer/tinvalidintegerliteral3.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
discard """
|
||||
file: "tinvalidintegerliteral3.nim"
|
||||
line: 7
|
||||
errormsg: "0O5 is an invalid int literal; For octal literals use the '0o' prefix."
|
||||
"""
|
||||
|
||||
echo 0O5
|
||||
Loading…
Add table
Add a link
Reference in a new issue