Compiler generated assertion error message
safety0ff via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jun 19 10:44:46 PDT 2014
A year and a half ago Andrej Mitrovic created a DMD pull ([1])
which implements dmd adding a prefix string containing the
failing assertion to the assertion error's "msg" field.
Unfortunately it triggered code generation bugs, issues #12852 &
#12855, which have recently been fixed ([2] & [3].)
I have put Andrej's rebased patch in PR #3669 ([4]) and made the
necessary phobos unit test modifications in [5]. His patch should
now pass the tests.
An example of how this patch improves the generated "msg" field
is given in [5], (note that it is generated by the code from [6].)
It is worth noting that the bitfield's assertion message was
recently modified in [6] to be more informative, perhaps with
this patch, that change would not have been as necessary.
It would be nice to have some feedback about this change.
Personally, I found it more useful than I had first expected.
I had forgotten that my local DMD was patched until I received a
failed assertion message which gave me all the context I needed
within the assertion message.
I recommend giving it a try.
[1] https://github.com/D-Programming-Language/dmd/pull/1426
[2] https://github.com/D-Programming-Language/dmd/pull/3624
[3] https://github.com/D-Programming-Language/dmd/pull/3622
[4] https://github.com/D-Programming-Language/dmd/pull/3669
[5]
https://github.com/D-Programming-Language/phobos/pull/2252/files
[6]
https://github.com/D-Programming-Language/phobos/pull/2113/files
More information about the Digitalmars-d
mailing list