Bug 2883 – (D1 only) ufcs does not work with property syntax
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2009-04-22T23:37:02Z
Last change time
2019-07-16T04:04:32Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Nick Sabalausky
Comments
Comment #0 by bus_dbugzilla — 2009-04-22T23:37:02Z
When you want to use the "myArray.myFuncTakingAnArray()" syntax on an array that's returned from a function, it fails to compile if the array-returning function is called using "getArray" instead of "getArray()".
-------------
char[] getArray()
{ return "hello"; }
void useArray(char[] str)
{ /* stuff */ }
void main()
{
int i;
i = getArray().length; // Ok
i = getArray.length; // Ok
getArray().useArray(); // Ok
getArray.useArray(); // Error: no property 'useArray' for type 'char[]'
}
-------------
Comment #1 by issues.dlang — 2010-03-07T18:39:46Z
This is true in D2 as well. With dmd 2.040, this problem still exists.
Comment #2 by bus_dbugzilla — 2011-11-18T07:35:40Z
With current versions of DMD, 'getArray' in the example above should be @property.
Comment #3 by k.hara.pg — 2011-11-19T05:12:32Z
In 2.057head, following code works, by fixing bug 6927.
string getArray()
{ return "hello"; }
void useArray(string str)
{ /* stuff */ }
void main()
{
int i;
i = getArray().length; // OK
i = getArray.length; // OK
getArray().useArray(); // OK
getArray.useArray(); // 2.057head OK
}
Comment #4 by yebblies — 2012-02-02T01:52:09Z
*** Issue 3221 has been marked as a duplicate of this issue. ***
Comment #5 by pro.mathias.lang — 2019-07-16T04:04:32Z
As discussed during the last DConf, Leandro Lucarella from Sociomantic gave us the green light to finally kill the D1 bugs.