Skip to content

backticks : Float-like part of a variable identifier is changed in [XDeclaredButNotUsed] HintΒ #14407

@kaushalmodi

Description

@kaushalmodi

A variable name like `v0.99.99` changes when it's reported in the XDeclaredButNotUsed hint. The last part .99, seems like, is treated like a float.

Example

Run nim c t.nim.

let
  `v0.99` = "0.99"       # ok  Hint: 'v0.99' is declared but not used
  `v0.99.99` = "0.99.99" # ??  Hint: 'v0.99.98999999999999' is declared but not used

Current Output

/home/kmodi/sandbox/nim/bug_reports/declared_but_not_used/t.nim(2, 3) Hint: 'v0.99' is declared but not used [XDeclaredButNotUsed]
/home/kmodi/sandbox/nim/bug_reports/declared_but_not_used/t.nim(3, 3) Hint: 'v0.99.98999999999999' is declared but not used [XDeclaredButNotUsed]

Expected Output

/home/kmodi/sandbox/nim/bug_reports/declared_but_not_used/t.nim(2, 3) Hint: 'v0.99' is declared but not used [XDeclaredButNotUsed]
/home/kmodi/sandbox/nim/bug_reports/declared_but_not_used/t.nim(3, 3) Hint: 'v0.99.99' is declared but not used [XDeclaredButNotUsed]

Additional Information

  • I was working on my version module when I noticed the strange-looking hints.
$ nim -v
Nim Compiler Version 1.3.5 [Linux: amd64]
Compiled at 2020-05-19
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: e909486e5cde5a4a77cd6f21b42fc9ab38ec2ae6
active boot switches: -d:release

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions