March 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5720

           Summary: Error messages for missing properties must be
                    improved.
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-03-08 10:18:35 PST ---
This is a notorious error message that pops up from time to time due to human-nature (typos). Here's a trivial example:

module test;

void main()
{
    auto foo = [4, 5, 6, 7];
    assert(!foo.empty);
}

And the error:
test.d(6): Error: undefined identifier module test.empty

When a property is not found, the error message should reflect that there is no such property for symbol 'foo', instead of saying there's no identifier 'empty', which makes no sense at all (unless you count in UFCS, which comes into play here if you import std.array).

I want this kind of error message to appear:
test.d(6): Error: foo has no property 'empty'

The above test case may be too trivial to notice just how damaging the original error message is.

I've had a case in my code where I've had a couple of levels of pointer indirection (due to how a C library worked), I've had a typo and I was getting this same kind of error. It was quite frustrating to spend 30+ minutes on something as silly as a typo due to the error message pointing at something completely different.

An error message that lies can be as bad as a lying comment in a piece of code. Can we improve this, please?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5720


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-03-08 15:44:33 PST ---
Ok apparently this would just create confusion for UFCS users, and I would probably agree on this. I'm closing this one down for now.

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