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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 9 09:33:56 PST 2012


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


--- Comment #0 from bearophile_hugs at eml.cc 2012-12-09 09:33:55 PST ---
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: -------


More information about the Digitalmars-d-bugs mailing list