Bug 18809 – Improve error message on nonexistent property
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-04-29T12:04:45Z
Last change time
2019-11-29T06:19:54Z
Keywords
bootcamp, pull
Assigned to
No Owner
Creator
dlang
Comments
Comment #0 by dlang — 2018-04-29T12:04:45Z
The following code:
---
struct SomeStruct {}
void main() {
auto s = SomeStruct();
s.nonexistent = "hello";
}
---
yields the error message:
"source\app.d(5,6): Error: no property nonexistent for type SomeStruct"
Here, that's not a problem. But if SomeStruct was defined in another module, especially in a large or unfamiliar project, it would be helpful to have the fully qualified name to quickly identify the location of the type's definition:
"source\app.d(5,6): Error: no property nonexistent for type app.SomeStruct"
Comment #1 by nick — 2018-06-01T14:48:59Z
enum e = Object.foo;
The above code gives:
propmissing.d(1): Error: no property `foo` for type `object.Object`
Can you give an example where the FQN is not given, when the symbol is *not* defined in the module where the error is triggered?
Comment #2 by nick — 2018-06-11T14:36:41Z
Sorry, this issue is valid. Object seems to be a handled differently. The following code does not show the module in which GC is defined in the error message:
import core.memory;
enum e = GC.foo;
Comment #3 by dlang-bot — 2019-11-22T16:20:26Z
@alexandrumc created dlang/dmd pull request #10604 "Fix Issue 18809 - Improve error message on nonexistent property" fixing this issue:
- Fix Issue 18809 - Improve error message on nonexistent property
https://github.com/dlang/dmd/pull/10604
Comment #4 by dlang-bot — 2019-11-29T06:19:54Z
dlang/dmd pull request #10604 "Fix Issue 18809 - Improve error message on nonexistent property" was merged into master:
- ba748f78a34567cb8b282aab98e90ee54563dcc0 by Alexandru Militaru:
Fix Issue 18809 - Improve error message on nonexistent property; using fully qualified name
https://github.com/dlang/dmd/pull/10604