www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5122] New: Error messages that show the package/module name too of a function

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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: -------
Oct 26 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5122


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |DUPLICATE


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-10-21
16:08:17 PDT ---
*** This issue has been marked as a duplicate of issue 7050 ***

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