Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kaushalmodi opened this issue May 20, 2020 · 2 comments · Fixed by #18232 or #18531
Labels

Comments

@kaushalmodi
Copy link
Contributor

kaushalmodi commented May 20, 2020

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
@kaushalmodi kaushalmodi changed the title Variable name is changed in [XDeclaredButNotUsed] Hint Float-like part of a variable identifier is changed in [XDeclaredButNotUsed] Hint May 20, 2020
ringabout added a commit to ringabout/Nim that referenced this issue Oct 31, 2020
@ringabout
Copy link
Member

It is OS specfic. It doesn't happen in windows.

@ringabout
Copy link
Member

This is caused by Nim parser.

The contents between tkAccent is parsed like this in Linux

`   
v0
.
99.98999999999999
`

And 99.99 is printed differently:
in windows

99.99

in linux

99.98999999999999

@timotheecour timotheecour changed the title Float-like part of a variable identifier is changed in [XDeclaredButNotUsed] Hint backticks : Float-like part of a variable identifier is changed in [XDeclaredButNotUsed] Hint Nov 2, 2020
kaushalmodi added a commit to kaushalmodi/Nim that referenced this issue Jun 10, 2021
kaushalmodi added a commit to kaushalmodi/Nim that referenced this issue Jun 23, 2021
kaushalmodi added a commit to kaushalmodi/Nim that referenced this issue Jun 24, 2021
Araq pushed a commit that referenced this issue Jun 24, 2021
@timotheecour timotheecour reopened this Jul 20, 2021
PMunch pushed a commit to PMunch/Nim that referenced this issue Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants