Thread overview
[Issue 2883] New: array member call syntax fails when array is returned from "property" syntax
Apr 23, 2009
d-bugmail
Mar 08, 2010
Jonathan M Davis
[Issue 2883] [UFCS] array member call syntax fails when array is returned from "property" syntax
Nov 18, 2011
Nick Sabalausky
Nov 19, 2011
Kenji Hara
Feb 02, 2012
yebblies
April 23, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2883

           Summary: array member call syntax fails when array is returned
                    from "property" syntax
           Product: D
           Version: 1.041
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: cbkbbejeap@mailinator.com


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[]'
}
-------------


-- 

March 08, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2883


Jonathan M Davis <jmdavisProg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg@gmail.com


--- Comment #1 from Jonathan M Davis <jmdavisProg@gmail.com> 2010-03-07 18:39:46 PST ---
This is true in D2 as well. With dmd 2.040, this problem still exists.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 18, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2883


Nick Sabalausky <cbkbbejeap@mailinator.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|array member call syntax    |[UFCS] array member call
                   |fails when array is         |syntax fails when array is
                   |returned from "property"    |returned from "property"
                   |syntax                      |syntax


--- Comment #2 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2011-11-18 07:35:40 PST ---
With current versions of DMD, 'getArray' in the example above should be @property.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 19, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=2883



--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-11-19 05:12:32 PST ---
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
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2883


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johnch_atms@hotmail.com


--- Comment #4 from yebblies <yebblies@gmail.com> 2012-02-02 20:52:09 EST ---
*** Issue 3221 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------