[Issue 5720] New: Error messages for missing properties must be improved.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 8 10:21:36 PST 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 at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at 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: -------


More information about the Digitalmars-d-bugs mailing list