www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3913] New: Bad error message with wrong enum

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

           Summary: Bad error message with wrong enum
           Product: D
           Version: 2.041
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This D2 program is wrong:

void main() {
    enum Foo { first, second }
    enum Foo f = Foo.secod;
}

It prints:

bug.d(3): Error: no property 'secod' for type 'int'

A better error message can be:

bug.d(3): Error: no enumerator 'secod' in enum 'Foo'. Did you mean 'second'?

(The possible match 'second' is chosen in the namespace of Foo only.)

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


Trass3r <mrmocool gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrmocool gmx.de
           Platform|x86                         |All
         OS/Version|Windows                     |All



Interestingly Type::getProperty already contains the code to search for and
suggest the correct property.
But the problem seems to be that Type is the enum base type instead of the
proper enum type in this case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 22 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3913




14:44:25 PDT ---
*** Issue 7350 has been marked as a duplicate of this issue. ***

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