[Issue 10278] New: Pre-condition failure blame error message to improve debugging

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 5 17:16:19 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10278

           Summary: Pre-condition failure blame error message to improve
                    debugging
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-06-05 17:16:18 PDT ---
int foo(int x)
in {
    assert(x >= 0); // line 3.
} body {
    return x ^^ 2;
}
void main() {
    foo(-1); // line 8.
}


With DMD 2.064alpha it gives at run-time:

core.exception.AssertError at temp(3): Assertion failure

followed by the stack trace.


To speed up my debugging I suggest to instead generate two error messages
similar to (the second line is the same as before):

temp.d(8): Pre-condition violation: x >= 0  (x = -1)
core.exception.AssertError at temp(3): Assertion failure

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list