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

fix issue 20324 - Calling __traits(getUnitTests) on a template causes compiler segfault #10533

Closed
wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 3, 2019

The idea is that you cannot get the tests of a partially specialized type. unittest blocks inside a partially specialized type may use or not the template parameters so allowing them would require a complex analysis.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @clYd3r! 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 coverage diff by visiting the details link of the codecov check)
  • 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

Auto-close Bugzilla Severity Description
20324 minor Calling __traits(getUnitTests) on a template causes compiler segfault

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 "stable + dmd#10533"

@Geod24
Copy link
Member

Geod24 commented Nov 4, 2019

It would be better to say what the type passed is.

@ghost
Copy link
Author

ghost commented Nov 4, 2019

I have doubts anyway. I used a tester based on the trait but my own code doesn't contain any inner unittest block so I need to verify one or two things. TLDR; don't merge fast... there's two or three weeks before next bug fix release anyway.

@Geod24
Copy link
Member

Geod24 commented Nov 4, 2019

Applied a label, feel free to ping to have it removed.

@ghost ghost requested a review from thewilsonator November 5, 2019 09:45
@ghost
Copy link
Author

ghost commented Nov 5, 2019

I've changed the approach and decided not to issue an error.

@ghost
Copy link
Author

ghost commented Nov 5, 2019

ping for the removal of the blocked "label", checks done.

@Geod24
Copy link
Member

Geod24 commented Nov 5, 2019

I've changed the approach and decided not to issue an error.

That might be a surprising behavior. Can you expand on why you went with this approach ? Adding the explanation in the commit message would be great too.

@ghost
Copy link
Author

ghost commented Nov 5, 2019

  1. This makes writing a generic tester more friendly, with less static if.
  2. On the principle of least astonishment, I'm less astonished by no error than by an error. It's pretty obvious that templates that are not instances are not usable. For example when I made the fix I didn't even tried to see where the AV happened, I directly opened traits.d because the place to fix the crash was obvious.

@RazvanN7 RazvanN7 closed this Nov 18, 2019
@RazvanN7
Copy link
Contributor

Hmm, I wanted to close and reopen to restart the autotester, but it seems like the branch was deleted and I cannot reopen. It seems like the github account was deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants