Fix Bugzilla Issue 24818 Sumtype with single-type wastes space#10642
Fix Bugzilla Issue 24818 Sumtype with single-type wastes space#10642LightBender merged 3 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @Inkrementator! 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 run digger -- build "master + phobos#10642" |
pbackus
left a comment
There was a problem hiding this comment.
Please rewrite this to use getter and setter functions for tag, so that we don't have to add checks for Types.length > 1 in a bunch of different places.
Some constructors are I can do it for all other constructors if you prefer it. I tried this first: But this caused some unit tests to fail. I might eventually create a bug report for it, but I don't understand enough yet to isolate the error. |
|
https://github.com/Inkrementator/phobos/tree/sumtype_showerror see this branch std/sumtype.d line 510 to see how this would fail with template mixin |
I guess there's no better way to do it, then. Oh well. |
Github issue #10563
I tried doing this with a template mixin that takes the new tag as an alias parameter to avoid having to deplicate the static check all over the place, but that gave me deprecation warnings about assigning a variable to itself and also failed the unittest in line 936 where one postblit destructor didn't execute correctly ...