Add hasCopyConstructor and hasPostblit traits#10528
Add hasCopyConstructor and hasPostblit traits#10528WalterBright merged 6 commits intodlang:masterfrom
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.
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.
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.
and then here
return (e.ident == Id.hasPostblit) ? (sd.postblit ? True() : False())
: (sd.hasCopyCtor ? True() : False());There was a problem hiding this comment.
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.