-
-
Notifications
You must be signed in to change notification settings - Fork 664
Add hasCopyConstructor and hasPostblit traits #10528
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
Conversation
|
Thanks for your pull request and interest in making D better, @adamdruppe! 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 fetch digger
dub run digger -- build "master + dmd#10528" |
ghost
left a comment
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.
The two traits can be written together with a small change
src/dmd/traits.d
Outdated
| } | ||
| return True(); | ||
| } | ||
| if (e.ident == Id.hasPostblit) |
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.
The two traits share most of their code. So here
if (e.ident == Id.hasPostblit || e.ident == Id.hasCopyConstructor)
src/dmd/traits.d
Outdated
| Type tb = t.baseElemOf(); | ||
| if (auto sd = tb.ty == Tstruct ? (cast(TypeStruct)tb).sym : null) | ||
| { | ||
| return sd.postblit ? True() : False(); |
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.
and then here
return (e.ident == Id.hasPostblit) ? (sd.postblit ? True() : False())
: (sd.hasCopyCtor ? True() : False());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.
yeah i originally literally just mindlessly copy/pasted it but this is nicer, change made just waiting on the autotester to make sure i didnt mess up
|
Please don't forget the dlang.org update. |
I forked @edi33416 's PR here #10265 and split it into two pieces as mentioned in the comments.