Bug 7350 – Improve error message on access to non-existent enum field

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-01-22T19:29:00Z
Last change time
2012-10-21T14:44:25Z
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2012-01-22T19:29:38Z
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'?
Comment #1 by bearophile_hugs — 2012-01-22T19:35:39Z
See also issue 5004
Comment #2 by andrej.mitrovich — 2012-10-21T14:44:25Z
*** This issue has been marked as a duplicate of issue 3913 ***