Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn if non-anonymous variable appears only once. (#1310)
* cleanup checks a bit * add check for unused variables * beef up test some more * fix crash in test * fix warnings * fix bug with contexts * handle fresh anonymous constants * add test * update test * update output file * fix another false positive * more warnings in prelude * update tests more * fix test * update test * add more tests * don't make warnings fatal Co-authored-by: rv-jenkins <admin@runtimeverification.com>
- Loading branch information
1 parent
cd84214
commit 135469e
Showing
21 changed files
with
310 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
KOMPILE_FLAGS=-w2e | ||
KOMPILE_BACKEND=llvm | ||
|
||
include ../../../include/kframework/ktest-fail.mak |
29 changes: 29 additions & 0 deletions
29
k-distribution/tests/regression-new/checkWarns/checkUnusedVar.k
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,29 @@ | ||
module CHECKUNUSEDVAR-SYNTAX | ||
|
||
endmodule | ||
|
||
module MOD | ||
imports INT | ||
configuration <bar> 0 </bar> | ||
endmodule | ||
|
||
module CHECKUNUSEDVAR | ||
imports INT | ||
imports MOD | ||
|
||
syntax KItem ::= foo(Int) | ||
|
||
rule foo(X) => 0 | ||
rule foo(0) => !_:Int | ||
|
||
rule foo(X) => 0 | ||
requires X >Int 0 | ||
rule foo(X) => 1 | ||
requires 0 >Int 0 | ||
|
||
rule foo(X) => ?X:Int | ||
ensures X >Int 0 | ||
|
||
configuration <k> $PGM:K </k> <foo multiplicity="?"> <bar/> </foo> | ||
|
||
endmodule |
10 changes: 10 additions & 0 deletions
10
k-distribution/tests/regression-new/checkWarns/checkUnusedVar.k.out
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,10 @@ | ||
[Error] Compiler: Had 3 structural errors. | ||
[Error] Compiler: Variable '?X' defined but not used. | ||
Source(checkUnusedVar.k) | ||
Location(24,18,24,20) | ||
[Error] Compiler: Variable 'X' defined but not used. | ||
Source(checkUnusedVar.k) | ||
Location(16,12,16,13) | ||
[Error] Compiler: Variable 'X' defined but not used. | ||
Source(checkUnusedVar.k) | ||
Location(21,12,21,13) |
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
3 changes: 3 additions & 0 deletions
3
k-distribution/tests/regression-new/kprove-java/rhs-vars-broken-spec.k.out
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
Oops, something went wrong.