digitalmars.D.bugs - [Issue 4562] New: D2 Language Docs: http://www.digitalmars.com/d/2.0/dbc.html
- d-bugmail puremagic.com (48/48) Aug 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4562
- d-bugmail puremagic.com (14/14) Jan 04 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4562
http://d.puremagic.com/issues/show_bug.cgi?id=4562 Summary: D2 Language Docs: http://www.digitalmars.com/d/2.0/dbc.html Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Severity: normal Priority: P2 Component: www.digitalmars.com AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 14:58:13 PDT --- It states: "A function without an in contract means that any values of the function parameters are allowed. This implies that if any function in an inheritance hierarchy has no in contract, then in contracts on functions overriding it have no useful effect." But my example proves otherwise: class A { int test(int x) { return x * 2; } } class B : A { int test(int x) in { assert(x == 20); } body { return x * 2; } } void main() { B b = new B; b.test(10); } This will raise an assert error, which would negate the statement "in contracts on functions overriding it have no useful effect.". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4562 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED 07:45:24 PST --- This has turned into a CT error in 2.057 and probably earlier: test.d(11): Error: function test.B.test cannot have an in contract when overriden function test.A.test does not have an in contract I think it's ok to close it then. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 04 2012