Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Fix Issue 20763 - checkaction=context does not format pointers #3061

Merged
merged 1 commit into from
Apr 24, 2020

Conversation

MoonlightSentinel
Copy link
Contributor

@MoonlightSentinel MoonlightSentinel commented Apr 23, 2020

This adds hexadecimal printing for pointers. Note that it still prefers toString for struct pointers if possible (because toString will probably be more useful than raw pointer values).

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @MoonlightSentinel! 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
20763 minor checkaction=context does not format pointers

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + druntime#3061"

@dlang-bot dlang-bot added the Bug Fix Include reference to corresponding bugzilla issue label Apr 23, 2020
@schveiguy
Copy link
Member

Note that it still prefers toString for struct pointers if possible

This doesn't make sense. If you are using struct pointers, you are comparing two pointers, not the contents of the structs. It doesn't matter what the structs contain. The pointer values should be printed instead.

For instance:

struct S
{
   string val;
   string toString() { return "S(" ~ val ~ ")"; }
}

void main()
{
   auto s1 = S("hello");
   auto s2 = s1;
   assert(&s1 == &s2); // prints "Error: S(hello) != S(hello)" ?
}

@MoonlightSentinel
Copy link
Contributor Author

RIght, that would be weird.
It'll always print the pointer now.

This adds hexadecimal printing for pointers. Note that it still prefers
toString for struct pointers if possible (because toString will probably be
more useful than raw pointer values).
@dlang-bot dlang-bot merged commit 9a0a431 into dlang:master Apr 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Fix Include reference to corresponding bugzilla issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants