Bug 4205 – Strange error message when trying to call unknown method on string
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2010-05-18T15:52:00Z
Last change time
2012-12-28T17:06:43Z
Assigned to
nobody
Creator
luk.wrzosek
Comments
Comment #0 by luk.wrzosek — 2010-05-18T15:52:27Z
//=============================
module fooo;
class C
{
}
void main(string[] args)
{
int i = 10;
string str = "123";
C c = new C;
i.toHash(); //tmp.d(13): Error: no property 'toHash' for type 'int'
i.someFunc(); //tmp.d(14): Error: no property 'someFunc' for type 'int'
c.toHash();
c.someFunc(); //tmp.d(17): Error: no property 'someFunc' for type 'fooo.C'
str.toHash(); //tmp.d(19): Error: undefined identifier module fooo.toHash
str.someFunc(); //tmp.d(20): Error: undefined identifier module fooo.someFunc
}
Comment #1 by andrej.mitrovich — 2012-10-20T10:30:33Z
These are now:
test.d(11): Error: undefined identifier 'toHash'
test.d(12): Error: undefined identifier 'someFunc'
test.d(15): Error: undefined identifier 'someFunc'
test.d(17): Error: undefined identifier 'toHash'
test.d(18): Error: undefined identifier 'someFunc'
Which is one step forward and one step back. I'd prefer 'Error: no property 'toHash' for type 'int'', but I guess the new error is due to UFCS support. Still the 'module' stuff is gone, so marking fixed.