www.digitalmars.com         C & C++   DMDScript  

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

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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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 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 temp(3): Assertion failure

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