[Issue 6487] New: Richer impurity error message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 12 15:27:16 PDT 2011


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

           Summary: Richer impurity error message
           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 2011-08-12 15:27:15 PDT ---
When a function is not pure/safe because it calls a function present elsewhere
the error message is not the best:


import std.bigint, std.math;
void main() {
    auto r = abs(BigInt(-1000));
}


dmd 2.054 gives:

...\src\phobos\std\math.d(251): Error: pure function 'abs' cannot call impure
function 'opCmp'
...\src\phobos\std\math.d(251): Error: safe function 'abs' cannot call system
function 'opCmp'

Here I'd like DMD to print something like:

...\src\phobos\std\math.d(251): Error: pure function 'abs' cannot call impure
function 'std.bigint.BigInt.opCmp'

Or maybe even (but this is getting a bit too much noisy):  

...\src\phobos\std\math.d(251): Error: pure function 'abs' cannot call impure
function '\src\phobos\std\std.bigint.BigInt.opCmp(360)'

If the function is in the same module then it's better to produce a shorter
printout.

-- 
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