Forbid incompatible foreach parameter types for AAs#21463
Forbid incompatible foreach parameter types for AAs#21463ntrel wants to merge 3 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @ntrel! 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.
|
| Type taav = taa.nextOf(); | ||
| if (isRef ? !taav.constConv(ta) : !taav.implicitConvTo(ta)) | ||
| // TODO don't require sizes to match | ||
| if (isRef ? !taav.constConv(ta) : !taav.implicitConvTo(ta) || taav.size != ta.size) |
There was a problem hiding this comment.
I don't think the comparison of the size is correct, the generated lambda should accept the correct parameter types instead. I have patched it here in foreachBodyToFunction: d2b3b00#diff-11fb0212c55c05ed6e743e6776abb3c56996381760c8725255c622f96f5d9d4bR4032, but that is part of the template implementation of AAs. Sorry, linking into the diff doesn't seem to work well.
There was a problem hiding this comment.
OK, so it looks like #21456 is fixed? I can split the error message part out of this PR.
There was a problem hiding this comment.
It's not merged yet, but I can extract the fix to another PR. This will also cut down on #21066 a tiny bit.
Fixes #21456.
This errors unless both:
Although it would be better to support larger foreach parameter types, this prevents corruption for now.
Also improve error messages (see commits).