Use static foreach for correct scope inference#8123
Conversation
|
Thanks for your pull request and interest in making D better, @dkorpel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + phobos#8123" |
|
can you add a test for this? |
d76cce2 to
d2c08b1
Compare
|
I added a test for // Test `scope` inference on `chain` parameters
version(unittest) private struct ImpureCopyCtor
{
// not pure, for https://issues.dlang.org/show_bug.cgi?id=20150
this(ref ImpureCopyCtor r) scope @nogc nothrow {}
bool empty = true;
void popFront() {}
int* front;
}
@safe unittest
{
auto chain1(ref ImpureCopyCtor r)
{
return chain(r, r);
}
scope ImpureCopyCtor r;
chain1(r);
} |
|
CI seems stuck, can you please rebase or force push? |
d2c08b1 to
42fda7f
Compare
42fda7f to
f523a06
Compare
|
The autotester seems to be stuck. Rebase this to restart it. |
f523a06 to
537fb89
Compare
|
Still stuck. |
537fb89 to
11b9834
Compare
Part of #8113
Turns
foreachover an AliasSeq intostatic foreachbecause of issue 21209 - scope attribute inference with does not work well with foreach. Without this,textandchainare notscopecompatible.