www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7722] New: Refuse normal functions to be used as properties

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7722

           Summary: Refuse normal functions to be used as properties
           Product: D
           Version: unspecified
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



I think this is a regression.
It was introduced by fixing bug 7670. See that for more info.

This code compiles with no errors with DMD 2.059head using the -property
switch:


class Foo {}
void spam(Foo f) {}
void main() {
    auto f = new Foo;
    f.spam;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 18 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7722


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|x86                         |All
            Version|unspecified                 |D2
         OS/Version|Windows                     |All



https://github.com/D-Programming-Language/dmd/pull/817

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7722




Enforce all  property attribute for property usage (with -property switch) is
good, but one problem is in there.

From:
https://github.com/D-Programming-Language/dmd/pull/817#issuecomment-4580804
https://github.com/D-Programming-Language/dmd/pull/817#issuecomment-4586905

 With UFCS, a property setting e1.prop = ev is rewritten to .prop(e1, ev).
 If the compiler disallows a property function with two arguments, we cannot
 set  property attribute to .prop function, but -property switch enforce to
 .prop that has  property. After all, we can never use such a syntax.
property void prop(int, int){} // Error: properties can only have zero or one parameter void main(){ 1.prop = 10; }
 The alternate way is to stop property enforcement for the UFCS setter that
 needs two arguments.
/* property */void prop(int, int){} void main(){ 1.prop = 10; } // not detected attribute missing with -property ---- arguments. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7722




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/a57a29cf4a3631154c29e64c9377418893b36698


Issue 7722 - Refuse normal functions to be used as properties

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7722




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/cc28ed074548ed6e8f5cf0d2f2a422b41ff51581
Revert "fix Issue 7722 - Refuse normal functions to be used as properties"

This reverts commit ddd8f3456207ed4b94fb36fde9538e37eac36687.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7722




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/e1d932a56c80ea8d5f4adad85df648c71314f187
fix Issue 7722 - Refuse normal functions to be used as properties

https://github.com/D-Programming-Language/dmd/commit/55e2a21b43a585cc3175542c0a89c17785631773
Revert "fix Issue 7722 - Refuse normal functions to be used as properties"

This reverts commit ddd8f3456207ed4b94fb36fde9538e37eac36687.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7722




Reposted same pull:
https://github.com/D-Programming-Language/dmd/pull/830

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 24 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7722




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/29fa5e260ff5a56ac4716aa67840e0d4fd175a69


Issue 7722 - Refuse normal functions to be used as properties

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 27 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7722


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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