Thread overview
[Issue 7350] New: Improve error message on access to non-existent enum field
Jan 23, 2012
Andrej Mitrovic
Oct 21, 2012
Andrej Mitrovic
January 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7350

           Summary: Improve error message on access to non-existent enum
                    field
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-01-22 19:29:38 PST ---
enum X
{
    yes,
    no
}

void main()
{
    auto x = X.Yes;
}

test.d(11): Error: no property 'Yes' for type 'int'

There are two things that could be improved. One is to change the error message to:

test.d(11): Error: no property 'Yes' for type 'X'

This is the error you get when accessing fields that don't exist in a struct. We could also make this say "enum" instead of "type.

The second enhancement would be to implement the 'spelling correction' which we already have in some places. So the error message (in this case) would be:

test.d(14): Error: no property 'Yes' for type 'X', did you mean property 'yes'?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7350


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from bearophile_hugs@eml.cc 2012-01-22 19:35:39 PST ---
See also issue 5004

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


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

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


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-21 14:44:25 PDT ---
*** This issue has been marked as a duplicate of issue 3913 ***

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