It appears the "this" pointer doesn't get propagated into sub-scopes within a lambda causing a failure.
Reproduce:
int test1() {
return 1;
}
void test(Map params) {
int i = 0;
params.forEach( (k, v) -> {
if (i == 0) {
test1()
} else {
test1()
}
} )
}
test(params)
Error:
no 'this' pointer within static method
Workaround:
Use control-flow logic such as if/else, for, and while to replace the lambda causing an issue.
After #74268, all user functions are instance methods, so the this reference needs to be propagated.