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

--styleCheck:hint gives incorrect [Name] refactoring suggestion #11756

Open
kaushalmodi opened this issue Jul 16, 2019 · 1 comment
Open

--styleCheck:hint gives incorrect [Name] refactoring suggestion #11756

kaushalmodi opened this issue Jul 16, 2019 · 1 comment

Comments

@kaushalmodi
Copy link
Contributor

kaushalmodi commented Jul 16, 2019

When running compiling the below test code with --styleCheck:hint, I get an incorrect [Name] refactoring suggestion.

The compiler is mixing up the enum element reSet with the reset proc of Nim objects.

# t.nim
type
  SomeType = enum
    reSet
  SomeObj = object
    foo: int

var
  obj = SomeObj(foo: 123)
echo obj
obj.reset()
echo obj

Command to run

nim c --styleCheck:hint t.nim

Expected outcome

The below [Name] warning should not show up.

Actual output

t.nim(12, 5) Hint: 'reset' should be: 'reSet' [Name]

What's worse is that I can never run with --styleCheck:error on such projects due to this incorrect warning.

Ref: nitely/nim-regex#40 (comment)

Nim version

Nim Compiler Version 0.20.99 [Linux: amd64]
Compiled at 2019-07-16
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 44d80dd86373b9ba41051428948eae30ed97acd3
active boot switches: -d:release
@kaushalmodi kaushalmodi changed the title --styleCheck:warn gives incorrect [Name] refactoring suggestion --styleCheck:hint gives incorrect [Name] refactoring suggestion Jul 17, 2019
kaushalmodi added a commit to kaushalmodi/nim-regex that referenced this issue Jul 17, 2019
The warnings were found by running with --styleCheck:warn.

Fixes:

- s/prettycheck/prettyCheck/
- s/rawCp/rawCP/

- s/reSet/reInSet/ <-- This one in particular is a workaround for Nim
                       issue nim-lang/Nim#11756

Note that the styleCheck enforcing will work only with Nim 0.20.0 and
newer because the --styleCheck switch got introduced in that version.
kaushalmodi added a commit to kaushalmodi/nim-regex that referenced this issue Jul 17, 2019
The warnings were found by running with --styleCheck:warn.

Fixes:

- s/prettycheck/prettyCheck/
- s/rawCp/rawCP/

- s/reSet/reInSet/ <-- This one in particular is a workaround for Nim
                       issue nim-lang/Nim#11756

Note that the styleCheck enforcing will work only with Nim 0.20.0 and
newer because the --styleCheck switch got introduced in that version.
kaushalmodi added a commit to kaushalmodi/nim-regex that referenced this issue Jul 17, 2019
The warnings were found by running with --styleCheck:hint.

Fixes:

- s/prettycheck/prettyCheck/
- s/rawCp/rawCP/

- s/reSet/reInSet/ <-- This one in particular is a workaround for Nim
                       issue nim-lang/Nim#11756

Note that the styleCheck enforcing will work only with Nim 0.20.0 and
newer because the --styleCheck switch got introduced in that version.

The --styleCheck:error will result in errors on nim 0.20.0 and 0.20.2
due to styleCheck failures on few stdlibs. Those will be fixed on Nim
devel soon. So I am enabling the --styleCheck:error switch only on
nim versions newer than 0.20.2.
kaushalmodi added a commit to kaushalmodi/nim-regex that referenced this issue Jul 17, 2019
The warnings were found by running with --styleCheck:hint.

Fixes:

- s/prettycheck/prettyCheck/
- s/rawCp/rawCP/

- s/reSet/reInSet/ <-- This one in particular is a workaround for Nim
                       issue nim-lang/Nim#11756

Note that the styleCheck enforcing will work only with Nim 0.20.0 and
newer because the --styleCheck switch got introduced in that version.

The --styleCheck:error will result in errors on nim 0.20.0 and 0.20.2
due to styleCheck failures on few stdlibs. Those will be fixed on Nim
devel soon. So I am enabling the --styleCheck:error switch only on
nim versions newer than 0.20.2.
@Araq
Copy link
Member

Araq commented Jul 17, 2019

Funny bug. :-)

nitely pushed a commit to nitely/nim-regex that referenced this issue Jul 18, 2019
The warnings were found by running with --styleCheck:hint.

Fixes:

- s/prettycheck/prettyCheck/
- s/rawCp/rawCP/

- s/reSet/reInSet/ <-- This one in particular is a workaround for Nim
                       issue nim-lang/Nim#11756

Note that the styleCheck enforcing will work only with Nim 0.20.0 and
newer because the --styleCheck switch got introduced in that version.

The --styleCheck:error will result in errors on nim 0.20.0 and 0.20.2
due to styleCheck failures on few stdlibs. Those will be fixed on Nim
devel soon. So I am enabling the --styleCheck:error switch only on
nim versions newer than 0.20.2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants