From 78a5267266c6bb1e01872548fe63a516cfb18321 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Mon, 22 Apr 2024 20:23:34 -0700 Subject: [PATCH] Add explicit module to fix IncorrectIndentation's test Not sure when this broke, but it's broken on 'main' Signed-off-by: Danila Fedorin --- test/chplcheck/IncorrectIndentation.chpl | 474 ++++++++++++----------- test/chplcheck/IncorrectIndentation.good | 107 +++-- 2 files changed, 291 insertions(+), 290 deletions(-) diff --git a/test/chplcheck/IncorrectIndentation.chpl b/test/chplcheck/IncorrectIndentation.chpl index 752ac21b6600..9244e6bfa5e6 100644 --- a/test/chplcheck/IncorrectIndentation.chpl +++ b/test/chplcheck/IncorrectIndentation.chpl @@ -1,325 +1,327 @@ -proc f1() -{ +module IncorrectIndentation { + proc f1() + { + writeln("hi"); + writeln("??"); + } + + proc f2() + { writeln("hi"); - writeln("??"); -} + } -proc f2() -{ -writeln("hi"); -} + proc f3() { + writeln("hi"); + } -proc f3() { -writeln("hi"); -} + proc f4() { + writeln("hi"); + writeln("hi"); + } -proc f4() { - writeln("hi"); + proc f5() { + writeln("hi"); writeln("hi"); + } + + proc f6() { + for 1..10 do writeln("hi"); -} + } -proc f5() { - writeln("hi"); writeln("hi"); -} + module M1 + { + writeln("hi"); + writeln("??"); + } -proc f6() { - for 1..10 do + module M2 + { writeln("hi"); -} + } -module M1 -{ + module M3 { writeln("hi"); - writeln("??"); -} + } -module M2 -{ -writeln("hi"); -} + module M4 { + writeln("hi"); + writeln("hi"); + } -module M3 { -writeln("hi"); -} + module M5 { + writeln("hi"); writeln("hi"); + } -module M4 { - writeln("hi"); + module M6 { + for 1..10 do writeln("hi"); -} + } -module M5 { - writeln("hi"); writeln("hi"); -} + for 1..10 { + writeln("hi"); + } -module M6 { - for 1..10 do + for 1..10 + { writeln("hi"); -} + } -for 1..10 { + for 1..10 { writeln("hi"); -} - -for 1..10 -{ -writeln("hi"); -} + } -for 1..10 { -writeln("hi"); -} + module NestedOuter { + module NestedInner { + writeln("hi"); + writeln("??"); + writeln("??"); + record nestedRecord { + proc firstProc() {} + proc secondProc() {} + proc thirdProc() {} + + proc nestedProcOuter() { + proc nestedProcInner(x: int) do return x; + proc nestedProcInner(x: string) { + writeln(x); + writeln(x); + writeln(x); + return x; + } + } + } + } + } -module NestedOuter { - module NestedInner { + on here + { writeln("hi"); - writeln("??"); writeln("??"); - record nestedRecord { - proc firstProc() {} - proc secondProc() {} - proc thirdProc() {} - - proc nestedProcOuter() { - proc nestedProcInner(x: int) do return x; - proc nestedProcInner(x: string) { - writeln(x); - writeln(x); - writeln(x); - return x; - } - } - } } -} -on here -{ + on here + { writeln("hi"); - writeln("??"); -} + } -on here -{ -writeln("hi"); -} + on here { + writeln("hi"); + } -on here { -writeln("hi"); -} + on here { + writeln("hi"); + writeln("hi"); + } -on here { - writeln("hi"); + on here { + writeln("hi"); writeln("hi"); + } + + on here { + for 1..10 do writeln("hi"); -} + } -on here { - writeln("hi"); writeln("hi"); -} + begin + { + writeln("hi"); + writeln("??"); + } -on here { - for 1..10 do + begin + { writeln("hi"); -} + } -begin -{ + begin { writeln("hi"); - writeln("??"); -} + } -begin -{ -writeln("hi"); -} + begin { + writeln("hi"); + writeln("hi"); + } -begin { -writeln("hi"); -} + begin { + writeln("hi"); writeln("hi"); + } -begin { - writeln("hi"); + begin { + for 1..10 do writeln("hi"); -} + } -begin { - writeln("hi"); writeln("hi"); -} + var dummy: int; -begin { - for 1..10 do - writeln("hi"); -} + begin with (ref dummy) + { + writeln("hi"); + writeln("??"); + } -var dummy: int; + begin with (ref dummy) + { + writeln("hi"); + } -begin with (ref dummy) -{ + begin with (ref dummy) { writeln("hi"); - writeln("??"); -} + } -begin with (ref dummy) -{ -writeln("hi"); -} + begin with (ref dummy) { + writeln("hi"); + writeln("hi"); + } -begin with (ref dummy) { -writeln("hi"); -} + begin with (ref dummy) { + writeln("hi"); writeln("hi"); + } -begin with (ref dummy) { - writeln("hi"); + begin with (ref dummy) { + for 1..10 do writeln("hi"); -} + } -begin with (ref dummy) { - writeln("hi"); writeln("hi"); -} + // Note: 'cobegins' with one statement throw warning, so all tests here include + // at least two statements. -begin with (ref dummy) { - for 1..10 do - writeln("hi"); -} + cobegin + { + writeln("hi"); + writeln("??"); + } -// Note: 'cobegins' with one statement throw warning, so all tests here include -// at least two statements. + cobegin + { + writeln("hi"); + writeln("hi"); + } -cobegin -{ + cobegin { writeln("hi"); - writeln("??"); -} + writeln("hi"); + } -cobegin -{ -writeln("hi"); -writeln("hi"); -} + cobegin { + writeln("hi"); + writeln("hi"); + } -cobegin { -writeln("hi"); -writeln("hi"); -} + cobegin { + writeln("hi"); writeln("hi"); + } -cobegin { - writeln("hi"); + cobegin { writeln("hi"); -} + for 1..10 do + writeln("hi"); + } -cobegin { - writeln("hi"); writeln("hi"); -} + cobegin with (ref dummy) + { + writeln("hi"); + writeln("??"); + } -cobegin { + cobegin with (ref dummy) + { writeln("hi"); - for 1..10 do writeln("hi"); -} + } -cobegin with (ref dummy) -{ + cobegin with (ref dummy) { writeln("hi"); - writeln("??"); -} + writeln("hi"); + } -cobegin with (ref dummy) -{ -writeln("hi"); -writeln("hi"); -} + cobegin with (ref dummy) { + writeln("hi"); + writeln("hi"); + } -cobegin with (ref dummy) { -writeln("hi"); -writeln("hi"); -} + cobegin with (ref dummy) { + writeln("hi"); writeln("hi"); + } -cobegin with (ref dummy) { - writeln("hi"); + cobegin with (ref dummy) { writeln("hi"); -} + for 1..10 do + writeln("hi"); + } -cobegin with (ref dummy) { - writeln("hi"); writeln("hi"); -} + enum e1 + { + first, + second + } -cobegin with (ref dummy) { - writeln("hi"); - for 1..10 do - writeln("hi"); -} + enum e2 + { + first + } -enum e1 -{ - first, - second -} + enum e3 { + first + } -enum e2 -{ -first -} + enum e4 { + first, + second + } -enum e3 { -first -} + enum e5 { + first, second + } -enum e4 { - first, - second -} + union u1 + { + var element: int; + proc firstProc() {} + } -enum e5 { - first, second -} + union u2 + { + var element: int; -union u1 -{ - var element: int; proc firstProc() {} -} - -union u2 -{ - var element: int; - -proc firstProc() {} -} + } -union u3 { - var element: int; + union u3 { + var element: int; -proc firstProc() {} -} + proc firstProc() {} + } -union u4 { - var element: int; + union u4 { + var element: int; - proc firstProc() {} - proc secondProc() {} -} + proc firstProc() {} + proc secondProc() {} + } -union u5 { - var element: int; + union u5 { + var element: int; - proc firstProc() {} proc secondProc() {} -} + proc firstProc() {} proc secondProc() {} + } -enum color { red, green, blue }; // semicolon warning does not issue bad indentation + enum color { red, green, blue }; // semicolon warning does not issue bad indentation -// Since locations are incorrectly reported with 'public' and 'private', -// these shouldn't warn. -module M7 { - proc f1 {} - proc g1 {} - public proc f2 {} - public proc g2 {} - private proc f3 {} - private proc g3 {} + // Since locations are incorrectly reported with 'public' and 'private', + // these shouldn't warn. + module M7 { + proc f1 {} + proc g1 {} + public proc f2 {} + public proc g2 {} + private proc f3 {} + private proc g3 {} - use super.M1; use super.M1; - public use super.M2; + use super.M1; public use super.M2; - private use super.M2; + public use super.M2; private use super.M2; + private use super.M2; + } } diff --git a/test/chplcheck/IncorrectIndentation.good b/test/chplcheck/IncorrectIndentation.good index 8b23cd61670f..a15ca0936223 100644 --- a/test/chplcheck/IncorrectIndentation.good +++ b/test/chplcheck/IncorrectIndentation.good @@ -1,62 +1,61 @@ -IncorrectIndentation.chpl:1: node violates rule UseExplicitModules -IncorrectIndentation.chpl:9: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:13: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:18: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:22: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:27: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:38: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:42: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:47: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:51: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:56: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:65: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:69: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:75: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:79: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:84: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:86: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:103: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:107: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:112: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:116: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:121: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:132: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:136: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:141: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:145: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:150: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:163: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:167: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:172: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:176: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:181: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:195: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:10: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:14: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:19: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:23: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:28: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:39: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:43: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:48: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:52: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:57: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:66: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:70: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:76: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:80: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:85: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:87: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:104: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:108: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:113: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:117: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:122: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:133: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:137: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:142: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:146: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:151: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:164: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:168: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:173: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:177: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:182: node violates rule IncorrectIndentation IncorrectIndentation.chpl:196: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:200: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:197: node violates rule IncorrectIndentation IncorrectIndentation.chpl:201: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:206: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:210: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:216: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:221: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:202: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:207: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:211: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:217: node violates rule IncorrectIndentation IncorrectIndentation.chpl:222: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:227: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:223: node violates rule IncorrectIndentation IncorrectIndentation.chpl:228: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:232: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:229: node violates rule IncorrectIndentation IncorrectIndentation.chpl:233: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:237: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:234: node violates rule IncorrectIndentation IncorrectIndentation.chpl:238: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:242: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:242: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:246: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:239: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:243: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:243: node violates rule IncorrectIndentation IncorrectIndentation.chpl:247: node violates rule IncorrectIndentation IncorrectIndentation.chpl:248: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:259: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:263: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:268: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:285: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:291: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:298: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:304: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:307: node violates rule EmptyStmts -IncorrectIndentation.chpl:313: node violates rule IncorrectIndentation -IncorrectIndentation.chpl:320: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:249: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:260: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:264: node violates rule IncorrectIndentation +IncorrectIndentation.chpl:269: node violates rule IncorrectIndentation +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