skia2/resources/sksl/errors/IllegalRecursionComplex.rts
John Stiles cfcc11bd98 Move recursion tests into general /errors/ directory.
We enforce no-recursion in all programs now, not just Runtime Effects.

Change-Id: I3737329e4526fa1b7fdbb47ccb959f78f507f665
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535119
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-04-28 21:25:41 +00:00

43 lines
680 B
Plaintext

// Expect 1 errors (with f_one(int), f_two, f_three in cycle)
// Complex recursion spanning several functions with overloads, etc.
void f_one(bool b);
void f_one(int n);
void f_two(int n);
void f_three(int n);
void f_four(int n);
void f_one(bool b) {
int n = b ? 1 : 0;
f_one(n);
}
void f_one(int n) {
if (n > 0) {
f_four(n);
} else {
f_two(n);
}
}
void f_two(int n) {
for (int i = 0; i < 4; ++i) {
f_three(n);
}
}
void f_three(int n) {
f_one(n);
}
void f_four(int n) {}
/*%%*
potential recursion (function call cycle) not allowed:
void f_one(int n)
void f_two(int n)
void f_three(int n)
void f_one(int n)
*%%*/