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

push pragma is silently ignored if position is in front of import statement #5050

Closed
StefanSalewski opened this issue Nov 24, 2016 · 2 comments · Fixed by #12606
Closed

push pragma is silently ignored if position is in front of import statement #5050

StefanSalewski opened this issue Nov 24, 2016 · 2 comments · Fixed by #12606
Labels

Comments

@StefanSalewski
Copy link

That can be very confusing.

(And I would really prefer SmallLshouldNotBeUsed being off by default :-)

cat t.nim
{.push warning[SmallLshouldNotBeUsed]: off.}

import strutils

var l = 1
echo l
stefan@nuc ~/NEd $ nimsuggest --v2 --stdin t.nim
Hint: used config file '/home/stefan/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/stefan/NEd/nim.cfg' [Conf]
usage: sug|con|def|use|dus|chk|highlight|outline file.nim[;dirtyfile.nim]:line:col
type 'quit' to quit
type 'debug' to toggle debug mode on/off
type 'terse' to toggle terse mode on/off
> chk t.nim:1:0
Hint: t [Processing]
t.nim(5, 5) Warning: 'l' should not be used as an identifier; may look like '1' (one) [SmallLshouldNotBeUsed]
t.nim(6, 6) Warning: 'l' should not be used as an identifier; may look like '1' (one) [SmallLshouldNotBeUsed]

> quit
stefan@nuc ~/NEd $ nim c t.nim 
Hint: used config file '/home/stefan/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/stefan/NEd/nim.cfg' [Conf]
Hint: system [Processing]
Hint: t [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: math [Processing]
Hint: algorithm [Processing]
t.nim(5, 5) Warning: 'l' should not be used as an identifier; may look like '1' (one) [SmallLshouldNotBeUsed]
t.nim(6, 6) Warning: 'l' should not be used as an identifier; may look like '1' (one) [SmallLshouldNotBeUsed]
CC: t
CC: stdlib_strutils
CC: stdlib_parseutils
CC: stdlib_math
CC: stdlib_algorithm
Hint:  [Link]
Hint: operation successful (14346 lines compiled; 0.178 sec total; 20.004MiB; Debug Build) [SuccessX]
stefan@nuc ~/NEd $ 
@Araq Araq added the Pragmas label Feb 2, 2017
@mratsim
Copy link
Collaborator

mratsim commented Dec 19, 2018

Does it even apply on imported files?

I'm trying to remove the Warning: Number of spaces around '==' is not consistent [Spacing] spam on my test files.

mratsim added a commit to mratsim/Arraymancer that referenced this issue Dec 19, 2018
mratsim added a commit to mratsim/Arraymancer that referenced this issue Dec 19, 2018
* push spacing warnings off - well blocked by nim-lang/Nim#5050

* Replace future module by sugar

* Fix reduce_mean gate

* Remove the removable warnings

* Forgot OpenMP deprecated randoms
@Araq
Copy link
Member

Araq commented Dec 19, 2018

Up to date example:

{.push warning[Spacing]: off.}

import strutils

var l = 1 ==  7
echo l

{.pop.}

vs

import strutils

{.push warning[Spacing]: off.}

var l = 1 ==  7
echo l

{.pop.}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants