Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix warning in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jade Abraham <[email protected]>
jabraham17 committed Dec 11, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 78dab20 commit 536c71e
Showing 9 changed files with 49 additions and 33 deletions.
2 changes: 1 addition & 1 deletion test/chplcheck/ControlFlowParentheses.chpl
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ while(a &&
do {} while(a &&
b);

// Not valid syntax, but just in case; should not warn, tuples need their parens.
// Not valid syntax, but just in case; should not warn, tuples need their parens
if (1, 2) {}
if (1, 2) then writeln("Hello");
while (1, 2) {}
2 changes: 1 addition & 1 deletion test/chplcheck/ControlFlowParentheses.good-fixit
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ while(a &&
do {} while(a &&
b);

// Not valid syntax, but just in case; should not warn, tuples need their parens.
// Not valid syntax, but just in case; should not warn, tuples need their parens
if (1, 2) {}
if (1, 2) then writeln("Hello");
while (1, 2) {}
10 changes: 6 additions & 4 deletions test/chplcheck/IncorrectIndentation.chpl
Original file line number Diff line number Diff line change
@@ -182,8 +182,8 @@ module IncorrectIndentation {
writeln("hi");
}

// Note: 'cobegins' with one statement throw warning, so all tests here include
// at least two statements.
// Note: 'cobegins' with one statement throw warning, so all tests here
// include at least two statements.

cobegin
{
@@ -305,7 +305,8 @@ module IncorrectIndentation {
proc firstProc() {} proc secondProc() {}
}

enum color { red, green, blue }; // semicolon warning does not issue bad indentation
// semicolon warning does not issue bad indentation
enum color { red, green, blue };

// Since locations are incorrectly reported with 'public' and 'private',
// these shouldn't warn.
@@ -367,7 +368,8 @@ if 1 < 2 {
writeln("??");
}
}
// since else statements aren't reported correctly only the misaligned child statements should warn
// since else statements aren't reported correctly only the misaligned child
// statements should warn
if 1 < 2 {
writeln("hi");
writeln("??");
24 changes: 12 additions & 12 deletions test/chplcheck/IncorrectIndentation.good
Original file line number Diff line number Diff line change
@@ -68,16 +68,16 @@ IncorrectIndentation.chpl:286: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:292: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:299: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:305: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:308: node violates rule EmptyStmts
IncorrectIndentation.chpl:314: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:321: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:339: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:349: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:353: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:358: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:363: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:373: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:376: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:379: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:382: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:309: node violates rule EmptyStmts
IncorrectIndentation.chpl:315: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:322: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:340: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:350: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:354: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:359: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:364: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:375: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:378: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:381: node violates rule IncorrectIndentation
IncorrectIndentation.chpl:384: node violates rule IncorrectIndentation
[Success matching fixit for IncorrectIndentation]
10 changes: 6 additions & 4 deletions test/chplcheck/IncorrectIndentation.good-fixit
Original file line number Diff line number Diff line change
@@ -193,8 +193,8 @@ module IncorrectIndentation {
writeln("hi");
}

// Note: 'cobegins' with one statement throw warning, so all tests here include
// at least two statements.
// Note: 'cobegins' with one statement throw warning, so all tests here
// include at least two statements.

cobegin
{
@@ -322,7 +322,8 @@ module IncorrectIndentation {
proc firstProc() {} proc secondProc() {}
}

enum color { red, green, blue } // semicolon warning does not issue bad indentation
// semicolon warning does not issue bad indentation
enum color { red, green, blue }

// Since locations are incorrectly reported with 'public' and 'private',
// these shouldn't warn.
@@ -386,7 +387,8 @@ if 1 < 2 {
writeln("??");
}
}
// since else statements aren't reported correctly only the misaligned child statements should warn
// since else statements aren't reported correctly only the misaligned child
// statements should warn
if 1 < 2 {
writeln("hi");
writeln("??");
2 changes: 1 addition & 1 deletion test/chplcheck/Unused.chpl
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ module Unused {
}
}

// test with unrelated attribute; previously this (wrongly) silenced warnigns
// test with unrelated attribute; should do nothing
@chplcheck.ignore("UnusedFormal")
for i in 1..10 {}

12 changes: 9 additions & 3 deletions test/chplcheck/UnusedTupleUnpack.chpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
foreach (i, _) in zip(1..10, 1..10) { i; }
foreach (_, j) in zip(1..10, 1..10) { j; }
foreach (_, _) in zip(1..10, 1..10) {}
foreach (i, (_, _)) in zip(1..10, foreach pair in zip(1..10, 1..10) do pair) { i; }
foreach (_, (_, _)) in zip(1..10, foreach pair in zip(1..10, 1..10) do pair) { i; }
foreach ((_, _), _) in zip(foreach pair in zip(1..10, 1..10) do pair, 1..10) { i; }
foreach (i, (_, _)) in zip(1..10, foreach pair in zip(1..10, 1..10) do pair) {
i;
}
foreach (_, (_, _)) in zip(1..10, foreach pair in zip(1..10, 1..10) do pair) {
i;
}
foreach ((_, _), _) in zip(foreach pair in zip(1..10, 1..10) do pair, 1..10) {
i;
}
8 changes: 4 additions & 4 deletions test/chplcheck/UnusedTupleUnpack.good
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
UnusedTupleUnpack.chpl:1: node violates rule UseExplicitModules
UnusedTupleUnpack.chpl:3: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:4: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:5: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:5: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:6: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:6: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:7: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:7: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:10: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:10: node violates rule UnusedTupleUnpack
[Success matching fixit for UnusedTupleUnpack]
12 changes: 9 additions & 3 deletions test/chplcheck/UnusedTupleUnpack.good-fixit
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
foreach (i, _) in zip(1..10, 1..10) { i; }
foreach (_, j) in zip(1..10, 1..10) { j; }
foreach zip(1..10, 1..10) {}
foreach (i, _) in zip(1..10, foreach pair in zip(1..10, 1..10) do pair) { i; }
foreach (_, _) in zip(1..10, foreach pair in zip(1..10, 1..10) do pair) { i; }
foreach (_, _) in zip(foreach pair in zip(1..10, 1..10) do pair, 1..10) { i; }
foreach (i, _) in zip(1..10, foreach pair in zip(1..10, 1..10) do pair) {
i;
}
foreach (_, _) in zip(1..10, foreach pair in zip(1..10, 1..10) do pair) {
i;
}
foreach (_, _) in zip(foreach pair in zip(1..10, 1..10) do pair, 1..10) {
i;
}

0 comments on commit 536c71e

Please sign in to comment.