From 8b05df4187117d61491f2fdbeb7d744146ad73f7 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 20 Feb 2023 10:17:00 -0800 Subject: Add static for loop iteration inference. (#2659) --- tests/diagnostics/for-loop-warning.slang.expected | 35 +++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/diagnostics/for-loop-warning.slang.expected (limited to 'tests/diagnostics/for-loop-warning.slang.expected') diff --git a/tests/diagnostics/for-loop-warning.slang.expected b/tests/diagnostics/for-loop-warning.slang.expected new file mode 100644 index 000000000..e37abb035 --- /dev/null +++ b/tests/diagnostics/for-loop-warning.slang.expected @@ -0,0 +1,35 @@ +result code = 0 +standard error = { +tests/diagnostics/for-loop-warning.slang(6): warning 30502: the for loop is modifiying variable 'i' in the opposite direction from loop exit condition. + for (int i = 0; i < x; i--) // warn. + ^~ +tests/diagnostics/for-loop-warning.slang(10): warning 30503: the for loop is not modifiying variable 'j' because the step size evaluates to 0. + for (int j = 0; j < 3; j += 0) // warn. + ^~ +tests/diagnostics/for-loop-warning.slang(14): warning 30500: the for loop initializes and checks variable 'j' but the side effect expression is modifying 'i'. + for (int j = 0; j < 3; i++) // warn. + ^ +tests/diagnostics/for-loop-warning.slang(19): warning 30501: the for loop initializes and modifies variable 'j' but the predicate expression is checking 'i'. + for (int j = 0; i < 4; j++) // warn. + ^ +tests/diagnostics/for-loop-warning.slang(42): warning 30505: the loop runs for 0 iterations and will be removed. + for (int i = 1; i < 0; i++) // warn + ^~~ +tests/diagnostics/for-loop-warning.slang(45): warning 30505: the loop runs for 0 iterations and will be removed. + for (int i = 1; i >= 2; i--) // warn + ^~~ +tests/diagnostics/for-loop-warning.slang(51): warning 30505: the loop runs for 0 iterations and will be removed. + for (int i = 1; i > 1; i--) // warn + ^~~ +tests/diagnostics/for-loop-warning.slang(23): warning 30504: the for loop is statically determined to terminate within 3 iterations, which is less than what [MaxIters] specifies. + [MaxIters(6)] // warn + ^~~~~~~~ +tests/diagnostics/for-loop-warning.slang(28): warning 30504: the for loop is statically determined to terminate within 2 iterations, which is less than what [MaxIters] specifies. + [MaxIters(6)] // warn + ^~~~~~~~ +tests/diagnostics/for-loop-warning.slang(32): warning 30504: the for loop is statically determined to terminate within 5 iterations, which is less than what [MaxIters] specifies. + [MaxIters(6)] // warn + ^~~~~~~~ +} +standard output = { +} -- cgit v1.2.3