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

Fix 22126 - Don't print overlapped fields with -checkaction=context #3522

Merged

Conversation

MoonlightSentinel
Copy link
Contributor

Detect overlapped fields by checking the offsets of adjacent members. Those are replaced by a placeholder because we cannot determine wich of the overlapped fields is valid (if any).


This currently requires more CTFE for each instantiantion of formatMembers. The overlap detection could be done at runtime by embedding the offsets array. But this could create unused miniFormat instantions if they are only required by overlapped fields. Not sure which approach is preferrable...

@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
22126 normal -checkaction=context should not print overlapped struct members

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#3522"

@dlang-bot dlang-bot added the Bug Fix Include reference to corresponding bugzilla issue label Jul 23, 2021
Detect overlapped fields by checking the offsets of adjacent members.
Those are replaced by a placeholder because we cannot determine wich
of the overlapped fields is valid (if any).
@thewilsonator thewilsonator merged commit 909976f into dlang:master Jul 24, 2021
}
}

test(S(1.0), S(2.0), "S(<overlapped field>, <overlapped field>) != S(<overlapped field>, <overlapped field>)");
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be <overlapped field> ? As in, print only one entry per union ?

@MoonlightSentinel MoonlightSentinel deleted the checkaction/overlapped-fields branch July 28, 2021 17:22
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
4 participants