Bug 9635 – Improved error message for failed access of array field properties from static method

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-02T12:08:00Z
Last change time
2013-03-05T11:29:57Z
Keywords
diagnostic, pull
Assigned to
andrej.mitrovich
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-03-02T12:08:03Z
Spinoff of issue 9630 This program: struct Foo { int i[1]; static void bar() { assert(0 < i[0].max); } } Currently gives: temp.d(4): Error: need 'this' for i type int[1u]. Andrej Mitrovic suggests: > This is already a bad message. 'i' should be quoted and the wording should be > improved: > temp.d(4): Error: need 'this' for 'i' of type int[1u] Is it possible to generate an error message like this, that suggests how to fix the problem? temp.d(4): Error: need 'this' for 'i' of type int[1u]. Use typeof(i[0]).max instead
Comment #1 by andrej.mitrovich — 2013-03-04T20:32:13Z
(In reply to comment #0) > Is it possible to generate an error message like this, that suggests how to fix > the problem? > > temp.d(4): Error: need 'this' for 'i' of type int[1u]. Use typeof(i[0]).max > instead This could end up being arbitrarily hard to implement, so I'll just improve the wording of the error message like I've mentioned. https://github.com/D-Programming-Language/dmd/pull/1721
Comment #2 by github-bugzilla — 2013-03-05T05:57:18Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/49c26139d40f3c89983a1a361b15b00f63291f5e Fixes Issue 9635 - Improve message on missing this diagnostics. https://github.com/D-Programming-Language/dmd/commit/d6db1b834c24422bd28984760f662a6a37df234e Merge pull request #1721 from AndrejMitrovic/Fix9635 Issue 9635 - Improve message on missing 'this' diagnostics.
Comment #3 by bearophile_hugs — 2013-03-05T10:08:40Z
If you think it's too much hard to implement, then I close this down. I use WONTFIX then.
Comment #4 by andrej.mitrovich — 2013-03-05T11:29:57Z
Open it up as a new enhancement for later, I might look into it when I have the time. Let this one be fixed since a fix was implemented.