Thread overview
[Issue 6242] New: Disallow inoperant "in" contracts
Jul 03, 2011
yebblies
Jul 03, 2011
Walter Bright
Jul 04, 2011
kennytm@gmail.com
Jul 05, 2011
Walter Bright
July 03, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6242

           Summary: Disallow inoperant "in" contracts
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrei@metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei@metalanguage.com> 2011-07-02 21:21:52 PDT ---
Consider:

class A { void fun(int) {} }

class B : A { void fun(int x) in { assert(x > 0); } body {} }

In this case B's in contract is never called. The compiler should disallow the code. To make the code work, an empty "in" contract on A.fun should suffice. The error message should mention that.

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


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, patch
                 CC|                            |yebblies@gmail.com
           Platform|Other                       |All
         OS/Version|Mac OS X                    |All


--- Comment #1 from yebblies <yebblies@gmail.com> 2011-07-03 15:06:52 EST ---
https://github.com/D-Programming-Language/dmd/pull/196

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


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-07-03 12:05:35 PDT ---
https://github.com/D-Programming-Language/dmd/commit/c8b18c01ca47fbe1b140e368418da50d93205b4d

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

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


kennytm@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |kennytm@gmail.com
         Resolution|FIXED                       |


--- Comment #3 from kennytm@gmail.com 2011-07-04 11:21:03 PDT ---
Reopened as currently the code is still accepted. Perhaps pull 207 needs to be merged first.

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

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


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2011-07-04 19:16:50 PDT ---
https://github.com/D-Programming-Language/dmd/commit/e52066fbfcaf9cc0879f0665e2b11f23d209494d

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