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

           Summary: Error messages that show the package/module name too
                    of a function
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-10-26 13:12:58 PDT ---
This is small D2 module, file named "mod.d":

module mod;
int foo(int x) {
    return x;
}



This is a wrong small module that imports "mod.d", named "test.d":


import mod: foo;
pure int bar(int x) {
    return foo(x);
}
void main() {}


DMD 2.050alpha gives the error message:

test.d(3): Error: pure function 'bar' cannot call impure function 'foo'


In this case it's easy to find "bar" and fix the bug, but this is less easy
when "test" imports many modules and functions. So I'd like a better error
message, that shows the module name too of "foo". This is a possible improved
error message:

test.d(3): Error: pure function 'bar' cannot call impure function 'foo' of
module 'mod'.


An alternative:

test.d(3): Error: pure function 'bar' cannot call impure function 'mod.foo'.

(If "foo" is inside another package it's better to give the name of the package
too.)

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

Reply via email to