[Issue 6242] New: Disallow inoperant "in" contracts

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 2 21:26:54 PDT 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 at puremagic.com
        ReportedBy: andrei at metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei at 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: -------


More information about the Digitalmars-d-bugs mailing list