-
-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 20881, 22790 - make ref-return-scope consistent #13693
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 references
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 + dmd#13693" |
d714797
to
3d86943
Compare
5078d1e
to
895420e
Compare
STC.returnScope
I've found the bug: escape.d modifies the The diff will be smaller when #13789 is merged first. |
895420e
to
a35a26f
Compare
I already have a (much simpler) PR that fixes this. Dennis, I know where I'm going with this. Trying to do it another way is just confusing, we are working at cross-purposes. |
No, that only fixes a tiny part of it. I'm not making superfluous code changes for the kicks,
I'm not doing it another way, you introduced |
a35a26f
to
cd38848
Compare
test/fail_compilation/retscope2.d
Outdated
@@ -130,7 +130,7 @@ fail_compilation/retscope2.d(721): Error: returning `s.get1()` escapes a referen | |||
|
|||
struct S700 | |||
{ | |||
@safe S700* get1() return scope | |||
@safe S700* get1() return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of return scope
, rewrite as scope return
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I didn't add scope back because it gets stripped anyway since S700 has no (pointer) members.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
cd38848
to
13ff82b
Compare
Ok, I studied this for a bit. The issue is there are 3 ways of representing the dip1000 bits:
This adds an I need to think about this a bit more. |
How about this sequence of PRs:
Then it should be in a good position to fix bugs with it. |
Also, please rebase this PR, as the changes in #13802 are not reflected in the git diffs. |
13ff82b
to
ac06c7c
Compare
Sure
That would be #13789 |
ac06c7c
to
480501f
Compare
See #13811 for next step. |
And now #13817 |
2e22e80
to
e6957a2
Compare
e6957a2
to
fce2d65
Compare
I'm working on the same issue as Walter: #13691
It's not finished, Phobos doesn't compile because sometimes methods such as
std.typecons.Tuple.opBinary!"~"
are inferredreturn ref
when they should bereturn scope
, which I'm still debugging. I'm already opening this to show @WalterBright the parts of the code I think need to be changed to properly fix issue 22790.