-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* --hintAsError * add test, changelog * condsyms
- Loading branch information
1 parent
2bedb0f
commit 4fc7fcb
Showing
8 changed files
with
56 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
discard """ | ||
joinable: false | ||
""" | ||
|
||
#[ | ||
tests: hintAsError, warningAsError | ||
]# | ||
|
||
template fn1 = | ||
{.hintAsError[ConvFromXtoItselfNotNeeded]:on.} | ||
proc fn(a: string) = discard a.string | ||
{.hintAsError[ConvFromXtoItselfNotNeeded]:off.} | ||
|
||
template fn2 = | ||
{.hintAsError[ConvFromXtoItselfNotNeeded]:on.} | ||
proc fn(a: string) = discard a | ||
{.hintAsError[ConvFromXtoItselfNotNeeded]:off.} | ||
|
||
template gn1 = | ||
{.warningAsError[ProveInit]:on.} | ||
proc fn(): var int = discard | ||
discard fn() | ||
{.warningAsError[ProveInit]:off.} | ||
|
||
template gn2 = | ||
{.warningAsError[ProveInit]:on.} | ||
proc fn(): int = discard | ||
discard fn() | ||
{.warningAsError[ProveInit]:off.} | ||
|
||
doAssert not compiles(fn1()) | ||
doAssert compiles(fn2()) | ||
|
||
doAssert not compiles(gn1()) | ||
doAssert compiles(gn2()) |