Bug 23898 – Incorrect error message when function not found

Status
NEW
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-05-06T16:21:35Z
Last change time
2024-12-07T13:42:41Z
Assigned to
No Owner
Creator
ryuukk_
Moved to GitHub: dmd#17207 →

Comments

Comment #0 by ryuukk.dev — 2023-05-06T16:21:35Z
``` struct Something{} void main() { Something test; test.get(); } ``` spits: ``` onlineapp.d(6): Error: none of the overloads of template `object.get` are callable using argument types `!()(Something)` /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(3442): Candidates are: `get(K, V)(inout(V[K]) aa, K key, lazy inout(V) defaultValue)` /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(3449): `get(K, V)(inout(V[K])* aa, K key, lazy inout(V) defaultValue)` ``` Why confuse the user?
Comment #1 by ryuukk.dev — 2023-05-06T16:46:12Z
It should say something like: onlineapp.d(6): Error: no property `get` for type `Something`.
Comment #2 by dlang-bugzilla — 2023-05-08T09:39:05Z
(In reply to ryuukk_ from comment #1) > It should say something like: > > onlineapp.d(6): Error: no property `get` for type `Something`. We can't do that, because then ///////////////// test.d ///////////////// auto functionIWantToCall(T)(T v) if (is(T == long)) { // ... } void main() { auto result = 5.functionIWantToCall(); } ////////////////////////////////////////// will produce "Error: no property `functionIWantToCall` for type `int`", and the user would be in their right to say "What do you mean, it's right there!". But maybe for UFCS calls there could be a message that is between the two.
Comment #3 by robert.schadek — 2024-12-07T13:42:41Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17207 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB