Skip to content
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

Implement copy constructor #8688

Merged
merged 31 commits into from Mar 28, 2019
Merged

Implement copy constructor #8688

merged 31 commits into from Mar 28, 2019

Conversation

RazvanN7
Copy link
Contributor

@RazvanN7 RazvanN7 commented Sep 11, 2018

As per DIP: [1].

More tests will be added soon.

[1] dlang/DIPs#129

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @RazvanN7! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

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

Your 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 locally

If 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#8688"

@jacob-carlborg
Copy link
Contributor

Making the @implicit keyword a compiler recognizes UDA would avoid some breaking changes.

src/dmd/dsymbolsem.d Outdated Show resolved Hide resolved
src/dmd/dstruct.d Outdated Show resolved Hide resolved
src/dmd/expression.d Outdated Show resolved Hide resolved
src/dmd/semantic3.d Outdated Show resolved Hide resolved
src/dmd/dsymbolsem.d Outdated Show resolved Hide resolved
src/dmd/dsymbolsem.d Outdated Show resolved Hide resolved
src/dmd/dsymbolsem.d Outdated Show resolved Hide resolved
src/dmd/dsymbolsem.d Outdated Show resolved Hide resolved
src/dmd/dsymbolsem.d Outdated Show resolved Hide resolved
src/dmd/expression.d Outdated Show resolved Hide resolved
if (!einit)
return setError();

Expression e;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Insert a comment showing what expression is being built.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the one on line 7742 enough?

{
if (!e2x.type.implicitConvTo(e1x.type))
{
exp.error("conversion error from `%s` to `%s`",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine this error message would be completely baffling to a user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was there before. It has nothing to do with this PR

src/dmd/func.d Outdated Show resolved Hide resolved
@RazvanN7
Copy link
Contributor Author

@jacob-carlborg I fixed the changelog and the inline comments.

@wilzbach The only new thing added here is that the compiler inserts calls to the copy constructor where it used to insert for the postblit. This is tested. Moreover, there is a reference counted array implementation that uses the copy constructor and passes all the tests locally [1].

[1] dlang/druntime#2348

@RazvanN7 RazvanN7 removed Needs Changelog A changelog entry needs to be added to /changelog Pending DIP Approval labels Mar 27, 2019
@jacob-carlborg
Copy link
Contributor

Changelog looks good, almost a bit too long.

@andralex andralex dismissed stale reviews from jacob-carlborg and wilzbach March 28, 2019 01:18

Changelog has been beefed up.

@andralex
Copy link
Member

Failures seem unrelated, I'll pull the plug on this.

@andralex andralex merged commit 588e8fd into dlang:master Mar 28, 2019
@MoonlightSentinel
Copy link
Contributor

This introduced a regression: https://issues.dlang.org/show_bug.cgi?id=22997
git bisect blames commit db88573

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Vision Vision Plan https://wiki.dlang.org/Vision/2018H1
Projects
None yet