Bug 3913 – Bad error message with wrong enum

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-03-09T08:18:00Z
Last change time
2016-01-03T14:02:02Z
Keywords
diagnostic, pull
Assigned to
andrej.mitrovich
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-03-09T08:18:57Z
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.)
Comment #1 by hoganmeier — 2011-08-22T08:24:21Z
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.
Comment #2 by andrej.mitrovich — 2012-10-21T14:44:25Z
*** Issue 7350 has been marked as a duplicate of this issue. ***
Comment #3 by andrej.mitrovich — 2014-02-12T13:26:40Z
Comment #4 by bearophile_hugs — 2014-02-12T14:02:20Z
(In reply to comment #3) > https://github.com/D-Programming-Language/dmd/pull/3252 Good. The related issue is with alias, Issue 5004
Comment #5 by github-bugzilla — 2015-10-18T12:19:40Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4817e508904471d349e71637385f8894cb4bb4f6 Fix Issue 3913 - Emit better lookup diagnostics for enum members https://github.com/D-Programming-Language/dmd/commit/853c4c30a7aee44bca1df662aa2a1f313771fa11 Merge pull request #5186 from AndrejMitrovic/fix-3913 Issue 3913 - Emit better lookup diagnostics for enum members
Comment #6 by github-bugzilla — 2016-01-03T14:02:02Z