www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9128] New: Better error message for method-level/instance-level name confusions

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9128

           Summary: Better error message for method-level/instance-level
                    name confusions
           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



This program:


struct Foo {
    void bar() {
        int spam;
        // Some stuff here.
        this.spam++;
    }
}
void main() {}


DMD2.061alpha gives:

test.d(5): Error: undefined identifier 'spam'


Here spam is a method-level name instead of a instance-level attribute. In
complex methods that error message doesn't give enough help.


So I suggest a better error message, something like:

test.d(4): Error: undefined identifier 'this.spam', did you mean 'spam'?


Other error messages are possible, that mention more explicitly that there is a
method-level identifier with the same name.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 09 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9128


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

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



09:06:22 PST ---
The root cause of this is the 2.069 regression in Issue 8894. There's a pull
waiting for it.

*** This issue has been marked as a duplicate of issue 8894 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 10 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9128




09:06:50 PST ---

 The root cause of this is the 2.069 regression in Issue 8894. There's a pull
 waiting for it.
 
 *** This issue has been marked as a duplicate of issue 8894 ***
I meant 2.059 regression (I don't time-travel, I swear!) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 10 2012